OTRS, GD Library and Persian Support

OTRS can generate graphic as output of its reports. For example someone could generate a bar chart from Queues. Ok, but what’s wrong about this? My problem with this is Persian (Farsi) text in the image, for example name of queues are showed incorrectly. Consider following pic. that is a part of Bar-Chart report with 4 text phrase, 1 English (tmp_lock) and 3 others in Persian.

Consider bar names

Persian words are rendered in a wrong way. Those 2 text below the charts are Persian words "تحویل گرفته شده" and "آزاد". They are incorrectly rendered as some European characters with accents above.

I posted the issue in OTRS mailing lists here and here, but no one could solve this. Some folks suggested to use my fonts instead of OTRS default fonts but I didn’t find how to this.

After this unsuccessful tries I decided to trace the OTRS directly to see where the graphics are generated. I examined stats.pm and $graph->set_legend(@YLine); and realized that the root cause may be GD.pm not OTRS. So I tried to generate a sample graphic with GD.pm directly but Persian text was not displayed correctly yet.

I found GD Library (underlying library of GD.pm) is graphic engine of PHP too so tried to find someone that has any experiences with this. The results was a blog post by Robert Robbins and an online graphic generator based on GD Library. But no one could help me.

Additionally there is a related project on PHP, GD Library and Persian problem introduce here and here by Omid Mottaghi, a good book named "Perl Graphics Programming" and a nice .Net open source project named "GD Sharp" that is really an interface to GD Library. I tried all of these but no hope yet!

Note:

  1. My friend Masoud has reported this bug to GD project and they say it is known issue and it is not going to be resolved. Instead RTL support will be supported in GD-Pango. Is it possible that OTRS use gd-pango instead of gd to resolve such problems?
  2. I’ve discussed this problem in Persian Computing group too. They suggest to utilize FriBiDi.
  3. A friend suggested to use Imagick. It may solve Persian problem.

Does anybody could help me getting rid of this nightmare please?