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

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Sep 5 03:15:06 UTC 2017


 src/hb-buffer.cc          |    2 +-
 src/hb-buffer.h           |    4 ++--
 src/hb-ot-shape.cc        |   17 +++++++++++------
 test/shaping/run-tests.sh |    6 +++---
 util/options.hh           |    2 +-
 5 files changed, 18 insertions(+), 13 deletions(-)

New commits:
commit d03f11f246efec13e48fd68a9ce136db771b22bf
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Sep 4 20:14:13 2017 -0700

    Fix buffer_diff for empty buffers
    
    If buffers are empty, content type should be ignored.
    
    This fixes last of the failing tests: fuzzed.tests.  Green again!

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 6b05d3a6..171d1016 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -1893,7 +1893,7 @@ hb_buffer_diff (hb_buffer_t *buffer,
 		hb_codepoint_t dottedcircle_glyph,
 		unsigned int position_fuzz)
 {
-  if (buffer->content_type != reference->content_type)
+  if (buffer->content_type != reference->content_type && buffer->len && reference->len)
     return HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH;
 
   hb_buffer_diff_flags_t result = HB_BUFFER_DIFF_FLAG_EQUAL;
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index ffbf66ee..1d633f7d 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -481,12 +481,12 @@ typedef enum { /*< flags >*/
 
   /* Buffers with different content_type cannot be meaningfully compared
    * in any further detail. */
-  HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH	= 0X0001,
+  HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH	= 0x0001,
 
   /* For buffers with differing length, the per-glyph comparison is not
    * attempted, though we do still scan reference for dottedcircle / .notdef
    * glyphs. */
-  HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH		= 0X0002,
+  HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH		= 0x0002,
 
   /* We want to know if dottedcircle / .notdef glyphs are present in the
    * reference, as we may not care so much about other differences in this
diff --git a/util/options.hh b/util/options.hh
index b24ab0c8..9feee2dc 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -414,7 +414,7 @@ struct shape_options_t : option_group_t
     }
 
     bool ret = true;
-    hb_buffer_diff_flags_t diff = hb_buffer_diff (buffer, reconstruction, (hb_codepoint_t) -1, 0);
+    hb_buffer_diff_flags_t diff = hb_buffer_diff (reconstruction, buffer, (hb_codepoint_t) -1, 0);
     if (diff)
     {
       if (error)
commit 7cc348041d0b026ca6d2c240134e8f9100600e99
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Sep 4 20:04:59 2017 -0700

    [unsafe-to-break] Fix unsafe-to-break for cluster-level=1
    
    Fixes tests/shaping/tests/cluster.tests

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 54c33a3e..8cd8fcc1 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -275,8 +275,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
 static void
 hb_form_clusters (hb_buffer_t *buffer)
 {
-  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
-      buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII))
     return;
 
   /* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */
@@ -288,11 +287,17 @@ hb_form_clusters (hb_buffer_t *buffer)
     if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) &&
 		!_hb_glyph_info_is_joiner (&info[i])))
     {
-      buffer->merge_clusters (base, i);
+      if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+	buffer->merge_clusters (base, i);
+      else
+	buffer->unsafe_to_break (base, i);
       base = i;
     }
   }
-  buffer->merge_clusters (base, count);
+  if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+    buffer->merge_clusters (base, count);
+  else
+    buffer->unsafe_to_break (base, count);
 }
 
 static void
@@ -580,8 +585,6 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
 {
   hb_buffer_t *buffer = c->buffer;
 
-  hb_ot_shape_initialize_masks (c);
-
   hb_ot_mirror_chars (c);
 
   HB_BUFFER_ALLOCATE_VAR (buffer, glyph_index);
@@ -836,8 +839,10 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
 
   c->buffer->clear_output ();
 
+  hb_ot_shape_initialize_masks (c);
   hb_set_unicode_props (c->buffer);
   hb_insert_dotted_circle (c->buffer, c->font);
+
   hb_form_clusters (c->buffer);
 
   hb_ensure_native_direction (c->buffer);
commit 61a9d7e6d0e6df7b48f58fa1679f0f93407993b2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Sep 4 19:48:52 2017 -0700

    Minor

diff --git a/test/shaping/run-tests.sh b/test/shaping/run-tests.sh
index c6b35e31..a7d331aa 100755
--- a/test/shaping/run-tests.sh
+++ b/test/shaping/run-tests.sh
@@ -26,12 +26,12 @@ for f in "$@"; do
 			$reference || echo "# hb-shape $fontfile --unicodes $unicodes"
 			continue
 		fi
-		$reference || echo "hb-shape $fontfile --unicodes $unicodes"
-		glyphs=`$srcdir/hb-unicode-encode "$unicodes" | $hb_shape $options "$srcdir/$fontfile"`
+		$reference || echo "hb-shape $fontfile $options --unicodes $unicodes"
+		glyphs=`$hb_shape "$srcdir/$fontfile" $options --unicodes "$unicodes"`
 		if test $? != 0; then
 			echo "hb-shape failed." >&2
 			fails=$((fails+1))
-			continue
+			#continue
 		fi
 		if $reference; then
 			echo "$fontfile:$options:$unicodes:$glyphs"


More information about the HarfBuzz mailing list