Page 1 of 1

Pango rtl direction

Posted: 2017-07-18T02:03:05-07:00
by hafez
How can I set pango direction to right-to-left (rtl)?

According to pango-view manual, pango has -rtl option but there is not any pango:rtl in pango's list of defines.

I'm using imagemagick 6.8.9 with pango in PHP 7.0 on Ubuntu 16.04, and I want to turn off auto-dir and set direction manually like this:

Code: Select all

$img = new Imagick();

$img->setOption("pango:auto-dir", false);
$img->setOption("pango:rtl", true);

$img->newPseudoImage(0, 0, "pango:<span font_desc='Arial 12'>Hello World!</span>");
$img->setImageFormat('png');
But it doesn't work, can anyone help?

Re: Pango rtl direction

Posted: 2017-07-18T08:57:35-07:00
by snibgo
See pango.c. The pango base direction is set from the ImageInfo structure "direction", which at the command line is set by "-direction right-to-left".

But I'm not sure what RTL does, or what you want it to do. I don't suppose it should reverse the order of characters.

Re: Pango rtl direction

Posted: 2017-07-18T09:23:55-07:00
by hafez
snibgo wrote: 2017-07-18T08:57:35-07:00 See pango.c. The pango base direction is set from the ImageInfo structure "direction", which at the command line is set by "-direction right-to-left".

But I'm not sure what RTL does, or what you want it to do. I don't suppose it should reverse the order of characters.
How can I set -direction right-to-left in imagick php? I couldn't find any direction related method in imagick php documents

Beside that, I also tried command line

Code: Select all

convert -direction right-to-left -define pango:auto-dir=false pango:"<span font_desc='vazircode 12'>هویج*\nCarrot*\n----------------</span>" label.gif
Image

But pango's auto-direction didn't turn off and direction didn't set to RTL (Pango set Persian text direction to RTL automatically and English text direction to LTR automatically But I want whole text to be RTL).