Issue 89286 - RTL characters (Hebrew) kerning broken
Summary: RTL characters (Hebrew) kerning broken
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 2.3.1
Hardware: All Unix, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hdu@apache.org
QA Contact: issues@gsl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-10 21:42 UTC by iorsh
Modified: 2016-04-09 11:03 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
FontForge shows proper kerning, same as in MS Word for Windows. (18.31 KB, image/png)
2008-05-10 21:43 UTC, iorsh
no flags Details
OpenOffice screenshot shows wrong kerning (50.98 KB, image/png)
2008-05-10 21:44 UTC, iorsh
no flags Details
TrueType font used to reproduce the bug (22.62 KB, font/ttf)
2008-05-10 21:46 UTC, iorsh
no flags Details
Document file which reproduces the bug (19.50 KB, application/msword)
2008-05-10 21:48 UTC, iorsh
no flags Details
Patch against DEV300 (305 bytes, patch)
2011-07-24 19:18 UTC, iorsh
hdu: review+
Details | Diff
EXtended patch by Khaled Hosny, ported from LibreOffice (2.39 KB, patch)
2011-09-21 14:14 UTC, iorsh
no flags Details | Diff
EXtended patch by Khaled Hosny, ported from LibreOffice (2.39 KB, patch)
2011-09-21 14:19 UTC, iorsh
hdu: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description iorsh 2008-05-10 21:42:20 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.
Comment 1 iorsh 2008-05-10 21:43:41 UTC
Created attachment 53531 [details]
FontForge shows proper kerning, same as in MS Word for Windows.
Comment 2 iorsh 2008-05-10 21:44:26 UTC
Created attachment 53532 [details]
OpenOffice screenshot shows wrong kerning
Comment 3 iorsh 2008-05-10 21:46:49 UTC
Created attachment 53533 [details]
TrueType font used to reproduce the bug
Comment 4 iorsh 2008-05-10 21:48:15 UTC
Created attachment 53534 [details]
Document file which reproduces the bug
Comment 5 iorsh 2008-05-10 21:54:09 UTC
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!
Comment 6 nmailhot 2008-05-11 17:21:48 UTC
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.
Comment 7 nadavkav 2008-05-17 11:41:10 UTC
i confirm this bug on OOo 2.4.0 (debin sid)
Comment 8 iorsh 2011-07-24 19:18:06 UTC
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.
Comment 9 iorsh 2011-07-24 19:22:39 UTC
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 10 hdu@apache.org 2011-07-25 07:00:06 UTC
Comment on attachment 76724 [details]
Patch against DEV300

Very good, thanks!
Comment 11 hdu@apache.org 2011-07-25 07:14:39 UTC
@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.
Comment 12 iorsh 2011-07-26 21:37:52 UTC
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.
Comment 13 hdu@apache.org 2011-09-21 12:54:01 UTC
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.
Comment 14 iorsh 2011-09-21 14:14:45 UTC
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.
Comment 15 iorsh 2011-09-21 14:19:25 UTC
Created attachment 76794 [details]
EXtended patch by Khaled Hosny, ported from LibreOffice

Forgot review flag
Comment 16 hdu@apache.org 2011-09-21 14:56:53 UTC
Just to confirm: the patch was developed by Khaled so he is allowed to relicense it?
Comment 18 hdu@apache.org 2011-09-22 07:27:00 UTC
Applied, thanks again!
BTW: becoming a committer into an Apache project is quite easy for people like you who provide high quality patches...
Comment 19 Marcus 2016-04-09 11:03:10 UTC
fixed in 3.4.x, latest in 4.0.0