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
This commit is contained in:
Behdad Esfahbod 2018-10-11 20:45:00 -04:00
parent bdb53ca24a
commit bf8469be9a
3 changed files with 11 additions and 10 deletions

View File

@ -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);
}

View File

@ -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]