From 81e2b9b8a959cb7d7503f58fca70761238697fc1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 15 Oct 2017 10:48:19 +0200 Subject: [PATCH] Never skip over CGJ We might want to tweak this some more. For now, never skipping over it is better behavior than always skipping. Part of https://github.com/behdad/harfbuzz/issues/554 --- src/hb-ot-layout-private.hh | 19 ++++++++++-------- ...962d3202883a820aed019d9b5c1838c2ff69c6.ttf | Bin 0 -> 2468 bytes test/shaping/tests/default-ignorables.tests | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 test/shaping/fonts/sha1sum/bf962d3202883a820aed019d9b5c1838c2ff69c6.ttf diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 6717adeb..eb8cc308 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -226,7 +226,9 @@ _next_syllable (hb_buffer_t *buffer, unsigned int start) * - General_Category: 5 bits. * - A bit each for: * * Is it Default_Ignorable(); we have a modified Default_Ignorable(). - * * Whether it's one of the three Mongolian Free Variation Selectors. + * * Whether it's one of the three Mongolian Free Variation Selectors, + * CGJ, or other characters that are hidden but should not be ignored + * like most other Default_Ignorable()s do during matching. * * One free bit right now. * * The high-byte has different meanings, switched by the Gen-Cat: @@ -264,20 +266,21 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; props |= UPROPS_MASK_IGNORABLE; if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ; - if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ; + else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ; /* Mongolian Free Variation Selectors need to be remembered * because although we need to hide them like default-ignorables, * they need to non-ignorable during shaping. This is similar to * what we do for joiners in Indic-like shapers, but since the * FVSes are GC=Mn, we have use a separate bit to remember them. * Fixes: - * https://github.com/behdad/harfbuzz/issues/234 - */ - if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN; + * https://github.com/behdad/harfbuzz/issues/234 */ + else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN; /* TAG characters need similar treatment. Fixes: - * https://github.com/behdad/harfbuzz/issues/463 - */ - if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN; + * https://github.com/behdad/harfbuzz/issues/463 */ + else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN; + /* COMBINING GRAPHEME JOINER should not be skipped; at least some times. + * https://github.com/behdad/harfbuzz/issues/554 */ + else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN; } else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat))) { diff --git a/test/shaping/fonts/sha1sum/bf962d3202883a820aed019d9b5c1838c2ff69c6.ttf b/test/shaping/fonts/sha1sum/bf962d3202883a820aed019d9b5c1838c2ff69c6.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4cf9a3220803de3fa48189b8754c51a36a2747ec GIT binary patch literal 2468 zcmah~du&tJ8UN0?4?DKw^PyJA>?IfQ9K}{umQo&gM`FMh)sEH z603x0X~i~a5=GfiD}>svMMZ;7i&XV7snUkjNgZlCt=lp!leVs6Wt}>0JYw&6u9MKM zf9zh}bI$KO=ljn0zQl;gO5Y}l4kmhf`*;^WM`Sn->Y2n>le_jV4%{R%0@6o`U0>@u zw*ACkfqw`5i{!3I^MymX^F+!^zz2sisTtb>d5BcO&~qr2ogo8WGE4$n4o#jIy`$#d z#`+eK^zqn8YPfuE{XX#9L5q)p;CfsAJ@9E@-&iJhJa~%k0dEIxo17j>sfU$$BKdP* zcP4dwhWh1~f!_!AOrhe7zeh6lES;9G@Of&aFh!^d zlKp`&Z;5r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iai5P%7|I< zKT)bn6NVGN=gIl4<2V=cunirN(M6ugW|@rql-XF?nvB9@v>rJ)}(2tF_1 zq}b(|)a(RVGZUE!5`XEUW%IAN*qh|seXqsV^J@2&!UUb=|!ob&|7r=+vkH)7uobP<0} zM$`BQGTMiJRMgc3s}B;_ZL?0Ma#OH%#X>O)JH#C*+o7S%3{{CVAdd(r`9%c9-vXz^ zQ;dt?5Nn~I36;`E1G>bb4Q}k3bbW;O96Q1rVkKg};(fs{eC7p3$Sxwger5%!Ixi#T EKMMZQZ2$lO literal 0 HcmV?d00001 diff --git a/test/shaping/tests/default-ignorables.tests b/test/shaping/tests/default-ignorables.tests index 2d3ce975..66ee7611 100644 --- a/test/shaping/tests/default-ignorables.tests +++ b/test/shaping/tests/default-ignorables.tests @@ -1 +1,2 @@ fonts/sha1sum/051d92f8bc6ff724511b296c27623f824de256e9.ttf::U+0075,U+0361,U+034F,U+0301,U+0069:[gid2=0+1266|gid7=0@-617,442+0|gid5=0@-7,0+0|gid1=4+528] +fonts/sha1sum/bf962d3202883a820aed019d9b5c1838c2ff69c6.ttf::U+0020,U+06CC,U+064E,U+034F,U+0651:[uni0651=1+0|space=1+0|uni064E=1@236,-432+0|uni06CC=1+1266|space=0+452] -- GitLab