| psyshrike 2004-05-12, 7:21 pm |
| Howdy,
Not sure what email address to send this to, so I'll post it here.
If somebody could add this or something like it to the
PDF::API2::Text::font function in the PDF::API2 Distro it would be
usefull to many IMHO.
All I added was the hail mary to get the font size.
Basically:
$txt->font($small, 20) ;
Can be stated as:
$txt->font($small) ;
if the font contained in $small already knows what size it is. This
makes managing your fonts a little cleaner.
The replacement function:
##########################
sub font {
my ($self,$font,$size)=@_;
if (! defined $size &&
! ref($font->{"PDFAPIOptions"}->{"val"}) &&
$font->{"PDFAPIOptions"}->{"val"} =~ /[0-9]+/) {
$size = $font->{"PDFAPIOptions"}->{"val"} ;
}
$self->{' font'}=$font ;
$self->{' fontsize'}=$size;
$self->add("/".$font->{' apiname'},float($size),'Tf');
$self->resource('Font',$font->{' apiname'},$font);
return($self);
}
-Thanks!
-Matt
|