[subset] fox for (Chain)ContextFormat3: subset lookupRecord

skip copying a lookupRecord if lookup referenced in the lookupRecord is
not retained after subset
pull/3217/head
Qunxin Liu 3 years ago committed by Behdad Esfahbod
parent 838d670752
commit 37379f8f7d
  1. 30
      src/hb-ot-layout-gsubgpos.hh
  2. 1
      test/subset/data/Makefile.am
  3. 1
      test/subset/data/Makefile.sources
  4. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.default.5bf,5f0,5f1,5f2,fb21,fb22,fb23,fb24,fb25,fb26,fb27,fb28.ttf
  5. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.default.retain-all-codepoint.ttf
  6. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.glyph-names.5bf,5f0,5f1,5f2,fb21,fb22,fb23,fb24,fb25,fb26,fb27,fb28.ttf
  7. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.glyph-names.retain-all-codepoint.ttf
  8. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.notdef-outline.5bf,5f0,5f1,5f2,fb21,fb22,fb23,fb24,fb25,fb26,fb27,fb28.ttf
  9. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.notdef-outline.retain-all-codepoint.ttf
  10. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.retain-gids.5bf,5f0,5f1,5f2,fb21,fb22,fb23,fb24,fb25,fb26,fb27,fb28.ttf
  11. BIN
      test/subset/data/expected/layout.tinos/Tinos-Italic.retain-gids.retain-all-codepoint.ttf
  12. BIN
      test/subset/data/fonts/Tinos-Italic.ttf
  13. 12
      test/subset/data/tests/layout.tinos.tests
  14. 1
      test/subset/meson.build

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

@ -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…
Cancel
Save