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.

possible bug -direction IM 6.7.0.2 Q16

Postby fmw42 » 2011-06-03T09:48:20+00:00

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
fmw42
 
Posts: 13859
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Postby magick » 2011-06-03T10:20:53+00:00

We'll get a patch into ImageMagick 6.7.0-4 Beta by sometime tomorrow to fix the problem you reported.
User avatar
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby teebe » 2011-06-05T06:06:36+00:00

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+00:00, edited 1 time in total.
teebe
 
Posts: 20
Joined: 2011-04-30T04:34:28+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby fmw42 » 2011-06-06T10:46:13+00:00

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
User avatar
fmw42
 
Posts: 13859
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Postby teebe » 2011-06-06T23:17:05+00:00

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

Re: possible bug -direction IM 6.7.0.2 Q16

Postby magick » 2011-06-07T10:30:27+00:00

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
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby fmw42 » 2011-06-07T12:25:40+00:00

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
fmw42
 
Posts: 13859
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Postby magick » 2011-06-07T18:46:42+00:00

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
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby fmw42 » 2011-06-07T18:51:53+00:00

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
fmw42
 
Posts: 13859
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: possible bug -direction IM 6.7.0.2 Q16

Postby magick » 2011-06-07T19:02:02+00:00

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.
User avatar
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby teebe » 2011-06-08T07:56:24+00:00

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.
teebe
 
Posts: 20
Joined: 2011-04-30T04:34:28+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby anthony » 2011-06-08T18:49:48+00:00

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
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8684
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: possible bug -direction IM 6.7.0.2 Q16

Postby teebe » 2011-06-11T14:59:55+00:00

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.
teebe
 
Posts: 20
Joined: 2011-04-30T04:34:28+00:00

Re: possible bug -direction IM 6.7.0.2 Q16

Postby anthony » 2011-06-12T03:14:16+00:00

Would you like to share the name of that utility?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8684
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: possible bug -direction IM 6.7.0.2 Q16

Postby teebe » 2011-06-12T03:40:07+00:00

Yes irfanview.
teebe
 
Posts: 20
Joined: 2011-04-30T04:34:28+00:00


Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests