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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jun 12 14:14:56 PDT 2014


 src/hb-ot-layout-private.hh                                             |    8 +
 src/hb-ot-shape-complex-indic.cc                                        |   56 ++++++++--
 test/shaping/fonts/sha1sum/MANIFEST                                     |    5 
 test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf |binary
 test/shaping/tests/indic-pref-blocking.tests                            |    3 
 5 files changed, 65 insertions(+), 7 deletions(-)

New commits:
commit 1d634cbb4b0338e1c2841127a72c5fac3a2a5ca1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 6 17:55:02 2014 -0400

    Fix base-position when 'pref' is NOT formed
    
    If pre-base reordering Ra is NOT formed (or formed and then
    broken up), we should consider that Ra as base.  This is
    observable when there's a left matra or dotreph that positions
    before base.
    
    Now, it might be that we shouldn't do this if the Ra happend
    to form a below form.  We can't quite deduce that right now...
    
    Micro test added.  Also at:
    
    https://code.google.com/a/google.com/p/noto-alpha/issues/detail?id=186#c29

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 62f1172..638aa3d 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1365,10 +1365,34 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
    * cluster.
    */
 
+  bool try_pref = !!indic_plan->mask_array[PREF];
+
   /* Find base again */
   unsigned int base;
   for (base = start; base < end; base++)
-    if (info[base].indic_position() >= POS_BASE_C) {
+    if (info[base].indic_position() >= POS_BASE_C)
+    {
+      if (try_pref && base + 1 < end && indic_plan->config->pref_len == 2)
+      {
+	for (unsigned int i = base + 1; i < end; i++)
+	  if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
+	  {
+	    if (!(_hb_glyph_info_substituted (&info[i]) &&
+		  _hb_glyph_info_ligated_and_didnt_multiply (&info[i])))
+	    {
+	      /* Ok, this was a 'pref' candidate but didn't form any.
+	       * Base is around here... */
+	      base = i;
+	      while (base < end && is_halant_or_coeng (info[base]))
+		base++;
+	      info[base].indic_position() = POS_BASE_C;
+
+	      try_pref = false;
+	    }
+	    break;
+	  }
+      }
+
       if (start < base && info[base].indic_position() > POS_BASE_C)
         base--;
       break;
@@ -1603,7 +1627,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
    *     the following rules:
    */
 
-  if (indic_plan->mask_array[PREF] && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */
+  if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */
   {
     unsigned int pref_len = indic_plan->config->pref_len;
     for (unsigned int i = base + 1; i < end; i++)
diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST
new file mode 100644
index 0000000..c05a9ef
--- /dev/null
+++ b/test/shaping/fonts/sha1sum/MANIFEST
@@ -0,0 +1,5 @@
+226bc2deab3846f1a682085f70c67d0421014144.ttf
+4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf
+d629e7fedc0b350222d7987345fe61613fa3929a.ttf
+e207635780b42f898d58654b65098763e340f5c7.ttf
+f499fbc23865022234775c43503bba2e63978fe1.ttf
diff --git a/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf b/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf
new file mode 100644
index 0000000..d91df57
Binary files /dev/null and b/test/shaping/fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf differ
diff --git a/test/shaping/tests/indic-pref-blocking.tests b/test/shaping/tests/indic-pref-blocking.tests
index 23ef5bc..260980a 100644
--- a/test/shaping/tests/indic-pref-blocking.tests
+++ b/test/shaping/tests/indic-pref-blocking.tests
@@ -1 +1,2 @@
-fonts/sha1sum/62927e416ab1fba8cc6222d97b2b0ba0e0eb00ea.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[evowelsignmlym=0+1465|rapostmlym=0+499|yamlym=0+2120]
+fonts/sha1sum/226bc2deab3846f1a682085f70c67d0421014144.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[evowelsignmlym=0+1465|rapostmlym=0+499|yamlym=0+2120]
+fonts/sha1sum/e207635780b42f898d58654b65098763e340f5c7.ttf:U+0D2F,U+0D4D,U+0D30,U+0D46:[yamlym=0+2120|viramamlym=0+0|evowelsignmlym=0+1465|ramlym=0+1507]
commit 04dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 6 17:28:38 2014 -0400

    [indic] Recover OT_H undergone ligation and multiplication
    
    Sometimes font designers form half/pref/etc consonant forms
    unconditionally and then undo that conditionally.  Try to
    recover the OT_H classification in those cases.
    
    No test number changes expected.

diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index 3ded92f..e66e19c 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -395,6 +395,14 @@ _hb_glyph_info_ligated_and_didnt_multiply (const hb_glyph_info_t *info)
   return _hb_glyph_info_ligated (info) && !_hb_glyph_info_multiplied (info);
 }
 
+static inline void
+_hb_glyph_info_clear_ligated_and_multiplied (hb_glyph_info_t *info)
+{
+  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
+			   HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
+}
+
+
 /* Allocation / deallocation. */
 
 static inline void
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 81f4c61..62f1172 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1336,6 +1336,27 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
   const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data;
   hb_glyph_info_t *info = buffer->info;
 
+
+  /* This function relies heavily on halant glyphs.  Lots of ligation
+   * and possibly multiplication substitutions happened prior to this
+   * phase, and that might have messed up our properties.  Recover
+   * from a particular case of that where we're fairly sure that a
+   * class of OT_H is desired but has been lost. */
+  if (indic_plan->virama_glyph)
+  {
+    unsigned int virama_glyph = indic_plan->virama_glyph;
+    for (unsigned int i = start; i < end; i++)
+      if (info[i].codepoint == virama_glyph &&
+	  _hb_glyph_info_ligated (&info[i]) &&
+	  _hb_glyph_info_multiplied (&info[i]))
+      {
+        /* This will make sure that this glyph passes is_halant_or_coeng() test. */
+	info[i].indic_category() = OT_H;
+	_hb_glyph_info_clear_ligated_and_multiplied (&info[i]);
+      }
+  }
+
+
   /* 4. Final reordering:
    *
    * After the localized forms and basic shaping forms GSUB features have been
commit 39c8201f8e361e8c0f23f07bf20124ccadc6086c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 6 17:19:35 2014 -0400

    [indic] Improve base re-finding
    
    No test numbers change.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index e996967..81f4c61 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1353,11 +1353,10 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
       break;
     }
   if (base == end && start < base &&
-      info[base - 1].indic_category() != OT_ZWJ)
+      is_one_of (info[base - 1], FLAG (OT_ZWJ)))
     base--;
   while (start < base &&
-	 (info[base].indic_category() == OT_H ||
-	  info[base].indic_category() == OT_N))
+	 is_one_of (info[base], (FLAG (OT_N) | HALANT_OR_COENG_FLAGS)))
     base--;
 
 
commit c04d5f0dd24d0ed9560fb9aebb5561ce946743c3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jun 6 17:02:39 2014 -0400

    [indic] Minor

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 4b12220..e996967 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -1383,7 +1383,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
     if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL)
     {
       while (new_pos > start &&
-	     !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H) | FLAG (OT_Coeng)))))
+	     !(is_one_of (info[new_pos], (FLAG (OT_M) | HALANT_OR_COENG_FLAGS))))
 	new_pos--;
 
       /* If we found no Halant we are done.


More information about the HarfBuzz mailing list