PerlMagick (6.40) Annotate - unable to change fonts
Posted: 2008-07-26T05:12:58-07:00
I am having an issue with the Annotate function of PerlMagick (6.40).
In a test perl module I am requesting a list of the fonts available and walking through the list to generate an image containing the font name, written in that font. The images are created and the text is displayed, however the text appears in the same font in each image.
My script:
my $image;
my $font_image;
my $x = "";
my $i = 0;
$image = Image::Magick->new;
my @fonts = $image->QueryFont();
for ($i=0;$i<scalar @fonts;$i++)
{
$font_image = Image::Magick->new;
$font_image->ReadImage('xc:white');
$font_image->Set(debug=>'Annotate');
$x = $font_image->Resize(width=>640, height=>640);
warn "$x" if "$x";
my $text = $fonts[$i];
$x = $font_image->Annotate(font=>$text, x=>10, y=>160, fill=>'green',
text=>$text);
warn "$x" if "$x";
my $full_preview_name := "/appl/images/fonts/a_".$text.".gif";
$x = $font_image->Write(filename=>$full_preview_name,
compression=>'NONE');
warn "$x" if "$x";
}
With debug set for Annotate, I receive these msgs that indicate it is selecting the correct font and I have checked that each of these file exist.
2008-07-25T17:03:30-05:00 0:11 8.670u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022004l.pfb; pointsize 12
2008-07-25T17:03:31-05:00 0:12 9.610u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022024l.pfb; pointsize 12
2008-07-25T17:03:31-05:00 0:12 9.620u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022024l.pfb; pointsize 12
2008-07-25T17:03:32-05:00 0:13 10.560u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022023l.pfb; pointsize 12
So, any ideas why the text annotation in each of the images never changes fonts?
Any help is greatly appreciated
In a test perl module I am requesting a list of the fonts available and walking through the list to generate an image containing the font name, written in that font. The images are created and the text is displayed, however the text appears in the same font in each image.
My script:
my $image;
my $font_image;
my $x = "";
my $i = 0;
$image = Image::Magick->new;
my @fonts = $image->QueryFont();
for ($i=0;$i<scalar @fonts;$i++)
{
$font_image = Image::Magick->new;
$font_image->ReadImage('xc:white');
$font_image->Set(debug=>'Annotate');
$x = $font_image->Resize(width=>640, height=>640);
warn "$x" if "$x";
my $text = $fonts[$i];
$x = $font_image->Annotate(font=>$text, x=>10, y=>160, fill=>'green',
text=>$text);
warn "$x" if "$x";
my $full_preview_name := "/appl/images/fonts/a_".$text.".gif";
$x = $font_image->Write(filename=>$full_preview_name,
compression=>'NONE');
warn "$x" if "$x";
}
With debug set for Annotate, I receive these msgs that indicate it is selecting the correct font and I have checked that each of these file exist.
2008-07-25T17:03:30-05:00 0:11 8.670u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022004l.pfb; pointsize 12
2008-07-25T17:03:31-05:00 0:12 9.610u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022024l.pfb; pointsize 12
2008-07-25T17:03:31-05:00 0:12 9.620u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022024l.pfb; pointsize 12
2008-07-25T17:03:32-05:00 0:13 10.560u 6.4.1 Annotate PerlMagick[26371]: annotate.c/unknown/1789/Annotate
Font /usr/share/fonts/default/Type1/n022023l.pfb; pointsize 12
So, any ideas why the text annotation in each of the images never changes fonts?
Any help is greatly appreciated