Imager::DTP::Letter is a letter handling module for Imager::DTP package.
SYNOPSIS
use Imager::DTP::Letter;
# first, define font & letter string
my $font = Imager::Font->new(file=>'path/to/foo.ttf',type=>'ft2',
size=>16,color=>'#000000',aa=>1);
my $text = 'A';
# create instance - basic way
my $ltr = Imager::DTP::Letter->new();
$ltr->setText(text=>$text); # set text
$ltr->setFont(font=>$font); # set font
$ltr->setScale(x=>1.2,y=>0.5); # set transform scale (optional)
# create instance - or the shorcut way
my $ltr = Imager::DTP::Letter->new(text=>$text,font=>$font,
xscale=>1.2,yscale=>0.5);
# draw letter on target image
my $target = Imager->new(xsize=>50,ysize=>50);
$target->box(filled=>1,color=>'#FFFFFF'); # with white background
$ltr->draw(target=>$target,x=>10,y=>10);
# and write out image to file
$target->write(file=>'result.jpg',type=>'jpeg');
Imager::DTP::Letter is a module intended for handling each letter/character in a whole text string (sentence or paragraph). Each Imager::DTP::Letter instance will hold one letter/character internally, and it holds various information about the letter/character, most of it aquired from Imager::Font->bounding_box() method. Thus, Imager::DTP::Letter is intended to act as a single letter with font information (such as ascent/descent) bundled together. It is allowed to set more than one letter/character to a single Imager::DTP::Letter instance, but still, the whole Imager::DTP package will handle the instance as 'single letter'.
Product's homepage
Requirements:
· Perl