[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Nov 23 16:11:04 UTC 2018


 src/hb-aat-layout-kerx-table.hh |   15 +++++++++++++++
 src/hb-ot-kern-table.hh         |    9 +++++++++
 src/hb-ot-layout.cc             |    6 ++++++
 src/hb-ot-layout.hh             |    3 +++
 src/hb-ot-shape.cc              |    4 +++-
 5 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 748962264a9f098b32b9cb3fe4d18c786907a184
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Nov 23 11:10:17 2018 -0500

    [aat] Disable mark advance zeroing if kern table has state-machines
    
    Geeza Pro for example, relies on that for fancy mark positioning.
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/1405

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index bb88d9d1..74fecbb1 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -843,6 +843,21 @@ struct KerxTable
   /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
   inline const T* thiz (void) const { return static_cast<const T *> (this); }
 
+  inline bool has_state_machine (void) const
+  {
+    typedef typename T::SubTable SubTable;
+
+    const SubTable *st = &thiz()->firstSubTable;
+    unsigned int count = thiz()->tableCount;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      if (st->get_type () == 1)
+        return true;
+      st = &StructAfter<SubTable> (*st);
+    }
+    return false;
+  }
+
   inline bool has_cross_stream (void) const
   {
     typedef typename T::SubTable SubTable;
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index b2d57140..b57ebaea 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -274,6 +274,15 @@ struct kern
   inline bool has_data (void) const { return u.version32; }
   inline unsigned int get_type (void) const { return u.major; }
 
+  inline bool has_state_machine (void) const
+  {
+    switch (get_type ()) {
+    case 0: return u.ot.has_state_machine ();
+    case 1: return u.aat.has_state_machine ();
+    default:return false;
+    }
+  }
+
   inline bool has_cross_stream (void) const
   {
     switch (get_type ()) {
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 092633c5..9488fe82 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -66,6 +66,12 @@ hb_ot_layout_has_kerning (hb_face_t *face)
 }
 
 bool
+hb_ot_layout_has_machine_kerning (hb_face_t *face)
+{
+  return face->table.kern->has_state_machine ();
+}
+
+bool
 hb_ot_layout_has_cross_kerning (hb_face_t *face)
 {
   return face->table.kern->has_cross_stream ();
diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index db85508d..a00b940b 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -49,6 +49,9 @@ HB_INTERNAL bool
 hb_ot_layout_has_kerning (hb_face_t *face);
 
 HB_INTERNAL bool
+hb_ot_layout_has_machine_kerning (hb_face_t *face);
+
+HB_INTERNAL bool
 hb_ot_layout_has_cross_kerning (hb_face_t *face);
 
 HB_INTERNAL void
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 8d844807..ef974357 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -146,7 +146,9 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
       plan.apply_kern = true;
   }
 
-  plan.zero_marks = script_zero_marks && !plan.apply_kerx;
+  plan.zero_marks = script_zero_marks &&
+		    !plan.apply_kerx &&
+		    (!plan.apply_kern || !hb_ot_layout_has_machine_kerning (face));
   plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k'));
 
   plan.adjust_mark_positioning_when_zeroing = !plan.apply_gpos &&


More information about the HarfBuzz mailing list