[HarfBuzz] Patch for harfbuzz

John Tapsell johnflux at gmail.com
Wed Oct 26 01:13:36 PDT 2011


Hi guys,

  I have a font with GPOS kerning with position and advancement
adjustments for arabic.  This seems to be fairly rare as I cannot find
another font with GPOS kerning for a RTL language.

  Using Qt, I got the following result:
http://picpaste.com/pics/malcom_text_with_unmodified_qt-zkLg01BQ.1319616036.png

  The below patch fixes the adjustment problems, making it look like:
http://picpaste.com/pics/malcom_text_with_modified_qt-kItcU2Cx.1319616047.png

diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index 1021b02..9a80558 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -1264,7 +1264,7 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item,
int availableGlyphs, HB_Bool do
 //                    (int)(positions[i].x_pos >> 6),
(int)(positions[i].y_pos >> 6),
 //                    positions[i].back, positions[i].new_advance);

-            HB_Fixed adjustment = (item->item.bidiLevel % 2) ?
-positions[i].x_advance : positions[i].x_advance;
+            HB_Fixed adjustment = positions[i].x_advance;

             if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics))
                 adjustment = HB_FIXED_ROUND(adjustment);





This changes also makes the code more similar to what pango does, in
pango-ot-buffer.c

      adjustment = PANGO_UNITS_26_6(positions[i_rev].x_advance);

      if (is_hinted)
            adjustment = PANGO_UNITS_ROUND (adjustment);
      if (G_UNLIKELY (scale))
             adjustment *= xscale;

      if (positions[i_rev].new_advance)
            glyphs->glyphs[i].geometry.width  = adjustment;
      else
            glyphs->glyphs[i].geometry.width += adjustment;



More information about the HarfBuzz mailing list