[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jul 22 10:31:04 PDT 2015


 src/hb-buffer-private.hh |   18 ------------------
 src/hb-ot-shape.cc       |   44 +++++++++++++++++++++++++++++++++++---------
 2 files changed, 35 insertions(+), 27 deletions(-)

New commits:
commit 2dbd3d29d6548bd96fd976606ed689fac8ad8817
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jul 22 18:28:39 2015 +0100

    Fix hide-ignorables if font doesn't have space glyph
    
    Was broken by 82b521aeb7cc73879b44ca4278d6fa8b4347527f, as we have
    positioning data by then and can't use the output buffer.  Ouch!

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 3a2db48..9aa5e7d 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -152,24 +152,6 @@ struct hb_buffer_t {
 
     idx++;
   }
-  inline void
-  next_glyphs (unsigned int count)
-  {
-    if (have_output)
-    {
-      if (unlikely (out_info != info || out_len != idx)) {
-	if (unlikely (!make_room_for (count, count))) return;
-	{
-	  while (count--)
-	    out_info[out_len++] = info[idx++];
-	  return;
-	}
-      }
-      out_len += count;
-    }
-
-    idx += count;
-  }
 
   /* Advance idx without copying to output. */
   inline void skip_glyph (void) { idx++; }
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 33b13b5..cf5ae87 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -449,20 +449,46 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
   }
   else
   {
-    /* Merge clusters and delete default-ignorables. */
-    buffer->clear_output ();
-    buffer->idx = 0;
-    buffer->next_glyphs (i);
-    while (buffer->idx < buffer->len)
+    /* Merge clusters and delete default-ignorables.
+     * NOTE! We can't use out-buffer as we have positioning data. */
+    unsigned int j = i;
+    for (; i < count; i++)
     {
-      if (_hb_glyph_info_is_default_ignorable (&info[buffer->idx]))
+      if (_hb_glyph_info_is_default_ignorable (&info[i]))
       {
-	buffer->delete_glyph ();
+	/* Merge clusters.
+	 * Same logic as buffer->delete_glyph(), but for in-place removal. */
+
+	unsigned int cluster = info[i].cluster;
+	if (i + 1 < count && cluster == info[i + 1].cluster)
+	  continue; /* Cluster survives; do nothing. */
+
+	if (j)
+	{
+	  /* Merge cluster backward. */
+	  if (cluster < info[j - 1].cluster)
+	  {
+	    unsigned int old_cluster = info[j - 1].cluster;
+	    for (unsigned k = j; k && info[k - 1].cluster == old_cluster; k--)
+	      info[k - 1].cluster = cluster;
+	  }
+	  continue;
+	}
+
+	if (i + 1 < count)
+	  buffer->merge_clusters (i, i + 2); /* Merge cluster forward. */
+
 	continue;
       }
-      buffer->next_glyph ();
+
+      if (j != i)
+      {
+	info[j] = info[i];
+	pos[j] = pos[i];
+      }
+      j++;
     }
-    buffer->swap_buffers ();
+    buffer->len = j;
   }
 }
 


More information about the HarfBuzz mailing list