From 9174a9db5c4e01284143ed8bd318ce9454535987 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 25 Nov 2013 18:10:38 -0500 Subject: [PATCH] [myanmar] Allow punctuation clusters The spec and Uniscribe don't allow these, but UTN#11 specifically says the sequence U+104B,U+1038 is valid. As such, allow all "P V" sequences. There's about eight sequences that match that structure, but Roozbeh thinks it's fine to allow all of them. Test case: U+104B, U+1038 https://bugs.freedesktop.org/show_bug.cgi?id=71947 --- src/hb-ot-shape-complex-myanmar-machine.rl | 3 +++ src/hb-ot-shape-complex-myanmar.cc | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl index 2ac3e8904..58ca8c822 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/src/hb-ot-shape-complex-myanmar-machine.rl @@ -61,6 +61,7 @@ VS = 30; ZWJ = 6; ZWNJ = 5; Ra = 16; +P = 31; j = ZWJ|ZWNJ; # Joiners k = (Ra As H); # Kinzi @@ -76,12 +77,14 @@ complex_syllable_tail = As* medial_group main_vowel_group post_vowel_group* pwo_ syllable_tail = (H | complex_syllable_tail); consonant_syllable = k? (c|IV|D|GB).VS? (H (c|IV).VS?)* syllable_tail; +punctuation_cluster = P V; broken_cluster = k? VS? syllable_tail; other = any; main := |* consonant_syllable => { found_syllable (consonant_syllable); }; j => { found_syllable (non_myanmar_cluster); }; + punctuation_cluster => { found_syllable (punctuation_cluster); }; broken_cluster => { found_syllable (broken_cluster); }; other => { found_syllable (non_myanmar_cluster); }; *|; diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index c25d4b3f8..25ba7264c 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -119,6 +119,7 @@ override_features_myanmar (hb_ot_shape_planner_t *plan) enum syllable_type_t { consonant_syllable, + punctuation_cluster, broken_cluster, non_myanmar_cluster, }; @@ -143,7 +144,8 @@ enum myanmar_category_t { OT_VBlw = 27, OT_VPre = 28, OT_VPst = 29, - OT_VS = 30 /* Variation selectors */ + OT_VS = 30, /* Variation selectors */ + OT_P = 31 /* Punctuation */ }; @@ -247,6 +249,10 @@ set_myanmar_properties (hb_glyph_info_t &info) case 0x108F: case 0x109A: case 0x109B: case 0x109C: cat = (indic_category_t) OT_SM; break; + + case 0x104A: case 0x104B: + cat = (indic_category_t) OT_P; + break; } if (cat == OT_M) @@ -409,6 +415,16 @@ initial_reordering_broken_cluster (const hb_ot_shape_plan_t *plan, initial_reordering_consonant_syllable (plan, face, buffer, start, end); } +static void +initial_reordering_punctuation_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, + hb_face_t *face HB_UNUSED, + hb_buffer_t *buffer HB_UNUSED, + unsigned int start HB_UNUSED, unsigned int end HB_UNUSED) +{ + /* Nothing to do right now. If we ever switch to using the output + * buffer in the reordering process, we'd need to next_glyph() here. */ +} + static void initial_reordering_non_myanmar_cluster (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_face_t *face HB_UNUSED, @@ -429,6 +445,7 @@ 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 consonant_syllable: initial_reordering_consonant_syllable (plan, face, buffer, start, end); return; + case punctuation_cluster: initial_reordering_punctuation_cluster (plan, face, buffer, start, end); return; case broken_cluster: initial_reordering_broken_cluster (plan, face, buffer, start, end); return; case non_myanmar_cluster: initial_reordering_non_myanmar_cluster (plan, face, buffer, start, end); return; }