MagickWand, DrawSetFont does nothing, always Arial

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
monsters

MagickWand, DrawSetFont does nothing, always Arial

Post by monsters »

Hi,

I have a succesfful imagemagic/ghostscript/magickwand install, and all is well, but no matter what font i specify, I get arial!

code sample , outputs the image, annotated properly, but only ever in arial...

-----
$source = NewMagickWand();
$drawing = NewDrawingWand();
$pixel = NewPixelWand();
PixelSetColor($pixel,"#ff0000");
DrawSetFillColor($drawing,$pixel);
DrawSetFont ( $drawing , "Times" ) ;
DrawSetFontSize( $drawing,$fontsize);
DrawSetFontWeight($drawing,100);
MagickReadImage($source,'3.jpg');
MagickSetFormat($source, 'JPEG');
DrawAnnotation($drawing, $xLocation, $yLocation + $height , $string);
MagickDrawImage($source, $drawing);
MagickWriteImage($source,'output.jpg');
----------

doing "identify -list type" shows lots of available fonts... also doing a command line ImageMagick command to create text works fine, and uses the requested font... eg:
--------------------------------------
echo "This is a test" | convert -background yellow -font Courier-New +antialias -page 200x200 text:- mediocreimage.jpg
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Set this environment variable MAGICK_DEBUG as follows:

setenv MAGICK_DEBUG annotate

Run your PHP script and check the debugging output. It will tell you which font ImageMagick used to render your text.
monsters

Tried that, no difference.

Post by monsters »

Hi,

I tried using

set MAGICK_DEBUG annotate

and

export MAGICK_DEBUG=annotate

at the shell, then running my php file
neither made it output anything different...

Thanks for your reply
monsters

upate

Post by monsters »

i set magick_debug to all , and got lots of ouput, now i see that it's not reading the font!

i get 'unable to read font '/tmp/Courier-New' which is where i'm running it from, so that's good...

I used the full path to a ttf and it works a champ!!

thanks, magick_debug was the key.
Post Reply