[subset] don't set lookup visited in closure_lookups_context_t::recurse.

- Lookup::closure_lookups also checks if the lookups visited and sets the lookup to visited. If we set visited in 'recurse' then Lookup::closure_lookups will fail to recurse into the children of the lookup.
- Also when copying ChainRule's skip LookupRecord's that point to lookups which aren't retained. This matches FontTool's behaviour.
This commit is contained in:
Garret Rieger 2020-11-04 11:05:22 -08:00 committed by Behdad Esfahbod
parent feeff5928b
commit 8f47dd5779
1 changed files with 11 additions and 5 deletions

View File

@ -146,7 +146,6 @@ struct hb_closure_lookups_context_t :
if (is_lookup_visited (lookup_index)) if (is_lookup_visited (lookup_index))
return; return;
set_lookup_visited (lookup_index);
nesting_level_left--; nesting_level_left--;
recurse_func (this, lookup_index); recurse_func (this, lookup_index);
nesting_level_left++; nesting_level_left++;
@ -2328,12 +2327,19 @@ struct ChainRule
| hb_map (mapping)); | hb_map (mapping));
const ArrayOf<LookupRecord> &lookupRecord = StructAfter<ArrayOf<LookupRecord>> (lookahead); const ArrayOf<LookupRecord> &lookupRecord = StructAfter<ArrayOf<LookupRecord>> (lookahead);
HBUINT16 lookupCount;
lookupCount = lookupRecord.len;
if (!c->copy (lookupCount)) return_trace (nullptr);
for (unsigned i = 0; i < (unsigned) lookupCount; i++) HBUINT16* lookupCount = c->embed (&(lookupRecord.len));
if (!lookupCount) return_trace (nullptr);
for (unsigned i = 0; i < lookupRecord.len; i++)
{
if (!lookup_map->has (lookupRecord[i].lookupListIndex))
{
(*lookupCount)--;
continue;
}
if (!c->copy (lookupRecord[i], lookup_map)) return_trace (nullptr); if (!c->copy (lookupRecord[i], lookup_map)) return_trace (nullptr);
}
return_trace (out); return_trace (out);
} }