[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
diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl
index 2ac3e89..58ca8c8 100644
--- a/src/hb-ot-shape-complex-myanmar-machine.rl
+++ b/src/hb-ot-shape-complex-myanmar-machine.rl
@@ -61,6 +61,7 @@
ZWJ = 6;
ZWNJ = 5;
Ra = 16;
+P = 31;
j = ZWJ|ZWNJ; # Joiners
k = (Ra As H); # Kinzi
@@ -76,12 +77,14 @@
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 c25d4b3..25ba726 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -119,6 +119,7 @@
enum syllable_type_t {
consonant_syllable,
+ punctuation_cluster,
broken_cluster,
non_myanmar_cluster,
};
@@ -143,7 +144,8 @@
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 @@
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)
@@ -410,6 +416,16 @@
}
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,
hb_buffer_t *buffer HB_UNUSED,
@@ -429,6 +445,7 @@
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;
}