First, you'll need some true type library like Freetype or T1lib properly installed and Imager compiled to use it.
You can check what libraries you've got using this snippet (from Image::Font's POD)
use Imager;
print "Has truetype" if $Imager::formats{tt};
print "Has t1 postscript" if $Imager::formats{t1};
print "Has Win32 fonts" if $Imager::formats{w32};
print "Has Freetype2" if $Imager::formats{ft2};
And than, do something like
#!/usr/bin/perl -w
use strict;
use Imager;
use Imager::Font;
use Imager::Color;
my $font_file='path/to/font.ttf';
my $text="Foo Bar!";
# create image
my $img=Imager->new(xsize=>200,ysize=>50);
# set colors
my $white=Imager::Color->new("#ffffff");
my $black=Imager::Color->new("#000000");
# change background to white
$img->box(color=>$white,filled=>1);
# create font object
my $ttfont=Imager::Font->new
(
type=>'ft2',
file=>$font_file,
color=>$black,
size=>16,
);
# draw text
$img->string(font=>$ttfont,text=>$text,
x=>5,y=>22,aa=>1);
# write file
$img->write(file=>"image.png") or die
"Cannot write $imgfn: ", $img->errstr;
Hope this helps!
--
#!/usr/bin/perl
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}