From 65c43accdc4d2082282d5cedba8514b8df0c18a2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Jul 2012 03:36:47 -0400 Subject: [PATCH] [Indic] Better position left-matra in Malayalam Just put it before base, which is what's expected. Malayalam failures down from 1559 to 1197 (0.114172%). BENGALI: 353988 out of 354285 tests passed. 297 failed (0.0838308%) DEVANAGARI: 693571 out of 693628 tests passed. 57 failed (0.00821766%) GUJARATI: 366489 out of 366506 tests passed. 17 failed (0.0046384%) GURMUKHI: 60750 out of 60809 tests passed. 59 failed (0.0970251%) KANNADA: 950956 out of 951913 tests passed. 957 failed (0.100534%) KHMER: 299094 out of 299124 tests passed. 30 failed (0.0100293%) MALAYALAM: 1047219 out of 1048416 tests passed. 1197 failed (0.114172%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271699 out of 271847 tests passed. 148 failed (0.0544424%) TAMIL: 1091837 out of 1091837 tests passed. 0 failed (0%) TELUGU: 970524 out of 970573 tests passed. 49 failed (0.00504856%) --- src/hb-ot-shape-complex-indic.cc | 41 +++++++++++++++------- .../indic/script-malayalam/misc/misc.txt | 1 + 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index d90d238..d0c3c09 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -895,22 +895,37 @@ final_reordering_syllable (hb_buffer_t *buffer, * halant, position is moved after it. */ - if (start < base) /* Otherwise there can't be any pre-base matra characters. */ + if (start + 1 < end && start < base) /* Otherwise there can't be any pre-base matra characters. */ { - unsigned int new_pos = base - 1; - while (new_pos > start && - !(is_one_of (info[new_pos], (FLAG (OT_M) | FLAG (OT_H) | FLAG (OT_Coeng))))) - new_pos--; - /* 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) + /* If we lost track of base, alas, position before last thingy. */ + unsigned int new_pos = base == end ? base - 2 : base - 1; + + /* Malayalam does not have "half" forms or explicit virama forms. + * The glyphs formed by 'half' are Chillus. We want to position + * matra after them all. + */ + if (buffer->props.script != HB_SCRIPT_MALAYALAM) { - /* -> 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++; + while (new_pos > start && + !(is_one_of (info[new_pos], (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 + * not belong to the Matra itself! */ + if (is_halant_or_coeng (info[new_pos]) && + 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++; + } + else + new_pos = start; /* No move. */ + } + if (start < new_pos) + { /* Now go see if there's actually any matras... */ for (unsigned int i = new_pos; i > start; i--) if (info[i - 1].indic_position () == POS_PRE_M) diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt index 3072b0a..ffb408d 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt @@ -58,3 +58,4 @@ ള്‍ ള്യം ള്ള +ല്‍പ്പേ -- 2.7.4