Skip to content

Commit

Permalink
subset: remove FeatureVariations table and downgrade to version 0x100…
Browse files Browse the repository at this point in the history
…00 when empty

fonttools#1881 (comment)
  • Loading branch information
anthrotype committed Apr 28, 2020
1 parent 3f7b042 commit c8f591e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Lib/fontTools/subset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,11 +1631,11 @@ def prune_post_subset(self, font, options):
#if table.ScriptList and not table.ScriptList.ScriptRecord:
# table.ScriptList = None

if not table.FeatureList and hasattr(table, 'FeatureVariations'):
table.FeatureVariations = None
if hasattr(table, 'FeatureVariations'):
if not (table.FeatureList and table.FeatureVariations.FeatureVariationRecord):
table.FeatureVariations = None

if hasattr(table, 'FeatureVariations') and not table.FeatureVariations:
if table.Version == 0x00010001:
if not table.FeatureVariations and table.Version == 0x00010001:
table.Version = 0x00010000

return True
Expand Down
3 changes: 2 additions & 1 deletion Tests/subset/subset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ def test_subset_feature_variations_drop_all(featureVarsTestFont):
assert "rvrn" not in featureTags
assert glyphs == {".notdef", "f", "dollar"}
# all FeatureVariationRecords were dropped
assert not font["GSUB"].table.FeatureVariations.FeatureVariationRecord
assert font["GSUB"].table.FeatureVariations is None
assert font["GSUB"].table.Version == 0x00010000


# TODO test_subset_feature_variations_drop_from_end_empty_records
Expand Down

0 comments on commit c8f591e

Please sign in to comment.