[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jul 22 10:42:08 PDT 2015


 src/hb-ot-shape.cc |   25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

New commits:
commit 8cfbc304ee563ec96e402beed34b10b6c0950a6a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jul 22 18:41:10 2015 +0100

    Fix hide-default-ignorables after f0010dfd01ef4a927b0bdc175dd4e343a8637174
    
    We can't delete things before hb_ot_layout_position_finish().  So,
    just zero the advance before it, and remove later.

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index cf5ae87..993497a 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -411,6 +411,22 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
   }
 }
 
+static void
+hb_ot_zero_width_default_ignorables (hb_ot_shape_context_t *c)
+{
+  hb_buffer_t *buffer = c->buffer;
+
+  if (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)
+    return;
+
+  unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
+  hb_glyph_position_t *pos = buffer->pos;
+  unsigned int i = 0;
+  for (i = 0; i < count; i++)
+    if (unlikely (_hb_glyph_info_is_default_ignorable (&info[i])))
+      pos[i].x_advance = pos[i].y_advance = pos[i].x_offset = pos[i].y_offset = 0;
+}
 
 static void
 hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
@@ -441,10 +457,7 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
     for (/*continue*/; i < count; i++)
     {
       if (_hb_glyph_info_is_default_ignorable (&info[i]))
-      {
 	info[i].codepoint = space;
-	pos[i].x_advance = pos[i].y_advance = pos[i].x_offset = pos[i].y_offset = 0;
-      }
     }
   }
   else
@@ -738,9 +751,7 @@ hb_ot_position (hb_ot_shape_context_t *c)
 
   hb_bool_t fallback = !hb_ot_position_complex (c);
 
-  /* Need to do this here, since position_finish and fallback positioning
-   * might be affected by width of default_ignorables. */
-  hb_ot_hide_default_ignorables (c);
+  hb_ot_zero_width_default_ignorables (c);
 
   hb_ot_layout_position_finish (c->font, c->buffer);
 
@@ -782,6 +793,8 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
   hb_ot_substitute (c);
   hb_ot_position (c);
 
+  hb_ot_hide_default_ignorables (c);
+
   _hb_buffer_deallocate_unicode_vars (c->buffer);
 
   c->buffer->props.direction = c->target_direction;


More information about the HarfBuzz mailing list