[HarfBuzz] harfbuzz: Branch 'master' - 4 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Oct 26 00:46:25 UTC 2018


 src/hb-aat-layout-common.hh     |    6 +++---
 src/hb-aat-layout-morx-table.hh |   20 ++++++++++++++++++--
 2 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit ba5ca6a762cb46a17f41673b14996a12e6cfe3d1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 17:41:26 2018 -0700

    [morx] Use deleted-glyph, instead of actual deletion, in Ligation
    
    Closer to what CoreText does.
    
    Fixes https://github.com/harfbuzz/harfbuzz/issues/1302

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index a3077e57..84e321ed 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -447,8 +447,7 @@ struct LigatureSubtable
 	    {
 	      DEBUG_MSG (APPLY, nullptr, "Skipping ligature component");
 	      buffer->move_to (match_positions[--match_length]);
-	      buffer->skip_glyph ();
-	      end--;
+	      buffer->replace_glyph (DELETED_GLYPH);
 	    }
 
 	    buffer->move_to (end + 1);
commit 5c272e3613667ca532f32764824784c63d797f57
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 17:36:33 2018 -0700

    [morx] Remove deleted-glyph at the end of processing

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index c663fcc8..a3077e57 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -998,6 +998,22 @@ struct morx
     }
   }
 
+  inline static void remove_deleted_glyphs (hb_buffer_t *buffer)
+  {
+    if (unlikely (!buffer->successful)) return;
+
+    buffer->clear_output ();
+    for (buffer->idx = 0; buffer->idx < buffer->len && buffer->successful;)
+    {
+      if (unlikely (buffer->cur().codepoint == DELETED_GLYPH))
+        buffer->skip_glyph ();
+      else
+        buffer->next_glyph ();
+    }
+    if (likely (buffer->successful))
+      buffer->swap_buffers ();
+  }
+
   inline void apply (hb_aat_apply_context_t *c) const
   {
     if (unlikely (!c->buffer->successful)) return;
@@ -1010,6 +1026,7 @@ struct morx
       if (unlikely (!c->buffer->successful)) return;
       chain = &StructAfter<Chain> (*chain);
     }
+    remove_deleted_glyphs (c->buffer);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) const
commit 1bb8ed86d6cfec0fc87c8e1930d9a86426b42001
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 17:33:48 2018 -0700

    [aat] Minor

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index da4b37fb..406a36d8 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -532,7 +532,7 @@ struct StateTableDriver
 
     unsigned int state = StateTable<EntryData>::STATE_START_OF_TEXT;
     bool last_was_dont_advance = false;
-    for (buffer->idx = 0;;)
+    for (buffer->idx = 0; buffer->successful;)
     {
       unsigned int klass = buffer->idx < buffer->len ?
 			   machine.get_class (buffer->info[buffer->idx].codepoint, num_glyphs) :
@@ -566,8 +566,6 @@ struct StateTableDriver
       if (unlikely (!c->transition (this, entry)))
         break;
 
-      if (unlikely (!buffer->successful)) return;
-
       last_was_dont_advance = (entry->flags & context_t::DontAdvance) && buffer->max_ops-- > 0;
 
       state = entry->newState;
commit 102af615f15d04da20c17d80eb38f5948020f9ac
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 17:29:32 2018 -0700

    [aat] Start adding support for DELETED-GLYPH
    
    https://github.com/harfbuzz/harfbuzz/issues/1302

diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index a99ccaf9..da4b37fb 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -362,6 +362,7 @@ template <>
 }
 namespace AAT {
 
+enum { DELETED_GLYPH = 0xFFFF };
 
 /*
  * Extended State Table
@@ -424,6 +425,7 @@ struct StateTable
 
   inline unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
   {
+    if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
     const HBUINT16 *v = (this+classTable).get_value (glyph_id, num_glyphs);
     return v ? (unsigned) *v : (unsigned) CLASS_OUT_OF_BOUNDS;
   }


More information about the HarfBuzz mailing list