Arabic fonts rendering

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
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Arabic fonts rendering

Post by teebe »

Hi,
I tried

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial label:@arabic.utf8   label_utf8.gif
but it does not render RTL, at least.
Do there is anything else to try?
Which can be the another application that makes it right?

Thank's
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arabic fonts rendering

Post by fmw42 »

teebe wrote:Hi,
I tried

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial label:@arabic.utf8   label_utf8.gif
but it does not render RTL, at least.
Do there is anything else to try?
Which can be the another application that makes it right?

Thank's

I am not an expert on fonts and such, but I am confused, since the Arial.ttf font is not going to have Arabic characters in it. Won't you need some font that contains Arabic characters. Perhaps you can explain a bit more.

First, what version of IM are you using and what platform?
Second, is the Arial font a ttf font?
Third, can you post a link to your arabic.utf8 file or give us a short example file so others can test with it?
Fourth, was the arabic.utf8 file created with a text editor that actually supports saving the file as utf8?
Fifth, have you tested with a normal text file that does not contain Arabic characters?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Arabic fonts rendering

Post by el_supremo »

If you're using a recent version of ImageMagick try this:

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:@arabic.utf8   label_utf8.gif
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arabic fonts rendering

Post by fmw42 »

el_supremo wrote:If you're using a recent version of ImageMagick try this:

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:@arabic.utf8   label_utf8.gif
Pete

Thanks Pete, I missed that issue. I was not sure what RTL meant. But now that you point that out, it makes sense. I believe you need IM 6.6.1-5 or higher for that option.

Fred
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by teebe »

True, it was not detailed:

Platform: WinXp Pro SP3

IM:

Code: Select all

convert -version
Version: ImageMagick 6.7.0-0 2011-05-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

Code: Select all

identify -list format | FIND /I "SVG"
     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (XML 2.4.19)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (XML 2.4.19)
Original:
Image
arabic.utf8

Code: Select all

زهرة وأزواجها الخمسة
cmd:

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial label:@arabic.utf8   label_utf8.gif
IM render
Image

code with LTR:

Code: Select all

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:@arabic.utf8   label2_utf8.gif
IM render with LTR:
Image
albarq
Posts: 3
Joined: 2011-06-02T03:45:12-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by albarq »

i have same exact problem, i tried to save the text in .svg format and converted through IM but i faild.

any one can help?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Arabic fonts rendering

Post by el_supremo »

I agree that it doesn't work (with 6.6.8-6). It prints the whole string when doing LTR but when using "-direction right-to-left" it only prints the first character.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arabic fonts rendering

Post by fmw42 »

I get the same one character result with -direction right-to-left using IM 6.7.0.2 Q16 Mac OSX Tiger.

I believe user teebe should post a bug report and link to this topic.
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by teebe »

fmw42: i will do.
So, apparently the RTL option really starts from last character but stops on cr/lf. I have very little knowledge of RTL languages made by o.s. manufacturers, one weird thing i noticed is that cr/lf (or cr alone) is always on right hand side of text (comparing different word processors, editors etc etc.) While, i.e, in my work environment the character generators really invert the position of cr/lf (on left hand side in case of RTL), so for example is not possible to mix RTL and LTR languages in composition with text scroll, unless interleaved by their appropriate end of line symbol.

However: if anybody knows which stand alone RTL render has the same output of firefox (it works!) i will be very very happy.

Thanks to all.
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by teebe »

Update (for Arabic RTL):
Using arabic writer.exe http://sourceforge.net/projects/arabicwriter/ the glyphs are properly aligned AFTER convert.exe
This should confirm the IM -direction right-to-left bug, as inverting with external application goes through well.
UTF-8 source label:

Code: Select all

    true:
    زهرة وأزواجها الخمسة

    after arabic writer:
    ﺔﺴﻤﺨﻟﺍ ﺎﻬﺟﺍﻭﺯﺃﻭ ﺓﺮﻫﺯ

convert.exe results:
Image
I am not sure, but It looks like UTF-8 does not carry the information of typing direction.

Cheers
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Arabic fonts rendering

Post by fmw42 »

see my bug report at viewtopic.php?f=3&t=18872
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by teebe »

Hi,
tested v6.7.0-4 but results are not good, besides direction is correct. I use Microsoft Visual Studio 2008 Version 9.0.30729.1, it compiles with no errors or warnings but i have a broken convert.exe output, both in terms of render and characters, as (in arabic) it superimposes some.
Any suggestion?
Thnaks
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: Arabic fonts rendering

Post by teebe »

As last report, I found (omiss..) rendering LTR and RTL text smooth as desired. Was a surprise of course, maybe quality can be better and usage through .ini file is not friendly, but it works.

Again, thanks all for efforts in following my question
Post Reply