Page 1 of 1
setfont,but setfontweight no work
Posted: 2010-10-13T03:06:57-07:00
by jackliangs
Code: Select all
<?php
$Imagick = new Imagick();
$bg = new ImagickPixel();
$bg->setColor( 'white' );
$ImagickDraw = new ImagickDraw();
$ImagickDraw->setfont("/var/www/simkai.ttf");
$ImagickDraw->setFontSize( 20 );
$ImagickDraw->setfontweight(100);
$string = 'Az';
$Imagick->newImage( 600, 300, $bg );
$Imagick->annotateImage( $ImagickDraw, 4, 20, 0, $string );
$Imagick->drawImage( $ImagickDraw );
$Imagick->setImageFormat( 'png' );
header( "Content-Type: image/{$Imagick->getImageFormat()}" );
echo $Imagick->getImageBlob( );
?>
Set a font, while the effect of setting a bold, but bold is not in force, if not properly set the font bold. May I set the font does not contain a bold, but the algorithm should be bold freetype.
Code: Select all
<edit name="embolden" mode="assign">
<bool>true</bool>
</edit>
Please give me some help, thanks.
Re: setfont,but setfontweight no work
Posted: 2010-10-13T06:15:26-07:00
by anthony
Font weights are not used with regard to TTF fonts. They are for other different font schemes.
For TTF fonts you generally use a different font from the same family for different attributes like bold, italic, etc.
However if you do not have access to a 'bold' font you can sometimes fake a bold version by say increasing the inter-character spacing and using a stroke to make the font slightly thicker. For Italic you can use angle warps such as provided by the annotate operator.
Many other things can also be done such as shown in 'Compound Font Examples' in IM Examples.
http://www.imagemagick.org/Usage/fonts/