[Libreoffice] Horizontal glyph adjustments are ignored with ICU layout

Khaled Hosny khaledhosny at eglug.org
Wed Jan 5 05:54:17 PST 2011


Hi every one,

This my first message to the list, hopping it will be a fruitful
experience :)

I was trying to debug fdo#31016[1] since it breaks almost all my fonts,
it toke me few months but I think I finally got the root of it (I
started working on it few weeks before libreoffice was announced, what a
nice code base ;).

Anyway, it turned out that the issue is not specific to kerning nor
Arabic, but affects all horizontal glyph positioning in the ICU layout
path; the problem does not show on Windows nor with Graphite fonts and
of course not with con-CTL.

The X adjustment of glyph widths is simply ignored, and glyphs are drawn
stacked after each other baased on their original width, which results in
kerning being ignored as well as other forms of glyph positioning like
cursive anchors, however vertical glyph positions (in the Y access) are
OK.

In source/glyphs/gcach_layout.cxx, ICU's layoutChars() is called and new
glyph indices and positions are returned, which is then fed into
SalLayout in the form of GlyphItem's. Though GlyphItem has maLinearPos
which holds its absolute position, many places in the code re-calculate
glyph position from its mnOrigWidth (original glyph width) and mnNewWidth
(width after adjustments), but the ICU path simply sets mnNewWidth to
mnOrigWidth since ICU layout engine does not return individual glyph
widths, resulting in failure of glyph position re-calculation which
manifests in this bug.

As a prove of concept, the attached patch trays to set mnNewWidth in a
very hackish way by subtracting current glyph position from the of next
non-diacritic (+ve) glyph. It does indeed fix the problem (see the
attached screenshots), but it looks very unreliable to me. May be a
cleaner solution is to re-implement all the broken virtual methods to
eliminate the re-calculation part.

Hope this helps, and sorry for the broken terminology as I'm not really
a developer and less of C++ one (I can only do much of C++ that looks
like C, which I don't really "speak" either).

[1] https://bugs.freedesktop.org/show_bug.cgi?id=31016

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcach_layout.diff
Type: text/x-diff
Size: 2616 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110105/2b0bbd4e/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: before.png
Type: image/png
Size: 6011 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110105/2b0bbd4e/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: after.png
Type: image/png
Size: 3185 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110105/2b0bbd4e/attachment-0003.png>


More information about the LibreOffice mailing list