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

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Sep 1 17:35:19 UTC 2017


 src/hb-buffer.cc                                                        |   16 +++----
 src/hb-ot-shape-complex-indic-private.hh                                |    2 
 src/hb-ot-shape.cc                                                      |    2 
 test/shaping/fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf |binary
 test/shaping/run-tests.sh                                               |    4 -
 test/shaping/tests/indic-syllable.tests                                 |    3 -
 util/options.hh                                                         |   21 +++++-----
 util/view-cairo.hh                                                      |    2 
 8 files changed, 28 insertions(+), 22 deletions(-)

New commits:
commit 06cb162cd79cc922b572e5f532ca867223b6dc4c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 1 10:34:21 2017 -0700

    [indic] Treat Consonant_With_Stacker as consonant
    
    Fixes https://github.com/behdad/harfbuzz/issues/528
    "Kannada JIHVAMULIYA and UPADHMANIYA insert dotted circles"

diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh
index 58be4222..c880311e 100644
--- a/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/hb-ot-shape-complex-indic-private.hh
@@ -121,7 +121,7 @@ enum indic_syllabic_category_t {
   INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED		= OT_X, /* Don't care. */
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED		= OT_CM,
   INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA	= OT_N,
-  INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER	= OT_Repha, /* TODO */
+  INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER	= OT_C,
   INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK		= OT_SM,
   INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER		= OT_Coeng,
   INDIC_SYLLABIC_CATEGORY_JOINER			= OT_ZWJ,
diff --git a/test/shaping/fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf b/test/shaping/fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf
new file mode 100644
index 00000000..d7db1de2
Binary files /dev/null and b/test/shaping/fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf differ
diff --git a/test/shaping/tests/indic-syllable.tests b/test/shaping/tests/indic-syllable.tests
index 26c38b35..37eaadcd 100644
--- a/test/shaping/tests/indic-syllable.tests
+++ b/test/shaping/tests/indic-syllable.tests
@@ -1 +1,2 @@
-fonts/sha1sum/54674a3111d209fb6be0ed31745314b7a8d2c244.ttf::U+0BA4,U+0BCD,U+00B3:[taprehalftamil=0+1509|uni00B3=2+674]
+fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf::U+0CF1:[gid1=0+1129]
+fonts/sha1sum/3d0b77a2360aa6faa1385aaa510509ab70dfbeff.ttf::U+0CF2:[gid2=0+1539]
commit c449d2d8c9e27502380faa0b568a374c838ac9a7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 30 17:28:22 2017 -0700

    [unsafe-to-break] Mark during fraction-slash formation
    
    Fixes tests/automatic-fractions.tests

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index bc536696..54c33a3e 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -394,6 +394,8 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
 	     HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
         end++;
 
+      buffer->unsafe_to_break (start, end);
+
       for (unsigned int j = start; j < i; j++)
         info[j].mask |= pre_mask;
       info[i].mask |= c->plan->frac_mask;
commit b262ebcc9c9539076d17751e9bae06a8fd5001ff
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 30 17:25:10 2017 -0700

    [util] Fix cluster sweeping during --verify
    
    If *I* get this wrong in 2017, I have no idea how others get their head around
    cluster math...
    
    Fixes tests/arabic-fallback-shaping.tests

diff --git a/util/options.hh b/util/options.hh
index 42bb8c46..b24ab0c8 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -366,13 +366,18 @@ struct shape_options_t : option_group_t
       }
       else
       {
-	unsigned int cluster = info[end].cluster;
 	if (forward)
-	  while (text_end < num_chars && text[text_end].cluster != cluster)
+	{
+	  unsigned int cluster = info[end].cluster;
+	  while (text_end < num_chars && text[text_end].cluster < cluster)
 	    text_end++;
+	}
 	else
-	  while (text_start && text[text_start - 1].cluster != cluster)
+	{
+	  unsigned int cluster = info[end - 1].cluster;
+	  while (text_start && text[text_start - 1].cluster >= cluster)
 	    text_start--;
+	}
       }
       assert (text_start < text_end);
 
commit 69d701b02e5ebc3597b0d0576dbab8e1ece51944
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 30 17:07:29 2017 -0700

    [util] When --verify fails, return reconstructed shape results

diff --git a/util/options.hh b/util/options.hh
index 9ad2225d..42bb8c46 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -416,11 +416,9 @@ struct shape_options_t : option_group_t
 	*error = "Safe-to-break test failed.";
       ret = false;
 
