Page 2 of 3
Re: Right-to-left languages?
Posted: 2010-03-27T13:14:43-07:00
by IDtheTarget
I don't know how it's auto-detected, all I know is that it's quite often that you'll have a mixture of RTL and LTR text in the same string. For instance, in Arabic and Dari, the text is RTL, but the numbers are LTR.
Re: Right-to-left languages?
Posted: 2010-03-28T09:16:06-07:00
by magick
The new option is -direction. It will be ready to test in ImageMagick 6.6.1-0 within a day or two:
- convert -background white -fill black -size 320x320 -encoding Unicode -font AlHor -gravity center \
-direction right-to-left -pointsize 40 label:'ﺱﻼﻣ' test01.png
Re: Right-to-left languages?
Posted: 2010-03-28T17:00:16-07:00
by anthony
The font itself should define if the characters are right-to-left according to the how it moves the caret!
The current idea of using -direction would be useless for a sting like... "Hello ﺱﻼﻣ world"...
It seems to me the font rendering library should be handling this, not IM.
One idea as a stop gap measure is to reverse the UTF characters in the string.
Code: Select all
echo -n 'ﺱﻼﻣ' | perl -CIO -pe '$_ = reverse $_;' | convert -font Arial -pointsize 24 label:@- show:
Hey it works!!! Though again it does not handle the mixed direction case.
Re: Right-to-left languages?
Posted: 2010-03-29T06:01:16-07:00
by IDtheTarget
I don't know if the font should handle it itself or not. I just know that other programs like Inkscape work.
I tried your reverse one-liner, and while it gets the letters in the correct order, the 'seh' and 'lam-alif' are not connected...
Thanks for the patch, guys!
Re: Right-to-left languages?
Posted: 2010-03-29T19:08:23-07:00
by anthony
Don't expect it to remain forever. Cristy is looking for some way of determining the direction of 'words'. However it seems that things like inkscape uses the 'Pango' library to layout words appropriately, and using a layout library is a dependancy that is getting beyond the scope of what IM
does. Remember it is really a raster (array of pixels) image processor, not a layout and text processor.
Now their are also other alternatives. for example using postscript of as we saw above SVG for the handling of more complex layout handling. these use an external delegate library to do the task producing a raster image for IM to continue its processing with.
Re: Right-to-left languages?
Posted: 2010-04-21T02:27:13-07:00
by Keld_von_Eyben
The new option -direction is extremely interesting as we use IM to generate open captions/subtitles for film production (we routinely subtitle in Chinese, Japanese and all European languages)
The script below works fine - but IM seems to ignore the -direction option when texts are rendered using -annotate or -draw text.
Should the -direction option work in connection with the
-annotate command?
And should the -direction option work with the
-draw text command?
Please confirm this - and thank you again for a great concept!
Best regards
Keld
http://www.filmsolutions.dk
magick wrote:The new option is -direction. It will be ready to test in ImageMagick 6.6.1-0 within a day or two:
- convert -background white -fill black -size 320x320 -encoding Unicode -font AlHor -gravity center \
-direction right-to-left -pointsize 40 label:'ﺱﻼﻣ' test01.png
Re: Right-to-left languages?
Posted: 2010-04-21T05:29:10-07:00
by magick
The -direction option should apply to -annotate and -draw options. We'll need a few days to investigate the problem and we will report back here.
Re: Right-to-left languages?
Posted: 2010-04-21T06:24:55-07:00
by Keld_von_Eyben
Great! Thank you!
Maybe I should add that I am using MS Access database running VisualBasic to access IM through its COM interface on Windows XP platform.
Keld
Re: Right-to-left languages?
Posted: 2010-04-21T18:48:11-07:00
by magick
We have a patch so that the -direction option works with the -annotate and -draw options. Look for it in ImageMagick 6.6.1-5 Beta available by sometime tomorrow.
Re: Right-to-left languages?
Posted: 2010-04-22T01:34:41-07:00
by Keld_von_Eyben
Fantastic!
Best regards
Keld
Re: Right-to-left languages?
Posted: 2010-05-15T08:37:24-07:00
by Keld_von_Eyben
I'm trying to implement the new -direction in IM 6.6.1-6 2010-04-23 Q16
Are you sure it will work when using
?
Using UTF8 textfiles is the only way I can send Arabic text to IM in a Windows environment.
Thank you for your support!
Re: Right-to-left languages?
Posted: 2012-04-11T04:38:31-07:00
by myicq
This is an old topic, but could not find anyone that discussed it since.
My need is to take a text file and line-by-line create a graphic 300px high with that line.
ImageMagick is perfect for the job, except it still does not handle unicode correct.
I have ImageMagick 6.7.6-5 4.4.2012
Input file tried both UTF8, UTF16 with /without BOM. Same result: when mixing left to right (English) with right to left (Hebrew / Arab..), the RTL is written backwards (as in left-to-right).
InkScape does the conversion as expected, but I would prefer to use IM as I can script this in a more convenient way, and less disc space is needed.
As an example, I have used the text:
Hello, ישראל out there (إسرائيل)
As you can see, the -direction is no good since it simply reverses everything.
Example of InkScape file which works:
Code: Select all
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="3500px" height="300px" viewBox="0 0 3500 300"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example text01</desc>
<text x="20" y="240"
font-family="Arial" font-size="250" fill="black" >
Hello, ישראל out there (إسرائيل)
</text>
</svg>
Thanks for any input on this topic.
Re: Right-to-left languages?
Posted: 2012-04-11T20:20:17-07:00
by anthony
The new "
pango:" coder supports right to left text handling -- automatically.
Code: Select all
convert -pointsize 36 pango:"Hello, ישראל out there (إسرائيل)" show:
I confirmed that it reverses the sequence of characters, compared to that of
label: (without a
-direction setting).
See IM Examples, Pango Text Formatting
http://www.imagemagick.org/Usage/text/#pango
NOTE pango also automatically does font changes as need to allow bold, and italic text, when the pango markup requests it.
ASIDE: pango with the latest IM is part of the latest updates in CYGWin for windows users.
Re: Right-to-left languages?
Posted: 2012-04-14T02:06:31-07:00
by myicq
The new "pango:" coder supports right to left text handling -- automatically.
This is very interesting !
Is there any information available (examples, how-tos, tutorials) anywhere about using pango with Perl + Windows ? Or other scripting languages under Windows ?
Unfortunately, for other reasons, I need to have the output from IM / Pango in a Windows platform
Any help appreciated.
Thanks
Re: Right-to-left languages?
Posted: 2012-04-14T05:57:03-07:00
by anthony
I am not a windows user, but it was reported that it is in the latest Cygwin Command line package (which provides UNIX shells under windows environment)