Non-ascii characters break Cairo's show_text



I can't get non-ascii characters to print on an image surface with Cairo. Furthermore, a show_text call with non-ascii character seems to break text rendering for subsequent ascii text also. I wonder what's the problem.

I've tried this both in Windows and Linux and with Cairo 1.041.

Otherwise all characters work ok in Gtk2, for example in the font selection dialog box.

Regards,

Ari

the test code:

use Cairo;

my $surf = Cairo::ImageSurface->create('argb32', 400, 400);
my $cr = Cairo::Context->create($surf);

$cr->rectangle (0, 0, 400, 400);
$cr->set_source_rgba (1, 1, 1, 1);
$cr->fill;

$cr->set_source_rgba(0, 0, 0, 1);
$cr->select_font_face('Times New Roman', 'normal', 'normal');
$cr->set_font_size(20);

$cr->move_to(100, 100);

print STDERR "1\n";
$cr->show_text("this shows");
print STDERR "2\n";

$cr->move_to(200, 200);

print STDERR "3\n";
$cr->show_text("but this not åäöÅÄÖ");
print STDERR "4\n";

$cr->move_to(300, 300);

print STDERR "5\n";
$cr->show_text("neither this");
print STDERR "6\n";

$surf->write_to_png("test.png");

--
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka / Geoinformation and positioning
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]