From bf8469be9a8932cc407b60daf4d494fef46e233b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 11 Oct 2018 20:45:00 -0400 Subject: [PATCH] Attach CursivePositioning backwards, not forward This is how Uniscribe does it. So, adjust. This is only relevant to fonts that apply cursive positioning from a contextual lookup. Fixes https://github.com/harfbuzz/harfbuzz/issues/1181 --- src/hb-ot-layout-gpos-table.hh | 20 +++++++++--------- ...c3e6960b3520e5304033ef5fd540285f72f14d.ttf | Bin 0 -> 2380 bytes .../in-house/tests/cursive-positioning.tests | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 test/shaping/data/in-house/fonts/9fc3e6960b3520e5304033ef5fd540285f72f14d.ttf diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 746c24621..8b20c150c 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -973,22 +973,22 @@ struct CursivePosFormat1 hb_buffer_t *buffer = c->buffer; const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)]; - if (!this_record.exitAnchor) return_trace (false); + if (!this_record.entryAnchor) return_trace (false); hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input; skippy_iter.reset (buffer->idx, 1); - if (!skippy_iter.next ()) return_trace (false); + if (!skippy_iter.prev ()) return_trace (false); - const EntryExitRecord &next_record = entryExitRecord[(this+coverage).get_coverage (buffer->info[skippy_iter.idx].codepoint)]; - if (!next_record.entryAnchor) return_trace (false); + const EntryExitRecord &prev_record = entryExitRecord[(this+coverage).get_coverage (buffer->info[skippy_iter.idx].codepoint)]; + if (!prev_record.exitAnchor) return_trace (false); - unsigned int i = buffer->idx; - unsigned int j = skippy_iter.idx; + unsigned int i = skippy_iter.idx; + unsigned int j = buffer->idx; buffer->unsafe_to_break (i, j); float entry_x, entry_y, exit_x, exit_y; - (this+this_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y); - (this+next_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y); + (this+prev_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y); + (this+this_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y); hb_glyph_position_t *pos = buffer->pos; @@ -1035,7 +1035,7 @@ struct CursivePosFormat1 * parent. * * Optimize things for the case of RightToLeft, as that's most common in - * Arabinc. */ + * Arabic. */ unsigned int child = i; unsigned int parent = j; hb_position_t x_offset = entry_x - exit_x; @@ -1064,7 +1064,7 @@ struct CursivePosFormat1 else pos[child].x_offset = x_offset; - buffer->idx = j; + buffer->idx++; return_trace (true); } diff --git a/test/shaping/data/in-house/fonts/9fc3e6960b3520e5304033ef5fd540285f72f14d.ttf b/test/shaping/data/in-house/fonts/9fc3e6960b3520e5304033ef5fd540285f72f14d.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1841cf37b96ac419d0f226e537d89d38647690a9 GIT binary patch literal 2380 zcmbVOT})eL7=FHU+VV5RKo}bY*^weJ!#Y-Isgq;_p@70bI@}}+(m_XY{j+of;-V(Q zxhz|p3DFCect@5QjW?QTVq$_>j3#=sxJ11$#u(g{nt3_v^M2=a;8?Q6^X2`%_y6yE z&uO6mJcQR^Vzj@vFN_*u@Z`v??;jnBoc-qV52RNBb)!Er-g9Q@Uu8fnOB0VshSUU0c#pRcX|3r8t9*fRYRW zyfL24Ef$UA1JYlT-kC^GNAU(ulRiVbJQ-cgpg}!C`WR^|6-~y*lGCp;-c`WNWzzGx zFY4b~X1;Zlk3*q>GQ+rxBA~s(8+dfPw_^Re`uV!?bU1wH6G^-#e_K6)KUwuopfk{3 zw4+@!4Jzw(AkFN9PSELJ3U|hoUMk6~j#@pjlIK`g}`D*Uh@+EhEb)B~(h>r7k;8MS< z4BTwR1>-2W&)BD$gkLq1yUlHyF4HhvVxjNZF^vokSvZ*IMy>I^gM09}@dutl8W}7hi#g09jvVuD!8CUB^rH>?5JD^Q2nI34 za}X)&#HgP_l-L~Y1xsiv{aTNKFf@k=rc~A7VCLXx7u_jcIW(?@D5scGhQ0UnYZ+Fi5{hsN$pws zD&DhLl6x+fSZoT!5ob2h@$m%)fnx%Jp zIxWtzk8hkz^Hwi~y7t^tne)2mKV}B^dpvw$4P`2qax0JL)V^T2ty>>~PJM*J+k_eD z^rbVglzZaHp`M8NQ3U%NVB;Qn@45IEbJ@I7PEHuAH#~G0#r$rlNO;&nCBW~j*3u_G z1t(+K6w38prETR~Bfi{>(aMUJ@fWFL@(3zU{3!j*a2HU9SADukK0rJ~d5FIU0!p0| zf9hH88(tcSS5jJ!Mh%j+XsxP2UBRNZSY$-`1ede-12{$-p>E-}UJBomqxhYZCBFwE zH}N%Ya4CF9&W2RJhacfHa#je!7j1xM*fbWu;LlM}qfNnE&lr*&`*4EI`S zBQVDEdFCiplR!_JxB(2--=mH nuj5zdqJ>aQT4shbttsh_;vFlQ0pdaxCR8w6OX*)>p_$jei=k4e literal 0 HcmV?d00001 diff --git a/test/shaping/data/in-house/tests/cursive-positioning.tests b/test/shaping/data/in-house/tests/cursive-positioning.tests index 74d283db8..15a1ffc9c 100644 --- a/test/shaping/data/in-house/tests/cursive-positioning.tests +++ b/test/shaping/data/in-house/tests/cursive-positioning.tests @@ -2,3 +2,4 @@ ../fonts/298c9e1d955f10f6f72c6915c3c6ff9bf9695cec.ttf::U+0643,U+0645,U+0645,U+062B,U+0644:[gid8=4+738|gid5=3@441,1197+0|gid6=3@0,432+405|gid9=2@0,477+500|gid9=1@0,577+452|gid10=0@20,1177+207] #../fonts/706c5d7b625f207bc0d874c67237aad6f1e9cd6f.ttf::U+0B1F,U+0B4D,U+0B1A,U+0B4D,U+0B1A:[ttaorya=0+1307|casubscriptorya=0@-242,104+-231|casubscriptnarroworya=0@20,104+507] ../fonts/07f054357ff8638bac3711b422a1e31180bba863.ttf:--font-funcs=ot --no-glyph-names:U+0606,U+06E1:[2=0@40,502+0|1=0+1000] +../fonts/9fc3e6960b3520e5304033ef5fd540285f72f14d.ttf::U+16F0A,U+16F57,U+16F8F:[u16F0A=0+422|u16F57=0@0,209+338|u16F8F=0+0]