[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Oct 20 22:06:31 UTC 2018


 src/hb-aat-layout-kerx-table.hh |   44 +++++++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 14 deletions(-)

New commits:
commit b713c1397718bf1f702a2ead2afb4dcee2c1505a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Oct 20 14:56:28 2018 -0700

    [kerx] Implement tuple-kerning in Format0

diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index e8eb43b8..960c37e1 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -78,12 +78,14 @@ struct KerxSubTableHeader
 
 struct KerxSubTableFormat0
 {
-  inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
+  inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
+			  hb_aat_apply_context_t *c) const
   {
-    if (header.tupleCount) return 0; /* TODO kerxTupleKern */
     hb_glyph_pair_t pair = {left, right};
     int i = pairs.bsearch (pair);
-    return i == -1 ? 0 : pairs[i].get_kerning ();
+    if (i == -1) return 0;
+    int v = pairs[i].get_kerning ();
+    return kerxTupleKern (v, header.tupleCount, this, c);
   }
 
   inline bool apply (hb_aat_apply_context_t *c) const
@@ -93,13 +95,27 @@ struct KerxSubTableFormat0
     if (!c->plan->requested_kerning)
       return false;
 
-    hb_kern_machine_t<KerxSubTableFormat0> machine (*this);
-
+    accelerator_t accel (*this, c);
+    hb_kern_machine_t<accelerator_t> machine (accel);
     machine.kern (c->font, c->buffer, c->plan->kern_mask);
 
     return_trace (true);
   }
 
+  struct accelerator_t
+  {
+    const KerxSubTableFormat0 &table;
+    hb_aat_apply_context_t *c;
+
+    inline accelerator_t (const KerxSubTableFormat0 &table_,
+			  hb_aat_apply_context_t *c_) :
+			    table (table_), c (c_) {}
+
+    inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
+    { return table.get_kerning (left, right, c); }
+  };
+
+
   inline bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -273,15 +289,6 @@ struct KerxSubTableFormat2
     return_trace (true);
   }
 
-  inline bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (likely (c->check_struct (this) &&
-			  leftClassTable.sanitize (c, this) &&
-			  rightClassTable.sanitize (c, this) &&
-			  c->check_range (this, array)));
-  }
-
   struct accelerator_t
   {
     const KerxSubTableFormat2 &table;
@@ -295,6 +302,15 @@ struct KerxSubTableFormat2
     { return table.get_kerning (left, right, c); }
   };
 
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (likely (c->check_struct (this) &&
+			  leftClassTable.sanitize (c, this) &&
+			  rightClassTable.sanitize (c, this) &&
+			  c->check_range (this, array)));
+  }
+
   protected:
   KerxSubTableHeader	header;
   HBUINT32		rowWidth;	/* The width, in bytes, of a row in the table. */


More information about the HarfBuzz mailing list