Merge pull request #1882 from fonttools/subset-feature-variations

[subset] FeatureVariations subsetting is wrong
This commit is contained in:
Cosimo Lupo 2020-04-25 15:20:55 +01:00 committed by GitHub
commit 8825e19615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1321,8 +1321,14 @@ def subset_features(self, feature_indices):
@_add_method(otTables.FeatureVariations)
def subset_features(self, feature_indices):
self.ensureDecompiled()
self.FeaturVariationRecord = [r for r in self.FeatureVariationRecord
if r.FeatureTableSubstitution.subset_features(feature_indices)]
for r in self.FeatureVariationRecord:
r.FeatureTableSubstitution.subset_features(feature_indices)
# Prune empty records at the end only
# https://github.com/fonttools/fonttools/issues/1881
while (self.FeatureVariationRecord and
not self.FeatureVariationRecord[-1]
.FeatureTableSubstitution.SubstitutionCount):
self.FeatureVariationRecord.pop()
self.FeatureVariationCount = len(self.FeatureVariationRecord)
return bool(self.FeatureVariationCount)