Followup fix for 3f9e2dced2

During GSUB, if a ligation happens, subsequence context input matching
matches the new indexing.  During GPOS however, the indices never
change.  So just go one by one.

Fixes 'dist' positioning with mmrtext.ttf and the following sequence:

  U+1014,U+1039,U+1011,U+1014,U+1039,U+1011,U+1014,U+1039,U+1011

Reported by Jonathan Kew.
This commit is contained in:
Behdad Esfahbod 2013-07-18 16:29:50 -04:00
parent 2b78d67e9f
commit 8751de5083
1 changed files with 8 additions and 0 deletions

View File

@ -1009,6 +1009,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
unsigned int i = 0; unsigned int i = 0;
if (lookupCount && 0 == lookupRecord->sequenceIndex) if (lookupCount && 0 == lookupRecord->sequenceIndex)
{ {
unsigned int old_pos = c->buffer->idx;
/* Apply a lookup */ /* Apply a lookup */
bool done = c->recurse (lookupRecord->lookupListIndex); bool done = c->recurse (lookupRecord->lookupListIndex);
@ -1020,6 +1022,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
goto not_applied; goto not_applied;
else else
{ {
if (c->table_index == 1)
c->buffer->idx = old_pos + 1;
/* Reinitialize iterator. */ /* Reinitialize iterator. */
hb_apply_context_t::skipping_forward_iterator_t tmp (c, c->buffer->idx - 1, count - i); hb_apply_context_t::skipping_forward_iterator_t tmp (c, c->buffer->idx - 1, count - i);
tmp.set_syllable (syllable); tmp.set_syllable (syllable);
@ -1041,6 +1045,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
if (lookupCount && i == lookupRecord->sequenceIndex) if (lookupCount && i == lookupRecord->sequenceIndex)
{ {
unsigned int old_pos = c->buffer->idx;
/* Apply a lookup */ /* Apply a lookup */
bool done = c->recurse (lookupRecord->lookupListIndex); bool done = c->recurse (lookupRecord->lookupListIndex);
@ -1052,6 +1058,8 @@ static inline bool apply_lookup (hb_apply_context_t *c,
goto not_applied2; goto not_applied2;
else else
{ {
if (c->table_index == 1)
c->buffer->idx = old_pos + 1;
/* Reinitialize iterator. */ /* Reinitialize iterator. */
hb_apply_context_t::skipping_forward_iterator_t tmp (c, c->buffer->idx - 1, count - i); hb_apply_context_t::skipping_forward_iterator_t tmp (c, c->buffer->idx - 1, count - i);
tmp.set_syllable (syllable); tmp.set_syllable (syllable);