[Indic] Update clusters for left-matra even if matra didn't move
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 23 Jul 2012 03:55:19 +0000 (23:55 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 23 Jul 2012 03:55:19 +0000 (23:55 -0400)
Fixes crashes reported with left matra under
non-uniscribe-bug-compatibilty mode.

src/hb-ot-shape-complex-indic.cc

index ad55f77..47acbdb 100644 (file)
@@ -859,7 +859,8 @@ final_reordering_syllable (hb_buffer_t *buffer,
     while (new_pos > start &&
           !(FLAG (info[new_pos].indic_category()) & (FLAG (OT_M) | FLAG (OT_H) | FLAG (OT_Coeng))))
       new_pos--;
-    /* If we found no Halant we are done.  Otherwise only proceed if the Halant does
+    /* If we found no Halant we are done (just need to update clusters).
+     * 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) {
@@ -878,6 +879,12 @@ final_reordering_syllable (hb_buffer_t *buffer,
          start_of_last_cluster = MIN (new_pos, start_of_last_cluster);
          new_pos--;
        }
+    } else {
+      for (unsigned int i = start; i < start_of_last_cluster; i++)
+       if (info[i].indic_position () == POS_PRE_M) {
+         start_of_last_cluster = i;
+         break;
+       }
     }
   }