Pango rtl direction

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
hafez
Posts: 2
Joined: 2017-07-18T01:35:39-07:00
Authentication code: 1151

Pango rtl direction

Post 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?
Last edited by hafez on 2017-07-19T01:53:29-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Pango rtl direction

Post 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.
snibgo's IM pages: im.snibgo.com
hafez
Posts: 2
Joined: 2017-07-18T01:35:39-07:00
Authentication code: 1151

Re: Pango rtl direction

Post 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).
Post Reply