From fc0daafab0336b847ac14682e581a8838f36a0bf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Jul 2014 16:48:51 -0400 Subject: [PATCH] [indic] Handle old-spec Malayalam reordering with final Halant See comment. Micro-tests added. --- src/hb-ot-shape-complex-indic.cc | 28 ++++++++++++++---- test/shaping/Makefile.am | 1 + ...0b89df543a7e48e206a2d830c0e10e5265c630.ttf | Bin 0 -> 3428 bytes ...a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf | Bin 0 -> 2272 bytes test/shaping/fonts/sha1sum/MANIFEST | 2 ++ test/shaping/tests/MANIFEST | 1 + test/shaping/tests/indic-old-spec.tests | 2 ++ .../indic/script-malayalam/misc/misc.txt | 1 + 8 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf create mode 100644 test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf create mode 100644 test/shaping/tests/indic-old-spec.tests 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 0000000000000000000000000000000000000000..fc2264917ab9274c6ffdf390751b15247f82fd74 GIT binary patch literal 3428 zcmbtWdu&tJ8UN0)<0MYZk`QbsbBq(?ykk3l#d+CI@FONpFc2qkfH=;>aYqam34v^Z zrDe2(l`4G*^&ypJYUw|1m2MLv(uUB6R>UY`T3dCRHmw^|sfP9k-KrLid-t7tO_IXU zr1c~|_x!$d&Ue1Y?|k`utD;dVstmDAfkS+jqexkRyH(aeiP|q_cNp z_lJmI2Ot->?=o4w_#&qRAm<9s_m8FGX+@~?7C^2Jv3G2CMko8b(vJ88#Ag!e$<&*_ zAATP3IO6fi_;i}*L4x|yh;t^V<`Uk|46UeJ10cJdoQRL#3myIlr#v|CNTML;Cz78c z#`9rIGBtCgd>C#bX7<)k9TZ zr4LNcXtv&2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57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf b/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf new file mode 100644 index 0000000000000000000000000000000000000000..746fc60389ae04addd0c58c9416b15ac2743e477 GIT binary patch literal 2272 zcmb_cYfO_@7=F+B+Ct@43N5rH<)fvgg;KGl735a1EhvbLi_u-s%B>rv5JYs&AO3Jz zvS?hUKa6pX#2A+>G0ZFrSs<2R1jrml zyk}$IO5fiO`WJvY6Y-{@iP%(*KKml#ZHOC(W@kjxXwEJGO*Z0-qf=uOr>_kjM*VTb z!(*`>Q;dOt_Gb`hjwN0nJ^Ze=AApnq2tDzU*zoh_Vn-CvBoIMfSJq4%8AmRjKF&Uc}5m>f}{_yqDsmUEP2YZhb$n_i+<m(C;(y<+-@Y$SwGluGU#a0)%yUzfo+rm}(vFhU%TQ zCd+uIcfe#C@J5F`u2P%TSYTeE?bhjf>Kgi8PMgCk)Ma|p-R&l4pueG^KT?C1 zc%&2zBto_H4#r%8kv?+I;P5vSbe{*pLsBBaK%0m?K>SwOe694;b;q1u`@pN(J1GCn|6#odaHqC&PSBIdUyo%jGETblBG0A1g;k zI%PnZF?E|b*j3no99*W=Q>@CR|KXHODJ)ri!wA71%*vj-d0;P zvdkIiUS+pdR$BX!Yb&&^IoMjuboo8?uD1OAXjQOF8nvu3m-zL%qP(n(Ty=%cmWL#C zi7h@~q0!n@Rn_E+u4>hEX|uM%gZYxHJoSstx=OQ;I9Ek1R5cP zBV@wEHUno!GxK^e1B4=EbkxONVRDX2*08t6Zs@JL4;xY zC-jo-U{FdAYN{?oJ@DHb} z{3f7cUuYk`SYq4q_6-}u>mUT+xTKsR?5F2Y$759*n&5976r$v_h4|LGu-9NufMy@d zzKpLRDE-~ByMg7sA+=g1Q1Hw~#CgFHvB%=Y_V~7NwdWyLpeQb|&+GIbg-Ecj+9Qhd zp*sCM3G&Hm51Eh7itV^F8jFjYxgmSqJazB|BXwJy#Lf#&c2_Xb9(J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