I used Pango with Perl and It succeed rendering a right to left text perfectly (This mission is a nightmare ):
The code :
#!/usr/bin/perl -wT
use strict;
use warnings;
use Pango;
use Encode;
my $surface = Cairo::ImageSurface->create('argb32', 400, 100);
my $cr = Cairo::Context->create($surface);
my $layout = Pango::Cairo::create_layout($cr);
my $text = decode('utf8','测试');
$layout->set_text("$text");
my $font = Pango::FontDescription->from_string ('Serif Bold 50');
$layout->set_font_description($font);
Pango::Cairo::show_layout($cr, $layout);
$surface->write_to_png('pango.png');
However, the only problem I had was within the text alignment. I have no idea how I centralize the text. I read Pango documents, but I didn't find much information. Does anyone know how to do it?