[HarfBuzz] harfbuzz: Branch 'master'

Simon Hausmann hausmann at kemper.freedesktop.org
Wed Apr 4 12:06:39 PDT 2007


 src/harfbuzz-global.h   |    1 +
 src/harfbuzz-shaper.cpp |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
diff-tree 36c1152a66a6c75057d66925c41cfa85701d969b (from 4005078e67082b5178a0aee0ba48fa1d6c893db2)
Author: Simon Hausmann <simon at luria.(none)>
Date:   Wed Apr 4 21:06:41 2007 +0200

    Apply the same fix as in the Qt 4.3 branch: The return values from the OpenType
    layer for the advances have a fraction. Unless design metrics are requested
    these need to be rounded in order to give consistent positioning (for example
    kerning).  For example "TeTeTeTeTe" otherwise has different/inconsistent
    kerning for "Te" that is especially for small sizes very visible.
    
    Discussed with Lars.

diff --git a/src/harfbuzz-global.h b/src/harfbuzz-global.h
index 9302a67..0bd01c9 100644
--- a/src/harfbuzz-global.h
+++ b/src/harfbuzz-global.h
@@ -46,6 +46,7 @@ typedef hb_uint32 HB_Glyph;
 typedef hb_int32 HB_Fixed; /* 26.6 */
 
 #define HB_FIXED_CONSTANT(v) ((v) * 64)
+#define HB_FIXED_ROUND(v) (((v)+32) & -64)
 
 typedef hb_int32 HB_16Dot16; /* 16.16 */
 
diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index 296d813..83e9af7 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -1069,11 +1069,16 @@ HB_Bool HB_OpenTypePosition(HB_ShaperIte
 //                    (int)(positions[i].x_advance >> 6), (int)(positions[i].y_advance >> 6),
 //                    (int)(positions[i].x_pos >> 6), (int)(positions[i].y_pos >> 6),
 //                    positions[i].back, positions[i].new_advance);
-            // ###### fix the case where we have y advances. How do we handle this in Uniscribe?????
+
+            HB_Fixed adjustment = (item->item.bidiLevel % 2) ? -positions[i].x_advance : positions[i].x_advance;
+
+            if (!(face->current_flags & HB_ShaperFlag_UseDesignMetrics))
+                adjustment = HB_FIXED_ROUND(adjustment);
+
             if (positions[i].new_advance) {
-                advances[i] = item->item.bidiLevel % 2 ? -positions[i].x_advance : positions[i].x_advance;
+                advances[i] = adjustment;
             } else {
-                advances[i] += item->item.bidiLevel % 2 ? -positions[i].x_advance : positions[i].x_advance;
+                advances[i] += adjustment;
             }
 
             int back = 0;



More information about the HarfBuzz mailing list