From d90b8e841e0068a601c96ab184d18b0f48eec9d1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Jul 2012 02:10:20 -0400 Subject: [PATCH] [Indic] Reposition Khmer prebase-reordering Ra around split matras In Khmer coeng model, a V,Ra can go *after* matras. If it goes after a split matra, it should be reordered to *before* the left part of such matra. Khmer failures down from 136 to 39 (0.0130381%). --- src/hb-ot-shape-complex-indic.cc | 13 +++++++++++++ .../south-east-asian/script-khmer/misc/misc.txt | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 0c132998a..20a2ad0b6 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1135,6 +1135,19 @@ final_reordering_syllable (hb_buffer_t *buffer, !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS))) new_pos--; + /* In Khmer coeng model, a V,Ra can go *after* matras. If it goes after a + * split matra, it should be reordered to *before* the left part of such matra. */ + if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) + { + unsigned int old_pos = i; + for (unsigned int i = base + 1; i < old_pos; i++) + if (info[i].indic_category() == OT_M) + { + new_pos--; + break; + } + } + if (new_pos > start && is_halant_or_coeng (info[new_pos - 1])) /* -> If ZWJ or ZWNJ follow this halant, position is moved after it. */ if (new_pos < end && is_joiner (info[new_pos])) diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt index 317a79cf6..aa76bc50d 100644 --- a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-khmer/misc/misc.txt @@ -16,3 +16,7 @@ ម‌៉្លេះ ប៊័ នែ៎ +កេ្រ +កៀ្រ +កោ្រ +កៅ្រ