possible bug -direction IM 6.7.0.2 Q16

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -direction IM 6.7.0.2 Q16

Post by fmw42 »

IM 6.7.0.2 Q16 Mac OSX TIGER.

The following fails, assuming I understand what -direction right-to-left is supposed to do.

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:"ABCDEFG" tmp.png

The resulting image is only the letter A.


see also viewtopic.php?f=3&t=18868
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -direction IM 6.7.0.2 Q16

Post by magick »

We'll get a patch into ImageMagick 6.7.0-4 Beta by sometime tomorrow to fix the problem you reported.
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: possible bug -direction IM 6.7.0.2 Q16

Post by teebe »

magick:
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.

Thank you
Last edited by teebe on 2011-06-06T22:02:09-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Post by fmw42 »

IM 6.7.0.4 Mac OSX Tiger

The command

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:"ABCDEFG" A2G_reversed.png

Image

does indeed now reverse the characters, BUT they are not filled.

Likewise without the -direction, they are still not filled.

convert -background lightblue -fill blue -pointsize 48 -font Arial label:"ABCDEFG" A2G.png

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

Re: possible bug -direction IM 6.7.0.2 Q16

Post by teebe »

Hi, the output of convert.exe with -direction right-to-left shows double strokes (or advance skipping):
Image
as well a weird rendering.
It would be nice to get to the end, i could use IM for a new project.
Cheers
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -direction IM 6.7.0.2 Q16

Post by magick »

Try ImageMagick 6.7.0-5. It will be a day or two until we get updated versions of the Windows binaries for this release.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Post by fmw42 »

IM 6.7.0.5 Q16 Mac OSX Tiger.

This command seems to be working nearly correctly now, but the G seems a bit too close to the F. Is that the way it will be?

convert -background lightblue -fill blue -pointsize 48 -font Arial -direction right-to-left label:"ABCDEFG" A2G_reversed2.png

Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -direction IM 6.7.0.2 Q16

Post by magick »

We just write the characters from right to left and use the font metrics to decide where to place each character. A couple of solutions would be to 1) reverse the string and place the letters left to right; 2) use a proper text layout manager such as Pango; or 3) ImageMagick could reverse the string and then place the characters left to right.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Post by fmw42 »

magick wrote:We just write the characters from right to left and use the font metrics to decide where to place each character. A couple of solutions would be to 1) reverse the string and place the letters left to right; 2) use a proper text layout manager such as Pango; or 3) ImageMagick could reverse the string and then place the characters left to right.
For me this was only a simple test case to help you and that other person with the arabic characters. So if it works out for the arabic characters, then I am not overly concerned. If I had to do it for English from your suggestions, I would probably try your option 3)

Thanks.

Fred
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -direction IM 6.7.0.2 Q16

Post by magick »

The advance metric is determined by looking at two side-by-side characters. For right-to-left we need to look at the next character rather than the last. We'll add a patch to ImageMagick within a day or two.
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: possible bug -direction IM 6.7.0.2 Q16

Post by teebe »

IM 6.7.0-5 makes better rendering but -direction right-to-left is always broke.
Screen shots and process output:
1 - Screen grab of original strings (OUTLOOK MAIL):
Image
2 - IM 6.7.0-5 No RTL, no pre-invertion:
Image
3 - IM 6.7.0-5 with -direction RTL:
Image
4 - IM 6.7.0-5 No RTL but pre-inverted by friend code:
Image
Images 1 & 2 does not need any explanation, image 3 is RTL as made by IM; here i notice a wrong interpretation of glyph ligatures. Image 4 is almost prefect (if string is single line), but is pre-processed in alien application and no RTL is applied by IM.

Just for your possible curiosity, the ARABIC UNICODE string reverser that works can be found at: http://omar84.com/, Arabic Writer.
Interesting, it has full code exposed in its html.

Update: as bidirectional text is a complex subject and here is only Arabic, one of choice, I think reversing string is just a shortcoming effect to render correctly. Do there is any plan to include i18n library into IM? May be Pango...


Thanks all for your efforts.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug -direction IM 6.7.0.2 Q16

Post by anthony »

The real problem with the dashes being placed on the wrong side is that the font switches direction.

I doubt IM could handle such change of direction, as it has no understanding that certian unicodes are performed in the oppiste direction. This is the job of a text processing package such as Pango, Not an Image processing package.


Prehaps an optional 'delegate' can be defined to call pango as a new type of text to image handling.
Something like pango:"text that may have some RTL text in it"

This way IM can make use of pango if available, but does not require it installed (not available in windows for example) to work for everything else. Just as it does for Postscript, and PDF file handling.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: possible bug -direction IM 6.7.0.2 Q16

Post by teebe »

I found Pango library interesting but as all open source project difficult to implement (at least for me).
Interesting, I found another viewer (very popular and free) doing what i was expecting, that is RTL text overlays, at some costs in regard quality of anti-aliasing and easy of use (no arguments, mangling .ini instead).
I make my best wishes to all people that help in finding the solution.
Cheers.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug -direction IM 6.7.0.2 Q16

Post by anthony »

Would you like to share the name of that utility?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
teebe
Posts: 20
Joined: 2011-04-30T04:34:28-07:00
Authentication code: 8675308

Re: possible bug -direction IM 6.7.0.2 Q16

Post by teebe »

Yes irfanview.
Post Reply