[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Nov 11 01:15:22 UTC 2017


 src/hb-buffer-private.hh |   17 +++++++++++++++--
 src/hb-coretext.cc       |    2 ++
 src/hb-directwrite.cc    |    3 +--
 src/hb-fallback-shape.cc |    2 ++
 src/hb-graphite2.cc      |    2 ++
 src/hb-uniscribe.cc      |    2 ++
 6 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit e4da38020021a92afa4062ed676f286945070dc4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Nov 10 17:14:27 2017 -0800

    [coretext/uniscribe/directwrite/graphite/fallback] Update for unsafe-to-break
    
    Fixes https://github.com/behdad/harfbuzz/issues/615
    
    We'll see which bots I broke.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 0b8d7c89..4913da6a 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -305,7 +305,7 @@ struct hb_buffer_t {
     info.cluster = cluster;
   }
 
-  int
+  inline int
   _unsafe_to_break_find_min_cluster (const hb_glyph_info_t *info,
 				     unsigned int start, unsigned int end,
 				     unsigned int cluster) const
@@ -314,7 +314,7 @@ struct hb_buffer_t {
       cluster = MIN<unsigned int> (cluster, info[i].cluster);
     return cluster;
   }
-  void
+  inline void
   _unsafe_to_break_set_mask (hb_glyph_info_t *info,
 			     unsigned int start, unsigned int end,
 			     unsigned int cluster)
@@ -326,6 +326,19 @@ struct hb_buffer_t {
 	info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
       }
   }
+
+  inline void
+  unsafe_to_break_all (void)
+  {
+    for (unsigned int i = 0; i < len; i++)
+      info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+  }
+  inline void
+  safe_to_break_all (void)
+  {
+    for (unsigned int i = 0; i < len; i++)
+      info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+  }
 };
 
 
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 90c9cd39..86ca17fb 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -1262,6 +1262,8 @@ resize_and_retry:
     }
   }
 
+  buffer->unsafe_to_break_all ();
+
 #undef FAIL
 
 fail:
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 25749de8..0674ef9b 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -927,8 +927,7 @@ hb_directwrite_shape_experimental_width(hb_font_t          *font,
   hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,
     features, num_features, width);
 
-  if (res)
-    buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
+  buffer->unsafe_to_break_all ();
 
   return res;
 }
diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc
index 4b60c6c3..3f09c3f5 100644
--- a/src/hb-fallback-shape.cc
+++ b/src/hb-fallback-shape.cc
@@ -143,5 +143,7 @@ _hb_fallback_shape (hb_shape_plan_t    *shape_plan HB_UNUSED,
   if (HB_DIRECTION_IS_BACKWARD (direction))
     hb_buffer_reverse (buffer);
 
+  buffer->safe_to_break_all ();
+
   return true;
 }
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 531c2ad6..62aaae9e 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -416,5 +416,7 @@ _hb_graphite2_shape (hb_shape_plan_t    *shape_plan,
   if (feats) gr_featureval_destroy (feats);
   gr_seg_destroy (seg);
 
+  buffer->unsafe_to_break_all ();
+
   return true;
 }
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 48413457..0b0bad58 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -1032,6 +1032,8 @@ retry:
   if (backward)
     hb_buffer_reverse (buffer);
 
+  buffer->unsafe_to_break_all ();
+
   /* Wow, done! */
   return true;
 }


More information about the HarfBuzz mailing list