From 55f70ebfb95083f515d9b0044a2a65ab11484bb5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Jul 2012 12:50:13 -0400 Subject: [PATCH] [Indic] Position final subjoined consonants (and vowels) after matras In Khmer, a final subjoined consonant or independent vowel can occur after matras. This final subjoined thing should NOT be reordered to before the matra even though it's subjoined. Fixes another 1k of the Khmer failures. Not much left really. --- src/hb-ot-shape-complex-indic-private.hh | 1 + src/hb-ot-shape-complex-indic.cc | 13 +++++++++++++ .../south-east-asian/script-khmer/misc/misc.txt | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh index 91e288ff6..0fe350f0f 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic-private.hh @@ -75,6 +75,7 @@ enum indic_position_t { POS_BELOW_M, POS_POST_C, POS_POST_M, + POS_FINAL_C, POS_SMVD }; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 8e738db5b..18a36990b 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -429,8 +429,21 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff for (unsigned int i = start; i < base; i++) info[i].indic_position() = POS_PRE_C; + info[base].indic_position() = POS_BASE_C; + /* Mark final consonants. A final consonant is one appearing after a matra, + * like in Khmer. */ + for (unsigned int i = base + 1; i < end; i++) + if (info[i].indic_category() == OT_M) { + for (unsigned int j = i + 1; j < end; j++) + if (is_consonant (info[j])) { + info[j].indic_position() = POS_FINAL_C; + break; + } + break; + } + /* Handle beginning Ra */ if (has_reph) info[start].indic_position() = POS_RA_TO_BECOME_REPH; 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 b305cb8cb..5a354b2a5 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 @@ -8,3 +8,5 @@ រ៍ សៅ រ្ឥ +ងឹ្ឈ +ង្ឈឹ