in reply to Can't get Imager::Font to work

Try installing Freetype2 and then rebuild Imager.

When I run the truetype capability check (shown above), I get

Has t1 postscript Has Freetype2
and the following script works fine for me, if I have Generic.ttf in the script directory.
#!/usr/bin/perl use warnings; use strict; use Imager; my $img = Imager->new(xsize=>400,ysize=>50,channels=>4); my $blue = Imager::Color->new("#0000FF"); my $font = Imager::Font->new( file => 'Generic.ttf', color => $blue, size => 30); $img->string(font => $font, text => "Model-XYZ", x => 15, y => 40, size => 40, color => $blue, aa => 1); $img->write(file=>$0.'.png', type=>'png') or die "Cannot write: ",$img->errstr; my $img_mirror = $img->copy(); $img_mirror->flip( dir => "h" ); $img_mirror->write(file=>$0.'-mirror.png', type=>'png') or die "Cannot write: ",$img_mirror->errstr;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: Can't get Imager::Font to work
by boboson (Monk) on Dec 25, 2006 at 20:10 UTC
    Yep, that's probably it. Thanks for all your help!