problem with QueryFontMetrics

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
Chelmite
Posts: 3
Joined: 2004-01-29T23:04:08-07:00

problem with QueryFontMetrics

Post by Chelmite »

I'm trying to call QueryFontMetrics from PerlMagick 6.3.4, using the sample program given in Perl Graphics Programming, pages 66-68.

When I get to the QueryFontMetrics call:

Code: Select all

my ($w, $h, $ascend, $descend, $text_w, $text_h, $max)
  = $image->QueryFontMetrics(font => '@arial.ttf',
			     pointsize => 64,
			     text => "Hello World");
All the variables on the left-hand side are undefined after executing this statement.
I checked, and arial.ttf is in /usr/X11R6/lib/X11/fonts/truetype/arial.ttf.

Versions:
O/S: SuSE 10.0
Perl: 5.8.8
ImageMagick: 6.3.4
Freetype2: 2.1.10-4.9

I ran

Code: Select all

% convert -list type
Path: System Fonts

Name                             Family                 Style   Stretch   Weight
--------------------------------------------------------------------------------
Arial-Black-Regular              Arial Black            Normal  Normal       400
Arial-Bold                       Arial                  Normal  Normal       700
Arial-Bold-Italic                Arial                  Italic  Normal       700
Arial-Italic                     Arial                  Italic  Normal       400
Arial-Regular                    Arial                  Normal  Normal       400
So, I also tried:

Code: Select all

...  = $image->QueryFontMetrics(font => 'Arial.ttf',
			     pointsize => 64,
			     text => "Hello World");
and

Code: Select all

...  = $image->QueryFontMetrics(font => 'Arial-Regular.ttf',
			     pointsize => 64,
			     text => "Hello World");
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: problem with QueryFontMetrics

Post by anthony »

Try using the full path to the 'ttf' library or just 'Arial' no @ and no suffix.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply