as far as i know, imagemagick use font to present differnet text style.
however, now more and more font just provider regular font, with no bold or italic font.
can i present these font's bold style with imagemagick?
can i draw a bold text with regular font?
Re: can i draw a bold text with regular font?
I think you can only do it in draw.
Code: Select all
<?php
exec("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 -style italic -draw \"gravity NorthWest fill black text 0,0 'The quick red fox
jumped over the
lazy brown dog'\" font1.png");
?>
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: can i draw a bold text with regular font?
you can generally get a bold version of the specific font and specify that
Re: can i draw a bold text with regular font?
Bonzo's solution depends on font register file, if i don't reg italic or bold font in it, then it doesn't works, or works but still invoke the regular font.
fmw42's solution, i've tried. and i found i can just generate a bold version of the specific font in a specific size(as it was convert to bmp format), but i don't know which size of the font will i use, so i can use this solution.
and i found i can use skewX to simulate italic font, but i haven't found i way to simulate bold font, that's my mainly problem now
http://www.imagemagick.org/Usage/fonts/#slanted
regards
fmw42's solution, i've tried. and i found i can just generate a bold version of the specific font in a specific size(as it was convert to bmp format), but i don't know which size of the font will i use, so i can use this solution.
and i found i can use skewX to simulate italic font, but i haven't found i way to simulate bold font, that's my mainly problem now
http://www.imagemagick.org/Usage/fonts/#slanted
regards
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: can i draw a bold text with regular font?
A simple way to bold is to just set -strokecolor to the same color as -fill and set a -strokewidth to 1(default) or 2.
See..
http://imagemagick.org/Usage/fonts/#stroke
but with both colors the same.
The Best method is of course to use a bold version of that font, if that font is part of a specific font family. Bold fonts are often slightly longer with extra spacing between characters.
See..
http://imagemagick.org/Usage/fonts/#stroke
but with both colors the same.
The Best method is of course to use a bold version of that font, if that font is part of a specific font family. Bold fonts are often slightly longer with extra spacing between characters.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: can i draw a bold text with regular font?
hi,
how to make font bold or italic?
i tried,
<?php
$draw = new ImagickDraw();
$draw->setFontStyle(2);
and
$draw->setFontStyle(Imagick:: STYLE_ITALIC);
?>
but not working...
please help me on this
thanks a lot
nikul
how to make font bold or italic?
i tried,
<?php
$draw = new ImagickDraw();
$draw->setFontStyle(2);
and
$draw->setFontStyle(Imagick:: STYLE_ITALIC);
?>
but not working...
please help me on this
thanks a lot
nikul
Re: can i draw a bold text with regular font?
There is an example and comments on this page: http://valokuva.org/?p=10 search it for setFontStyle
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: can i draw a bold text with regular font?
I just tried this under Windows. You have to provide the full path name to the font file, i.e. "C:\Windows\fonts\verdana.ttf". But the neither "-style italic" nor "-weight bold" have any effect on the font type; you have to choose the right font file, i.e. something like "timesbd.ttf".Bonzo wrote:I think you can only do it in draw.
Code: Select all
<?php exec("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 -style italic -draw \"gravity NorthWest fill black text 0,0 'The quick red fox jumped over the lazy brown dog'\" font1.png"); ?>
AFAIK Windows has default mechanisms to turn any font into italic or bold, but IM does not seem to activate these mechanisms.
Wolfgang Hugemann