diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh index e97fca9d9..ac117326c 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic-private.hh @@ -269,6 +269,8 @@ static const hb_codepoint_t ra_chars[] = { 0x0CB0, /* Kannada */ 0x0D30, /* Malayalam */ /* No Reph, Logical Repha */ + 0x0DBB, /* Sinhala */ /* Reph formed only with ZWJ */ + 0x179A, /* Khmer */ /* No Reph, Visual Repha */ }; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 9b5b499fc..fa88d2e9b 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -356,9 +356,14 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff start + 3 <= end && info[start].indic_category() == OT_Ra && info[start + 1].indic_category() == OT_H && - !is_joiner (info[start + 2])) + (unlikely (buffer->props.script == HB_SCRIPT_SINHALA) ? + info[start + 2].indic_category() == OT_ZWJ /* In Sinhala, form Reph only if ZWJ is present */: + !is_joiner (info[start + 2] /* In other scripts, any joiner blocks Reph formation */ ) + )) { limit += 2; + while (limit < end && is_joiner (info[limit])) + limit++; base = start; has_reph = true; }; diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST index 29cfb2f28..3c2a4fb51 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/MANIFEST @@ -1 +1,2 @@ misc.txt +reph.txt diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/reph.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/reph.txt new file mode 100644 index 000000000..f5f2f531f --- /dev/null +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/reph.txt @@ -0,0 +1,3 @@ +ර්ධ +ර්‍ධ +ර්‌ධ