Imagine and GD with RTL text

Hi,

I am using Imagine and GD library. I can add text watermarks to my image, however the text must be a Left To Right language. How can I use RTL languages such as Persian to add a watermark.

For example a text like سلام will be added like م ا ل س

You might want to ask in the respective libraries’ forums.

I have searched every where and done every suggestion but no help!

I was hoping someone here could help me through this

If you could put some RTL text on an image with GD, then you would be able to watermark another image with it using Imagine. Right?

Does GD support RTL drawing of a text in imagestring() or imagettftext()?

If not, you have to make some method to do it on your own.

I wonder if reversing the text beforehand can do the trick. I don’t know for sure. If it doesn’t, then you have to draw it letter by letter, changing the x coordinate one by one.

Thanks for your kind reply. I have searched A LOT, and all I found was custom functions to do so. However persian letters unlike Latin letters should be connected. For example in the word ‘Hello’ there is a space in between ‘H’ and ‘e’, in the same word in persian, which is ‘سلام’, the first letter ‘س’ is connected to ‘ل’. To do this we have to replace the letters with the correct connected symbol to do the trick. Using this approach when applying different fonts to our word, the letters that we replaced with their connected symbol are written in an ugly font. I was wondering if there was an extension or library to install and handle this using GD.

I see. Sounds very interesting but tedious. I’m very sorry, but have no good idea. :(