From e6618f3bdf79a51f6fb270b468b653dc9cea5b57 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 5 Jan 2018 17:21:55 +0000 Subject: [PATCH] [khmer] Shave off some more from the grammar --- src/hb-ot-shape-complex-khmer-machine.rl | 9 ++----- src/hb-ot-shape-complex-khmer.cc | 34 ++---------------------- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/src/hb-ot-shape-complex-khmer-machine.rl b/src/hb-ot-shape-complex-khmer-machine.rl index d29edc00..7b9551ae 100644 --- a/src/hb-ot-shape-complex-khmer-machine.rl +++ b/src/hb-ot-shape-complex-khmer-machine.rl @@ -46,7 +46,6 @@ ZWNJ = 5; ZWJ = 6; M = 7; SM = 8; -VD = 9; A = 10; PLACEHOLDER = 11; DOTTEDCIRCLE = 12; @@ -60,22 +59,18 @@ z = ZWJ|ZWNJ; # is_joiner cn = c.ZWJ?.n?; matra_group = z{0,3}.M.N?.Coeng?; -syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}? VD{0,2}; +syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}?; halant_group = (z?.Coeng.(ZWJ.N?)?); final_halant_group = halant_group | Coeng.ZWNJ; halant_or_matra_group = (final_halant_group | (Coeng.ZWJ)? matra_group{0,4}) (Coeng (cn|V))?; -consonant_syllable = (cn.halant_group){0,4} cn halant_or_matra_group syllable_tail; -vowel_syllable = V.n? (ZWJ | (halant_group.cn){0,4} halant_or_matra_group syllable_tail); -standalone_cluster = (PLACEHOLDER | DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; +consonant_syllable = (c|V|PLACEHOLDER|DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; broken_cluster = n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; other = any; main := |* consonant_syllable => { found_syllable (consonant_syllable); }; - vowel_syllable => { found_syllable (vowel_syllable); }; - standalone_cluster => { found_syllable (standalone_cluster); }; broken_cluster => { found_syllable (broken_cluster); }; other => { found_syllable (non_khmer_cluster); }; *|; diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 1d42e469..be02bc0a 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -124,7 +124,7 @@ set_khmer_properties (hb_glyph_info_t &info) { pos = matra_position (pos); } - else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_Symbol)))) + else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol)))) { pos = POS_SMVD; } @@ -341,9 +341,6 @@ data_destroy_khmer (void *data) enum syllable_type_t { consonant_syllable, - vowel_syllable, - standalone_cluster, - symbol_cluster, broken_cluster, non_khmer_cluster, }; @@ -547,27 +544,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, } } -static void -initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, - hb_face_t *face, - hb_buffer_t *buffer, - unsigned int start, unsigned int end) -{ - /* We treat placeholder/dotted-circle as if they are consonants, so we - * should just chain. Only if not in compatibility mode that is... */ - - if (hb_options ().uniscribe_bug_compatible) - { - /* For dotted-circle, this is what Uniscribe does: - * If dotted-circle is the last glyph, it just does nothing. - * Ie. It doesn't form Reph. */ - if (buffer->info[end - 1].khmer_category() == OT_DOTTEDCIRCLE) - return; - } - - initial_reordering_consonant_syllable (plan, face, buffer, start, end); -} - static void initial_reordering_syllable (const hb_ot_shape_plan_t *plan, hb_face_t *face, @@ -577,17 +553,11 @@ initial_reordering_syllable (const hb_ot_shape_plan_t *plan, syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F); switch (syllable_type) { - case vowel_syllable: /* We made the vowels look like consonants. So let's call the consonant logic! */ + case broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */ case consonant_syllable: initial_reordering_consonant_syllable (plan, face, buffer, start, end); break; - case broken_cluster: /* We already inserted dotted-circles, so just call the standalone_cluster. */ - case standalone_cluster: - initial_reordering_standalone_cluster (plan, face, buffer, start, end); - break; - - case symbol_cluster: case non_khmer_cluster: break; } -- GitLab