[subset] fox for (Chain)ContextFormat3: subset lookupRecord
skip copying a lookupRecord if lookup referenced in the lookupRecord is not retained after subset
This commit is contained in:
parent
838d670752
commit
37379f8f7d
|
@ -1618,7 +1618,14 @@ struct Rule
|
|||
const UnsizedArrayOf<LookupRecord> &lookupRecord = StructAfter<UnsizedArrayOf<LookupRecord>>
|
||||
(inputZ.as_array ((inputCount ? inputCount - 1 : 0)));
|
||||
for (unsigned i = 0; i < (unsigned) lookupCount; i++)
|
||||
{
|
||||
if (!lookup_map->has (lookupRecord[i].lookupListIndex))
|
||||
{
|
||||
out->lookupCount--;
|
||||
continue;
|
||||
}
|
||||
c->copy (lookupRecord[i], lookup_map);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
@ -2234,7 +2241,14 @@ struct ContextFormat3
|
|||
const LookupRecord *lookupRecord = &StructAfter<LookupRecord> (coverageZ.as_array (glyphCount));
|
||||
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
|
||||
for (unsigned i = 0; i < (unsigned) lookupCount; i++)
|
||||
{
|
||||
if (!lookup_map->has (lookupRecord[i].lookupListIndex))
|
||||
{
|
||||
out->lookupCount--;
|
||||
continue;
|
||||
}
|
||||
c->serializer->copy (lookupRecord[i], lookup_map);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
@ -3303,13 +3317,21 @@ struct ChainContextFormat3
|
|||
return_trace (false);
|
||||
|
||||
const Array16Of<LookupRecord> &lookupRecord = StructAfter<Array16Of<LookupRecord>> (lookahead);
|
||||
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
|
||||
hb_set_t lookup_indices;
|
||||
for (unsigned i = 0; i < (unsigned) lookupRecord.len; i++)
|
||||
if (lookup_map->has (lookupRecord[i].lookupListIndex))
|
||||
lookup_indices.add (i);
|
||||
|
||||
HBUINT16 lookupCount;
|
||||
lookupCount = lookupRecord.len;
|
||||
lookupCount = lookup_indices.get_population ();
|
||||
if (!c->serializer->copy (lookupCount)) return_trace (false);
|
||||
|
||||
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
|
||||
for (unsigned i = 0; i < (unsigned) lookupCount; i++)
|
||||
if (!c->serializer->copy (lookupRecord[i], lookup_map)) return_trace (false);
|
||||
for (unsigned i : lookup_indices.iter ())
|
||||
{
|
||||
if (!c->serializer->copy (lookupRecord[i], lookup_map))
|
||||
return_trace (false);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ EXTRA_DIST += \
|
|||
expected/layout.gdef-varstore \
|
||||
expected/layout.gdef-attachlist \
|
||||
expected/layout.notonastaliqurdu \
|
||||
expected/layout.tinos \
|
||||
expected/cmap \
|
||||
expected/cmap14 \
|
||||
expected/sbix \
|
||||
|
|
|
@ -31,6 +31,7 @@ TESTS = \
|
|||
tests/layout.khmer.tests \
|
||||
tests/layout.notonastaliqurdu.tests \
|
||||
tests/layout.tests \
|
||||
tests/layout.tinos.tests \
|
||||
tests/sbix.tests \
|
||||
tests/variable.tests \
|
||||
tests/glyph_names.tests \
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
FONTS:
|
||||
Tinos-Italic.ttf
|
||||
|
||||
PROFILES:
|
||||
default.txt
|
||||
retain-gids.txt
|
||||
glyph-names.txt
|
||||
notdef-outline.txt
|
||||
|
||||
SUBSETS:
|
||||
U+5bf,U+5f0,U+5f1,U+5f2,U+fb21,U+fb22,U+fb23,U+fb24,U+fb25,U+fb26,U+fb27,U+fb28
|
||||
*
|
|
@ -26,6 +26,7 @@ tests = [
|
|||
'layout.gdef-varstore',
|
||||
'layout.gdef-attachlist',
|
||||
'layout.notonastaliqurdu',
|
||||
'layout.tinos',
|
||||
'cmap',
|
||||
'cmap14',
|
||||
'sbix',
|
||||
|
|
Loading…
Reference in New Issue