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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Nov 4 17:46:03 PST 2015


 src/hb-ot-shape-normalize.cc                                            |   50 +++++++---
 test/shaping/Makefile.am                                                |    1 
 test/shaping/fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf |binary
 test/shaping/fonts/sha1sum/MANIFEST                                     |    2 
 test/shaping/record-test.sh                                             |    1 
 test/shaping/tests/MANIFEST                                             |    1 
 test/shaping/tests/hyphens.tests                                        |    2 
 7 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit 52e6c4e15893ed1cb0997795912a07b3e446b65a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 4 17:45:06 2015 -0800

    If font doesn't support U+2011, fall back to U+2010
    
    Test passes now.

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 91dff11..c1907e8 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -197,6 +197,16 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
     }
   }
 
+  if (u == 0x2011u)
+  {
+    hb_codepoint_t other_glyph;
+    if (c->font->get_glyph (0x2010u, 0, &other_glyph))
+    {
+      next_char (buffer, other_glyph);
+      return;
+    }
+  }
+
   next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
 }
 
commit 75483aafa6ad02d6391712d082d093823edcd758
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 4 17:43:36 2015 -0800

    Untangle if/else waterfall

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 31376b3..91dff11 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -164,26 +164,40 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
 {
   hb_buffer_t * const buffer = c->buffer;
   hb_codepoint_t u = buffer->cur().codepoint;
-  hb_codepoint_t glyph, space_glyph;
-  hb_unicode_funcs_t::space_t space_type;
+  hb_codepoint_t glyph;
 
-  /* Kind of a cute waterfall here... */
   if (shortest && c->font->get_glyph (u, 0, &glyph))
+  {
     next_char (buffer, glyph);
-  else if (decompose (c, shortest, u))
+    return;
+  }
+
+  if (decompose (c, shortest, u))
+  {
     skip_char (buffer);
-  else if (!shortest && c->font->get_glyph (u, 0, &glyph))
+    return;
+  }
+
+  if (!shortest && c->font->get_glyph (u, 0, &glyph))
+  {
     next_char (buffer, glyph);
-  else if (_hb_glyph_info_is_unicode_space (&buffer->cur()) &&
-	   (space_type = buffer->unicode->space_fallback_type (u)) != hb_unicode_funcs_t::NOT_SPACE &&
-	   c->font->get_glyph (0x0020u, 0, &space_glyph))
+    return;
+  }
+
+  if (_hb_glyph_info_is_unicode_space (&buffer->cur()))
   {
-    _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type);
-    next_char (buffer, space_glyph);
-    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK;
+    hb_codepoint_t space_glyph;
+    hb_unicode_funcs_t::space_t space_type = buffer->unicode->space_fallback_type (u);
+    if (space_type != hb_unicode_funcs_t::NOT_SPACE && c->font->get_glyph (0x0020u, 0, &space_glyph))
+    {
+      _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type);
+      next_char (buffer, space_glyph);
+      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK;
+      return;
+    }
   }
-  else
-    next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
+
+  next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
 }
 
 static inline void
commit 04fd8517f85ae9aa05b44f25578d2b19abfef7cb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 4 17:38:22 2015 -0800

    Add tests for hyphen fallback
    
    U+2011 is <noBreak> equivaent of U+2010, so we should do the fallback
    for it.  Currently fails.

diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 607da6d..e7ac9d5 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -48,6 +48,7 @@ TESTS = \
 	tests/default-ignorables.tests \
 	tests/fuzzed.tests \
 	tests/hangul-jamo.tests \
+	tests/hyphens.tests \
 	tests/indic-joiner-candrabindu.tests \
 	tests/indic-old-spec.tests \
 	tests/indic-pref-blocking.tests \
diff --git a/test/shaping/fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf b/test/shaping/fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf
new file mode 100644
index 0000000..26d19ad
Binary files /dev/null and b/test/shaping/fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf differ
diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST
index 879d929..a48711f 100644
--- a/test/shaping/fonts/sha1sum/MANIFEST
+++ b/test/shaping/fonts/sha1sum/MANIFEST
@@ -2,6 +2,7 @@
 051d92f8bc6ff724511b296c27623f824de256e9.ttf
 191826b9643e3f124d865d617ae609db6a2ce203.ttf
 1a6f1687b7a221f9f2c834b0b360d3c8463b6daf.ttf
+1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf
 1c2c3fc37b2d4c3cb2ef726c6cdaaabd4b7f3eb9.ttf
 226bc2deab3846f1a682085f70c67d0421014144.ttf
 270b89df543a7e48e206a2d830c0e10e5265c630.ttf
@@ -25,6 +26,7 @@ a919b33197965846f21074b24e30250d67277bce.ttf
 bb29ce50df2bdba2d10726427c6b7609bf460e04.ttf
 bb9473d2403488714043bcfb946c9f78b86ad627.ttf
 c4e48b0886ef460f532fb49f00047ec92c432ec0.ttf
+ce135a654f38a51822072b9f5d72ea4bc6d0f2d4.ttf
 d629e7fedc0b350222d7987345fe61613fa3929a.ttf
 df768b9c257e0c9c35786c47cae15c46571d56be.ttf
 e207635780b42f898d58654b65098763e340f5c7.ttf
diff --git a/test/shaping/tests/MANIFEST b/test/shaping/tests/MANIFEST
index 457c2eb..0ebbd24 100644
--- a/test/shaping/tests/MANIFEST
+++ b/test/shaping/tests/MANIFEST
@@ -6,6 +6,7 @@ cursive-positioning.tests
 default-ignorables.tests
 fuzzed.tests
 hangul-jamo.tests
+hyphens.tests
 indic-joiner-candrabindu.tests
 indic-old-spec.tests
 indic-pref-blocking.tests
diff --git a/test/shaping/tests/hyphens.tests b/test/shaping/tests/hyphens.tests
new file mode 100644
index 0000000..d2cb186
--- /dev/null
+++ b/test/shaping/tests/hyphens.tests
@@ -0,0 +1,2 @@
+fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf::U+2010:[gid1=0+739]
+fonts/sha1sum/1c04a16f32a39c26c851b7fc014d2e8d298ba2b8.ttf::U+2011:[gid1=0+739]
commit 550417117da7e14457a11f49a20145311f58587b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 4 17:37:30 2015 -0800

    [test] Drop hintings when subsetting fonts to record

diff --git a/test/shaping/record-test.sh b/test/shaping/record-test.sh
index 33afd60..b2a74f7 100755
--- a/test/shaping/record-test.sh
+++ b/test/shaping/record-test.sh
@@ -45,6 +45,7 @@ fi
 cp "$fontfile" "$dir/font.ttf"
 pyftsubset \
 	--glyph-names \
+	--no-hinting \
 	"$dir/font.ttf" \
 	--text="$text"
 if ! test -s "$dir/font.ttf.subset"; then


More information about the HarfBuzz mailing list