From ba502dea1e81981f3893b5353400909bf60e354f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 23 Oct 2018 16:46:10 -0700 Subject: [PATCH] [morx] Fix cluster-merging when ligating Only merge when actual ligature happened. Fixes https://github.com/harfbuzz/harfbuzz/issues/1305 --- src/hb-aat-layout-morx-table.hh | 7 ++++--- test/shaping/data/in-house/Makefile.sources | 1 + .../data/in-house/fonts/TestMORXTwentyeight.ttf | Bin 0 -> 2660 bytes test/shaping/data/in-house/tests/aat-morx.tests | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 test/shaping/data/in-house/fonts/TestMORXTwentyeight.ttf create mode 100644 test/shaping/data/in-house/tests/aat-morx.tests diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index ff791cb7..c663fcc8 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -399,9 +399,6 @@ struct LigatureSubtable if (unlikely (!match_length)) return true; - /* TODO Only when ligation happens? */ - buffer->merge_out_clusters (match_positions[0], buffer->out_len); - unsigned int cursor = match_length; do { @@ -437,6 +434,7 @@ struct LigatureSubtable bool (action & LigActionLast)); if (action & (LigActionStore | LigActionLast)) { + const GlyphID &ligatureData = ligature[ligature_idx]; if (unlikely (!ligatureData.sanitize (&c->sanitizer))) return false; hb_codepoint_t lig = ligatureData; @@ -452,6 +450,9 @@ struct LigatureSubtable buffer->skip_glyph (); end--; } + + buffer->move_to (end + 1); + buffer->merge_out_clusters (match_positions[cursor], buffer->out_len); } action_idx++; diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources index 6e21ddd4..e5f105c7 100644 --- a/test/shaping/data/in-house/Makefile.sources +++ b/test/shaping/data/in-house/Makefile.sources @@ -1,5 +1,6 @@ TESTS = \ tests/aat-trak.tests \ + tests/aat-morx.tests \ tests/arabic-fallback-shaping.tests \ tests/arabic-feature-order.tests \ tests/arabic-like-joining.tests \ diff --git a/test/shaping/data/in-house/fonts/TestMORXTwentyeight.ttf b/test/shaping/data/in-house/fonts/TestMORXTwentyeight.ttf new file mode 100644 index 0000000000000000000000000000000000000000..edabb439cdc63fa958a8d2dee7ed44fa96ebfc22 GIT binary patch literal 2660 zcmb7GYiv|S6h1R|A1&`?yDdV6UGCDY+UIT`*fe4b)>j{}Ern3%y0l9d>9%!ukv0+H zk3s-Jimwn9qXt937z{`PksnrKgjOOk1c|W_L=;Ih#;63$-s?AW?_x3j(0em8XU?2+ z<~xr&cZdS26z_^Xjhdfi*WWZmuNaULxhY zXe8X}IC$?yter%wh=P&XYB>)2H#BcFmh8{>u}`4C2lKM--j1+!rL7)$Od_(w68ajEK)YNVZ9pbK@!-}4xjn@ zwb0b+-$_xfgF_cKZFS4>K=4&v*QZ%y{5*!ltm>q&kBT$p=e5v8i(FJeQ5vGd^eO$w%Gh)42peU;!a_T+ z-Qpv#ZYOej9G-a&kE5Nvu0>c>8|5RZiU99Sy^jDOZ<*BO65iluMxP5b7?OTJ%KQAqRthw#kp%qQR_HBG57+TOg$vSH&{4^iY z&OKONRd!W7QulCm4ZQa2fAB_Bg{V85D=RzTuXNdL>fF5YvWkj;KRd^sr!v>z#({?R z{MM?s4=jGYyE1a0x3!*c-n(V%p4`T%Q%=1fdv|4aR=p2!CFXs=oIws0zQ741t~}tB zF!{byM?U*z|H;ty!S&(YyHA|pBgYPI+nPGJYp2LOJZ8T@dm>T5;c=zkFx#b#GF2O6 z<$R>+a--fvT;x!}6w!4OdCFA;I4$pSF^8(K;oIw0v1WEv`<~ggTWqGbqiP?5Y*=80 ztU)_UR$2F6*qKhVNF|@F77=07q#1NyI>-ue1zf62QI&wj$bchY^$sReugdNCdm;(9 z24x0TXg5YjS5)o$ihn3lF~r)C1OdTFiC5$z^(8NWOZ)-t=oOI^Ed|F=mw#CEk(b$Y zKNTU8cM{`srF~7OXRgh~JR)C}5}5#|tTPj~?g?$K0jnVxHxic^)IMPKZDpm}q2XbH zZA@mdP!+iDFB6H}yG6SZI^OzX>E%XNfFO~@I2{nBN%%JIB@goCk&!XNG|#L+htG_T zPsBgSKiYrt)REK~AW(kVy&E}4KrUa#rXuY}PmGNj|vTl@LK1vVXZ!}MuPgN6$l&g`5(MWr*K zh%)w-i@;SXp`)>@)P&!~a?Ce?(*w=`#nwr@YjPDv513C!jh0}MpWuCHX)iqcD&{KyDYe=Rq7_d6??l8=OWqM<8a-*YZ^O6omv#67Es=DRsxXR-CV{Dnit&nQh)nl^m%y$9LpR1=aJ#VH zgm~27(MgzEqCyP+d*OQ=HX`G6?naupW2Mmas|G*ES|AbQLUUXs$Nq6E1E!4N2^x=i zpU{t?82{~=45mU}nuqVkNBN91g;|)D+GwRx6MDpo7OIu~LfJ36W0QdrP29W0E)4&3 z@i3f_;x8`N($9W(T1MP)aIZoWHxO|vc@AwW+Dq~tV1*T%eE+_j7?wD85wF0DbI*K1 hj=RRN=f&KVm$d2sTVOBH^^|Df8+eVi49cVle*qmPDpUXf literal 0 HcmV?d00001 diff --git a/test/shaping/data/in-house/tests/aat-morx.tests b/test/shaping/data/in-house/tests/aat-morx.tests new file mode 100644 index 00000000..4153091d --- /dev/null +++ b/test/shaping/data/in-house/tests/aat-morx.tests @@ -0,0 +1 @@ +../fonts/TestMORXTwentyeight.ttf::U+0041,U+0078,U+0045,U+0079,U+0044,U+0079,U+0079:[A_E_D=0+1394|x=0+529|y=0+510|y=5+510|y=6+510] -- GitLab