diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 33215a304..be5d574bf 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -921,14 +921,32 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, info[start].indic_position() = POS_RA_TO_BECOME_REPH; /* For old-style Indic script tags, move the first post-base Halant after - * last consonant. Only do this if there is *not* a Halant after last - * consonant. Otherwise it becomes messy. */ - if (indic_plan->is_old_spec) { + * last consonant. + * + * Reports suggest that in some scripts Uniscribe does this only if there + * is *not* a Halant after last consonant already (eg. Kannada), while it + * does it unconditionally in other scripts (eg. Malayalam). We don't + * currently know about other scripts, so we single out Malayalam for now. + * + * Kannada test case: + * U+0C9A,U+0CCD,U+0C9A,U+0CCD + * With some versions of Lohit Kannada. + * https://bugs.freedesktop.org/show_bug.cgi?id=59118 + * + * Malayalam test case: + * U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D + * With lohit-ttf-20121122/Lohit-Malayalam.ttf + */ + if (indic_plan->is_old_spec) + { + bool disallow_double_halants = buffer->props.script != HB_SCRIPT_MALAYALAM; for (unsigned int i = base + 1; i < end; i++) - if (info[i].indic_category() == OT_H) { + if (info[i].indic_category() == OT_H) + { unsigned int j; for (j = end - 1; j > i; j--) - if (is_consonant (info[j]) || info[j].indic_category() == OT_H) + if (is_consonant (info[j]) || + (disallow_double_halants && info[j].indic_category() == OT_H)) break; if (info[j].indic_category() != OT_H && j > i) { /* Move Halant to after last consonant. */ diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index 4cc79b8f3..c2c4db69e 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -38,6 +38,7 @@ CLEANFILES += \ TESTS = \ tests/arabic-feature-order.tests \ tests/context-matching.tests \ + tests/indic-old-spec.tests \ tests/indic-pref-blocking.tests \ tests/mongolian-variation-selector.tests \ $(NULL) diff --git a/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf b/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf new file mode 100644 index 000000000..fc2264917 Binary files /dev/null and b/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf differ diff --git a/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf b/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf new file mode 100644 index 000000000..746fc6038 Binary files /dev/null and b/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf differ diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST index cd2ede5ed..4aaa54d57 100644 --- a/test/shaping/fonts/sha1sum/MANIFEST +++ b/test/shaping/fonts/sha1sum/MANIFEST @@ -1,6 +1,8 @@ 226bc2deab3846f1a682085f70c67d0421014144.ttf +270b89df543a7e48e206a2d830c0e10e5265c630.ttf 37033cc5cf37bb223d7355153016b6ccece93b28.ttf 4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf +57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf 813c2f8e5512187fd982417a7fb4286728e6f4a8.ttf 8a9fea2a7384f2116e5b84a9b31f83be7850ce21.ttf a919b33197965846f21074b24e30250d67277bce.ttf diff --git a/test/shaping/tests/MANIFEST b/test/shaping/tests/MANIFEST index 1b577c7cc..a792e91bd 100644 --- a/test/shaping/tests/MANIFEST +++ b/test/shaping/tests/MANIFEST @@ -1,4 +1,5 @@ arabic-feature-order.tests context-matching.tests +indic-old-spec.tests indic-pref-blocking.tests mongolian-variation-selector.tests diff --git a/test/shaping/tests/indic-old-spec.tests b/test/shaping/tests/indic-old-spec.tests new file mode 100644 index 000000000..96e8cdd3e --- /dev/null +++ b/test/shaping/tests/indic-old-spec.tests @@ -0,0 +1,2 @@ +fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf:U+0C9A,U+0CCD,U+0C9A,U+0CCD:[U0C9A_U0CCD.haln=0+1066|U0C9A_0CCD.blwf=0+0] +fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf:U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D:[glyph201=0+1183|U0D4D=0+0] diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt index c5144f0fa..2e732ae8d 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt @@ -62,3 +62,4 @@ ശിം‌ കോം‌ യ‍്യ +സ്റ്റ്