From ddce2d8df6fed9c033f1f13e235666680c5beb67 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Oct 2013 18:07:11 +0200 Subject: [PATCH] [indic] Improve positioning of post-base bells and whistles Bug 58714 - Kannada u+0cb0 u+200d u+0ccd u+0c95 u+0cbe does not provide same results as Windows8 https://bugs.freedesktop.org/show_bug.cgi?id=58714 Test with U+0CB0,U+200D,U+0CCD,U+0C95,U+0CBF and tunga.ttf. Improves some scripts. Improves Bengali too, but numbers are up because we produce better results than Uniscribe for some sequences now. New numbers: BENGALI: 353724 out of 354188 tests passed. 464 failed (0.131004%) DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%) GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%) GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%) KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%) KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%) MALAYALAM: 1048140 out of 1048334 tests passed. 194 failed (0.0185056%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%) TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) --- src/hb-ot-shape-complex-indic.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index f30e593ed..8265a5840 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -962,18 +962,19 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, } } } - /* Re-attach ZWJ, ZWNJ, and halant to next char, for after-base consonants. */ + /* For post-base consonants let them own anything before them + * since the last consonant or matra. */ { - unsigned int last_halant = end; + unsigned int last = base; for (unsigned int i = base + 1; i < end; i++) - if (is_halant_or_coeng (info[i])) - last_halant = i; - else if (is_consonant (info[i])) { - for (unsigned int j = last_halant; j < i; j++) - if (info[j].indic_position() != POS_SMVD) + if (is_consonant (info[i])) + { + for (unsigned int j = last + 1; j < i; j++) + if (info[j].indic_position() < POS_SMVD) info[j].indic_position() = info[i].indic_position(); - last_halant = end; - } + last = i; + } else if (info[i].indic_category() == OT_M) + last = i; }