PerlMagick's QueryFontMetrics

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
tdan

PerlMagick's QueryFontMetrics

Post by tdan »

1. Can this method be used for text that is created using SVG's Draw() instead of Annotate()?
2. Does QueryMultilineFontMetrics return the same results of QueryFontMetrics?
According to documentation QueryFontMetrics returns:
* character width
* character height
* ascender
* descender
* text width
* text height
* maximum horizontal advance
* bounds.x1
* bounds.y1
* bounds.x2
* bounds.y2
* origin.x
* origin.y
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PerlMagick's QueryFontMetrics

Post by magick »

The Draw() method calls Annotate() for rendering text so if you are only dealing with text, Annotate() is recommend.

The QueryMultilineFontMetrics() returns the same values as QueryFontMetrics() except the values are relative to a series of text lines whereas QueryFontMetrics() returns font metrics for a single line of text only.
tdan

Re: PerlMagick's QueryFontMetrics

Post by tdan »

OK - I'll use Annotate then.

I'm glad to hear that QueryMultilineFontMetrics takes the same parameters, however, I cannot get it to work correctly:

Code: Select all

#!/usr/bin/perl
use Image::Magick;
use strict;

my ($image, $x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance, $predict);

$image = new Image::Magick;
$image->Set( size=>'1x1' );
$image->ReadImage( 'xc:none' );

($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_advance) = $image->QueryMultilineFontMetrics(text=>'A single line of text', font=>'arial.ttf', fill=>'blue', pointsize=>'12' );
I get an error:

Code: Select all

Can't locate auto/Image/Magick/QueryMultil.al in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./roo.pl line 11
Is it because I have an old version of PerlMagick?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PerlMagick's QueryFontMetrics

Post by magick »

Looks like you need to upgrade your ImageMagick/PerlMagick distribution. We ran your script without complaint. We're using ImageMagick 6.3.2-4.
Chelmite
Posts: 3
Joined: 2004-01-29T23:04:08-07:00

Re: PerlMagick's QueryFontMetrics

Post by Chelmite »

Please ignore...I replied to the wrong thread and I can't delete this message.
Post Reply