Posted on 2009-06-12 05:10:22-07 by tonyc in response to 10952
Re: What turetype font can draw Greek letters (alpha, beta, lambda) on images?

Without seeing your code, it's hard to see. The DejaVuSansMono.ttf from Debian certainly supports greek:

#!perl -w use strict; use Imager; # no greek support in ImUgly.ttf #my $fontfile = "fontfiles/ImUgly.ttf"; my $fontfile = "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSansMono.ttf"; my $font = Imager::Font->new(file => $fontfile, aa => 1) or die "Cannot open font file $fontfile: ", Imager->errstr, "\n"; my $text = chr(0x3a3); # GREEK CAPITAL LETTER SIGMA my $im = Imager->new(xsize => 100, ysize => 50); $im->align_string ( x => 50, y => 25, halign => "center", valign => "center", font => $font, size => 40, color => '#FFF', string => $text ) or die $im->errstr; $im->write(file => "utf8text.ppm") or die "Cannot write utf8text.ppm:", $im->errstr, "\n";

You also don't say what results you get when you attempt to output greek text, I'd suspect an encoding issue if you're seeing apparently random text.

If you are seeing random text, it's possible you need to either mark the text as utf8, or tell Imager that the text is utf8, by supplying utf8 => 1 to the align_string() call.

I also did a test with use utf8; and setting $text to a literal sigma inline, this worked for me.

Direct Responses: 10956 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.