[Indic] In final reordering, find base, even if it disappeared
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 18 Jul 2012 21:42:34 +0000 (17:42 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 18 Jul 2012 21:43:23 +0000 (17:43 -0400)
POS_BASE can disappear if base ligated backward.  Define base as last
with position not after base.

Fixes a few hundred of Sinhala failures with Iskoola Pota.

src/hb-ot-shape-complex-indic.cc
test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt

index c0d56eb..2aaac54 100644 (file)
@@ -705,11 +705,8 @@ final_reordering_syllable (hb_buffer_t *buffer,
 
   /* Find base again */
   unsigned int base = end;
-  for (unsigned int i = start; i < end; i++)
-    if (info[i].indic_position() == POS_BASE_C) {
-      base = i;
-      break;
-    }
+  while (start < base && info[base - 1].indic_position() >= POS_BASE_C)
+    base--;
 
   unsigned int start_of_last_cluster = base;