From 5f0eaaad129ff04d56b8756bebf19fbc242718c9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 20 Jul 2012 15:47:24 -0400 Subject: [PATCH] [Indic] Fix base search in final_reordering Fixes most Malayalam failures. Down from 1.6% to 0.38% now. Fixes a few more in other scripts too. --- src/hb-ot-shape-complex-indic.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 1a75e78..f75a500 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -712,7 +712,7 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff } /* XXX This will not match for old-Indic spec since the Halant-Ra order is reversed already. */ - if (basic_mask_array[PREF] && base + 3 <= end) + if (basic_mask_array[PREF] && base + 2 < end) { /* Find a Halant,Ra sequence and mark it fore pre-base reordering processing. */ for (unsigned int i = base + 1; i + 1 < end; i++) @@ -829,9 +829,13 @@ final_reordering_syllable (hb_buffer_t *buffer, */ /* Find base again */ - unsigned int base = end; - while (start < base && info[base - 1].indic_position() >= POS_BASE_C) - base--; + unsigned int base; + for (base = start; base < end; base++) + if (info[base].indic_position() >= POS_BASE_C) { + if (start < base && info[base].indic_position() > POS_BASE_C) + base--; + break; + } unsigned int start_of_last_cluster = base; -- 2.7.4