[HarfBuzz] arabic positioning without gpos

Evan Martin evan at chromium.org
Thu Jan 14 11:53:56 PST 2010


I'm trying to track down a Chromium bug related to Harfbuzz.

The bug is that when you are shaping text such that:
- the font has no gpos table (like times new roman)
- the text requires no glyph substitution (like a combination of
isolated letters and vowels), e.g. هً

Then the vowels get non-zero advances causing the text to be spaced out.

The code in HB_OpenTypePosition looks like this:

    bool glyphs_positioned = false;
    if (face->gpos) {
        glyphs_positioned = HB_GPOS_Apply_String(...) != HB_Err_Not_Covered;

    if (!face->glyphs_substituted && !glyphs_positioned) {
        return true; // nothing to do for us

In the above-described conditions, we hit the body of the latter if
and call HB_GetGlyphAdvances(), so the vowels get advances based on
the width of the glyph.  If you have text which causes any glyph
substitution (like any non-isolated Arabic letters), then
face->glyphs_substituted is true and we fall through to the remainder
of the function.  I verified that if I force the condition to be false
(falling through to the code afterwards), the positioning works out

This code obviously works for the other users of Harfbuzz, so I must
be missing something in my understanding.  (Maybe the glyph advances
for Arabic vowels should always be zero?  Maybe I must have a gpos
table for this to work?  Maybe I'm tracing into the wrong code?)
Any suggestions as to what that is are welcome.

More information about the HarfBuzz mailing list