Page 1 of 1

PerlMagick's QueryFontMetrics

Posted: 2007-02-13T11:51:33-07:00
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

Re: PerlMagick's QueryFontMetrics

Posted: 2007-02-13T12:23:38-07:00
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.

Re: PerlMagick's QueryFontMetrics

Posted: 2007-02-13T12:44:12-07:00
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?

Re: PerlMagick's QueryFontMetrics

Posted: 2007-02-13T12:59:04-07:00
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.

Re: PerlMagick's QueryFontMetrics

Posted: 2007-07-06T13:10:21-07:00
by Chelmite
Please ignore...I replied to the wrong thread and I can't delete this message.