From 5d32690a3428fa86eb26fe5fcec943a10aa95881 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Jul 2012 14:23:28 -0400 Subject: [PATCH] [Indic] For scripts without Half forms, always choose first consonant as base In such scripts (ie. Khmer), a ZWJ/ZWNJ shouldn't stop the search for base. So, instead just choose the first consonant as base directly. Test sequence: U+1798,200c,U+17C9,U+17D2,U+179B,U+17C1,U+17C7 --- src/hb-ot-shape-complex-indic.cc | 59 ++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 70068ae..2690511 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -352,35 +352,46 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff has_reph = true; }; - /* -> starting from the end of the syllable, move backwards */ - unsigned int i = end; - do { - i--; - /* -> until a consonant is found */ - if (is_consonant (info[i])) - { - /* -> that does not have a below-base or post-base form - * (post-base forms have to follow below-base forms), */ - if (info[i].indic_position() != POS_BELOW_C && - info[i].indic_position() != POS_POST_C) + if (basic_mask_array[HALF]) + { + /* -> starting from the end of the syllable, move backwards */ + unsigned int i = end; + do { + i--; + /* -> until a consonant is found */ + if (is_consonant (info[i])) { + /* -> that does not have a below-base or post-base form + * (post-base forms have to follow below-base forms), */ + if (info[i].indic_position() != POS_BELOW_C && + info[i].indic_position() != POS_POST_C) + { + base = i; + break; + } + + /* -> or that is not a pre-base reordering Ra, + * + * TODO + */ + + /* -> or arrive at the first consonant. The consonant stopped at will + * be the base. */ base = i; - break; } + else + if (is_joiner (info[i])) + break; + } while (i > limit); + } + else + { + /* In scripts without half forms (eg. Khmer), the first consonant is always the base. */ - /* -> or that is not a pre-base reordering Ra, - * - * TODO - */ + if (!has_reph) + base = limit; + } - /* -> or arrive at the first consonant. The consonant stopped at will - * be the base. */ - base = i; - } - else - if (is_joiner (info[i])) - break; - } while (i > limit); if (base < start) base = start; /* Just in case... */ -- 2.7.4