From fa48ccbe127a2e61ab316f3638e4056940964dae Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 12 Oct 2017 14:07:37 +0200 Subject: [PATCH] [indic] Special-case Kannada Ra,H,ZWJ sequence Fixes https://github.com/behdad/harfbuzz/issues/435 --- src/hb-ot-shape-complex-indic.cc | 15 +++++++++++++++ test/shaping/Makefile.am | 1 + .../3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf | Bin 0 -> 2984 bytes test/shaping/tests/indic-special-cases.tests | 3 +++ 4 files changed, 19 insertions(+) create mode 100644 test/shaping/fonts/sha1sum/3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf create mode 100644 test/shaping/tests/indic-special-cases.tests diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 31dc1c0eb..e520f38f4 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -691,6 +691,21 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; hb_glyph_info_t *info = buffer->info; + /* https://github.com/behdad/harfbuzz/issues/435#issuecomment-335560167 + * // For compatibility with legacy useage in Kannada, + * // Ra+h+ZWJ must behave like Ra+ZWJ+h... + */ + if (buffer->props.script == HB_SCRIPT_KANNADA && + start + 3 <= end && + is_one_of (info[start ], FLAG (OT_Ra)) && + is_one_of (info[start+1], FLAG (OT_H)) && + is_one_of (info[start+2], FLAG (OT_ZWJ))) + { + buffer->merge_clusters (start+1, start+3); + hb_glyph_info_t tmp = info[start+1]; + info[start+1] = info[start+2]; + info[start+2] = tmp; + } /* 1. Find base consonant: * diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index ecb836db9..f788d42b7 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -61,6 +61,7 @@ TESTS = \ tests/indic-joiners.tests \ tests/indic-old-spec.tests \ tests/indic-pref-blocking.tests \ + tests/indic-special-cases.tests \ tests/indic-syllable.tests \ tests/language-tags.tests \ tests/ligature-id.tests \ diff --git a/test/shaping/fonts/sha1sum/3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf b/test/shaping/fonts/sha1sum/3cae6bfe5b57c07ba81ddbd54c02fe4f3a1e3bf6.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2cacb68166ceaa6b12174666c8cd06a03115b95f GIT binary patch literal 2984 zcmZuzeQ*=k5#RT8`mm6U9e+`VQcE(D!2}b@k~|b6*FzDq0DoZ$1qTacBaH9|wy{Y_ z!NjLX%+Aq%_2&fu>Vt(s2WBJ4q+h49zrY8M{q@q|;9Ghf^lRjqFo*-$}?0 zzMHqV``*6Y-|pMJJ755i42MAlwcgd=T>}fj0H9ldvkScCWmVqxf)ywiqI}O=Rb8_7 zk1HYoNy`CvXIWLgz30VadH~HNuGj9|8)z=JYiaJhaKmvDn4kM&j#N0 zm3?*R!-*eXVHcccxrFa*2s@7+-B{^6`%2GqXI|>-JJWwfbc^qEb+dT-?Q zH|qEa+sXpRK&Hp}QW%8>%Z7qimwe0VfG>EYpG2TLq3m_L36Gj3jS*}*yBlZVsczAhdqmlj9@~n z7Vi1pw(92j?xBmP4)?t(zsYK?H=aMrv@4j+gJ8>0BKoTTdE~hYjfM&S?;VwX{yp&{=x8||JE)4#~=IU z7xT*1d1JoU{ukA-*L-6)ePd&#?e|Xc{~}Z<0g(1c4VXJ%=46ftGaZf$i^2-dipT77 z6J5m}rVL)b`{1U$qQ`#l**k%j@+ECuM*YC~Eo;_SR1`jTp`R~PUDMf$9j0Vb{ zyvFM(DP`MQu!W}7=vjhyW0`vh(#W^No+Ao3BOOd;n>x+ro_hG%(=sz|c)Cu0L4NC} zzhsebB>h(2YQ22!@uu}Xzy41Y^4{iMEe@qawE1}Q1>gZcT6^H^vnY~Td&WIWU9f2Z zYyLW;Mp9J|G?7a7NZV%=&g5IMPMTgp%r#3-+1Z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