Apache OpenOffice (AOO) Bugzilla – Issue 89286
RTL characters (Hebrew) kerning broken
Last modified: 2016-04-09 11:03:10 UTC
The kerning of RTL text is broken. Kern pairs are not applied as appropriate but rather misattributed to next glyph space, causing rather unpleasant display. Hdu, I assigned the bug to you, but this is just a wild guess, since you've been dealing with other font issues I encountered. The problem probably lays somewhere around X11FontLayout::LayoutText() in gsl/vcl/unx/source/gdi/xfont.cxx, but this is just another wild guess.
Created attachment 53531 [details] FontForge shows proper kerning, same as in MS Word for Windows.
Created attachment 53532 [details] OpenOffice screenshot shows wrong kerning
Created attachment 53533 [details] TrueType font used to reproduce the bug
Created attachment 53534 [details] Document file which reproduces the bug
Please also note that the kerning is applied (and applied wrong) regardless of the setting of "Pair Kerning" checkbox in "Format->Character->Position" The attached font has special circular forms in its "aleph" and "beth" glyphs to simplify verification. With a proper kerning, the two forms shall blend to create a circle, like in the FontForge screenshot. Please note that in OOo the -100 kerning space between the Hebrew letters "aleph" and "beth" is misattributed to the next pair "bet"+"gimel", making them nearly collide. The proper distance between "beth" and "gimel" is shown in the next line. Thank you!
Reproduced on Fedora 9 OO.o 2.4. A pango-using app such as gedit is fine. Once again OO.o suffers from not using the system text/font infrastructure.
i confirm this bug on OOo 2.4.0 (debin sid)
Created attachment 76724 [details] Patch against DEV300 This seems to fix the kerning in Comlpex Text Layout. Rationale: Latin text is processed in ServerFontLayoutEngine::operator(), and the kerning is addressed in gcach_layout.cxx:136 by adjusting mnNewWidth. CTL text (e.g. Hebrew) is processed in IcuLayoutEngine::operator(), and mnNewWidth is not adjusted at all (see also TODO comment in gcach_layout.cxx:550). I'm using glyph positions provided by ICU to adjust mnNewWidth. Please kindly review this patch.
The issue seems to affect all languages using CTL. While I tested the patch for Hebrew, it would probably be useful to test kerning in a left-to-right script too.
Comment on attachment 76724 [details] Patch against DEV300 Very good, thanks!
@iorsh: once the repository at http://incubator.apache.org/openofficeorg/ becomes available the patch should be applied (is the patch licensed under the ASL2 license?). It should be no problem for you to become a committer, but if you prefer I could commit it too. Due to the use of a VCS that doesn't care about the difference between author and committer I'd prefer the former to preserve your authorship.
Certainly I license it under ASL2 license, I will commit it if you wish. I will check it a bit more to see it doesn't really break things.
Applied as http://svn.apache.org/viewvc?rev=1173604&view=rev When pressing the last key for the commit I noticed that the commit message lacked proper attribution to iorsh. The Ctrl-C then was too late. Sorry about the missing attribution in the commit comment.
Created attachment 76793 [details] EXtended patch by Khaled Hosny, ported from LibreOffice This patch supersedes mine - it is more complete and considers also diacritics. Khaled agreed to release it under ASL2 in private communication and asked me to submit.
Created attachment 76794 [details] EXtended patch by Khaled Hosny, ported from LibreOffice Forgot review flag
Just to confirm: the patch was developed by Khaled so he is allowed to relicense it?
Yes, the last patch is by Khaled Hosny: see https://bugs.freedesktop.org/show_bug.cgi?id=31016 http://lists.freedesktop.org/archives/libreoffice/2011-January/005422.html
Applied, thanks again! BTW: becoming a committer into an Apache project is quite easy for people like you who provide high quality patches...
fixed in 3.4.x, latest in 4.0.0