[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Jul 22 21:11:50 PDT 2012


 src/hb-ot-shape-complex-indic.cc |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit e6b01a878cd2e63cb675e7e0c6ac4d83a8c10f37
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Jul 23 00:11:26 2012 -0400

    [Indic] Further streamline cluster formation
    
    This should address all possible cluster misformations that I had in
    mind.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 580c6d6..2e0b88f 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -845,7 +845,6 @@ final_reordering_syllable (hb_buffer_t *buffer,
       break;
     }
 
-  unsigned int start_of_last_cluster = base;
 
   /*   o Reorder matras:
    *
@@ -867,7 +866,8 @@ final_reordering_syllable (hb_buffer_t *buffer,
      * Otherwise only proceed if the Halant does
      * not belong to the Matra itself! */
     if (is_halant_or_coeng (info[new_pos]) &&
-	info[new_pos].indic_position() != POS_PRE_M) {
+	info[new_pos].indic_position() != POS_PRE_M)
+    {
       /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */
       if (new_pos + 1 < end && is_joiner (info[new_pos + 1]))
 	new_pos++;
@@ -880,13 +880,13 @@ final_reordering_syllable (hb_buffer_t *buffer,
 	  hb_glyph_info_t tmp = info[old_pos];
 	  memmove (&info[old_pos], &info[old_pos + 1], (new_pos - old_pos) * sizeof (info[0]));
 	  info[new_pos] = tmp;
-	  start_of_last_cluster = MIN (new_pos, start_of_last_cluster);
 	  new_pos--;
 	}
+      buffer->merge_clusters (new_pos, base);
     } else {
-      for (unsigned int i = start; i < start_of_last_cluster; i++)
+      for (unsigned int i = start; i < base; i++)
 	if (info[i].indic_position () == POS_PRE_M) {
-	  start_of_last_cluster = i;
+	  buffer->merge_clusters (i, base);
 	  break;
 	}
     }
@@ -1060,11 +1060,13 @@ final_reordering_syllable (hb_buffer_t *buffer,
 
     reph_move:
     {
+      /* Yay, one big cluster! Merge before moving. */
+      buffer->merge_clusters (start, end);
+
       /* Move */
       hb_glyph_info_t reph = info[start];
       memmove (&info[start], &info[start + 1], (new_reph_pos - start) * sizeof (info[0]));
       info[new_reph_pos] = reph;
-      start_of_last_cluster = start; /* Yay, one big cluster! */
     }
   }
 
@@ -1106,10 +1108,10 @@ final_reordering_syllable (hb_buffer_t *buffer,
 
 	  {
 	    unsigned int old_pos = i;
+	    buffer->merge_clusters (new_pos, old_pos + 1);
 	    hb_glyph_info_t tmp = info[old_pos];
 	    memmove (&info[new_pos + 1], &info[new_pos], (old_pos - new_pos) * sizeof (info[0]));
 	    info[new_pos] = tmp;
-	    start_of_last_cluster = MIN (new_pos, start_of_last_cluster);
 	  }
 	}
 
@@ -1129,17 +1131,14 @@ final_reordering_syllable (hb_buffer_t *buffer,
   /*
    * Finish off the clusters and go home!
    */
-
   if (indic_options ().uniscribe_bug_compatible)
   {
     /* Uniscribe merges the entire cluster.
      * This means, half forms are submerged into the main consonants cluster.
      * This is unnecessary, and makes cursor positioning harder, but that's what
      * Uniscribe does. */
-    start_of_last_cluster = start;
+    buffer->merge_clusters (start, end);
   }
-
-  buffer->merge_clusters (start_of_last_cluster, end);
 }
 
 
commit 7b2a7dadd6c616bbfe1d8358700cab9cee88e584
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Jul 22 23:58:55 2012 -0400

    [Indic] Merge clusters before sorting
    
    This should fix any instabilities in cluster formation that we were
    speculating may happen with surrounding syllables.  Or most of it
    perhaps.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 47acbdb..580c6d6 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -681,6 +681,10 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff
   /* We do bubble-sort, skip malicious clusters attempts */
   if (end - start < 64)
   {
+    /* Things are out-of-control for post base positions, they may shuffle
+     * around like crazy, so merge clusters.  For pre-base stuff, we handle
+     * cluster issues in final reordering. */
+    buffer->merge_clusters (base, end);
     /* Sit tight, rock 'n roll! */
     hb_bubble_sort (info + start, end - start, compare_indic_order);
     /* Find base again */



More information about the HarfBuzz mailing list