Thread

Posted on Wed Aug 9 11:52:26 2006 by leegee
Font Transformations
www.freetype.org/freetype2/index.html#features I'm not very clear on what FreeType is, but I get the impression from the freetype.org that it should be able to render TrueType fonts? Yet when I load Arial.ttf and specify it as a FreeType font and apply a transformation, it appears to act like a TTF: that is, it doesn't get transformed. Please help. If I need specific FreeType fonts, do you know where I can get a freebie sans-serif set...?! tia lee
Direct Responses: 2766 | Write a response
Posted on Wed Aug 9 13:18:52 2006 by tonyc in response to 2764
Re: Font Transformations
Yes, it can.

What's probably happened is you're using the FT 1.x driver, which doesn't support transformations, since that's the default for TTF fonts in Imager for historical reasons.

To use the freetype 2.x driver either supply type=>"ft2" to Imager::Font->new or call the priorities class method to make Freetype 2.x the first driver checked.

# either my $font = Imager::Font->new(file => "Arial.ttf", type => "ft2"); # or Imager::Font->priorities(qw/ft2 t1 tt/); my $font = Imager::Font->new(file => "Arial.ttf"); # and now tranform will work use Imager::Matrix2d ':handy'; $font->transform(matrix => m2d_rotate(degrees => 45)); $im->string(font => $font, string => "Slanted text", ...);
Write a response