-      if (0)
-      {
-	hb_buffer_set_length (buffer, 0);
-	hb_buffer_append (buffer, reconstruction, 0, -1);
-      }
+      /* Return the reconstructed result instead so it can be inspected. */
+      hb_buffer_set_length (buffer, 0);
+      hb_buffer_append (buffer, reconstruction, 0, -1);
     }
 
     hb_buffer_destroy (reconstruction);
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index d3e59afa..bf56da3c 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -59,7 +59,7 @@ struct view_cairo_t
   }
   void error (const char *message)
   {
-    fail (false, "%s", message);
+    g_printerr ("%s: %s\n", g_get_prgname (), message);
   }
   void consume_glyphs (hb_buffer_t  *buffer,
 		       const char   *text,
commit 099472e08bf81d6dd8ca1647999592df6b7fdfb9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 30 16:45:06 2017 -0700

    hb_buffer_diff() tweak
    
    I like to have a mode where CONTAINS_NOTDEF and CONTAINS_DOTTEDCIRCLE are not
    returned.  Abused a value of -1 for that.  hb-shape now uses it.  Fixes two
    of the six tests failing with --verify in test/shaping/run-tests.sh.

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index a45062aa..6b05d3a6 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -31,10 +31,6 @@
 #include "hb-utf-private.hh"
 
 
-#ifndef HB_DEBUG_BUFFER
-#define HB_DEBUG_BUFFER (HB_DEBUG+0)
-#endif
-
 /**
  * SECTION: hb-buffer
  * @title: Buffers
@@ -1885,6 +1881,9 @@ hb_buffer_t::sort (unsigned int start, unsigned int end, int(*compar)(const hb_g
 /**
  * hb_buffer_diff:
  *
+ * If dottedcircle_glyph is (hb_codepoint_t) -1 then %HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT
+ * and %HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT are never returned.  This should be used by most
+ * callers if just comparing two buffers is needed.
  *
  * Since: 1.5.0
  **/
@@ -1898,6 +1897,7 @@ hb_buffer_diff (hb_buffer_t *buffer,
     return HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH;
 
   hb_buffer_diff_flags_t result = HB_BUFFER_DIFF_FLAG_EQUAL;
+  bool contains = dottedcircle_glyph != (hb_codepoint_t) -1;
 
   unsigned int count = reference->len;
 
@@ -1911,9 +1911,9 @@ hb_buffer_diff (hb_buffer_t *buffer,
     unsigned int i;
     for (i = 0; i < count; i++)
     {
-      if (info[i].codepoint == dottedcircle_glyph)
+      if (contains && info[i].codepoint == dottedcircle_glyph)
         result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
-      else if (info[i].codepoint == 0)
+      if (contains && info[i].codepoint == 0)
         result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
     }
     result |= HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH;
@@ -1933,9 +1933,9 @@ hb_buffer_diff (hb_buffer_t *buffer,
       result |= HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH;
     if ((buf_info->mask & HB_GLYPH_FLAG_DEFINED) != (ref_info->mask & HB_GLYPH_FLAG_DEFINED))
       result |= HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH;
-    if (ref_info->codepoint == dottedcircle_glyph)
+    if (contains && ref_info->codepoint == dottedcircle_glyph)
       result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
-    else if (ref_info->codepoint == 0)
+    if (contains && ref_info->codepoint == 0)
       result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
     buf_info++;
     ref_info++;
diff --git a/test/shaping/run-tests.sh b/test/shaping/run-tests.sh
index 9c496314..2b10e7c8 100755
--- a/test/shaping/run-tests.sh
+++ b/test/shaping/run-tests.sh
@@ -4,8 +4,8 @@ test "x$srcdir" = x && srcdir=.
 test "x$builddir" = x && builddir=.
 test "x$top_builddir" = x && top_builddir=../..
 
-#hb_shape="$top_builddir/util/hb-shape$EXEEXT --verify"
-hb_shape="$top_builddir/util/hb-shape$EXEEXT"
+hb_shape="$top_builddir/util/hb-shape$EXEEXT --verify"
+#hb_shape="$top_builddir/util/hb-shape$EXEEXT"
 
 fails=0
 
diff --git a/util/options.hh b/util/options.hh
index dbc4eaf9..9ad2225d 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -409,7 +409,7 @@ struct shape_options_t : option_group_t
     }
 
     bool ret = true;
-    hb_buffer_diff_flags_t diff = hb_buffer_diff (buffer, reconstruction, 0, 0);
+    hb_buffer_diff_flags_t diff = hb_buffer_diff (buffer, reconstruction, (hb_codepoint_t) -1, 0);
     if (diff)
     {
       if (error)


More information about the HarfBuzz mailing list