On 8/13/07, Eric Adum <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I recently installed ImageMagick 6.3.5 and the corresponding PerlMagick
> (from source); however, now when I call the QueryFontMetrics method, it
> returns undef.
>
> When I call QueryFont(), I get a list of fonts, so I know that ImageMagick
> can see the font I'm trying to use.
>
> For example,
>
> #! /usr/bin/perl
> use Image::Magick;
> use Data::Dumper;
> my $img = Image::Magick->new();
> my @fonts = $img->QueryFont();
> foreach my $font ( @fonts ) {
>    print Dumper($img->QueryFontMetrics( text => 'Testing 1 2 3', font =>
> $font ));
> }
>
> returns something like this:
>
> $VAR1 = undef;
> $VAR1 = undef;
> $VAR1 = undef;
> $VAR1 = undef;
> $VAR1 = undef;
> ...
>
> Anyone have an idea of why this could be happening? It was working fine in
> the old version of ImageMagick I was using (6.2.4). Or, any suggestions on
> debugging?
>
> Also, all of the demos in PerlMagick/demo work fine (but none of them use
> QueryFontMetrics).

Hi - you need an actual image ( not just the Image::Magick base ) for
QueryFontMetrics; this works:

#! /usr/bin/perl
use strict;
use warnings FATAL => 'all';
use Image::Magick;
use Data::Dumper;
my $img = Image::Magick->new();
my @fonts = $img->QueryFont();
$img->Set( size => "100x100" );
$img->Read( "Xc:white" );
foreach my $font ( @fonts ) {
   print Dumper( [ $img->QueryFontMetrics( text => 'Testing 1 2 3', font =>
$font ) ] );
}

Aloha => Beau;
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to