Skip to content

Commit

Permalink
Set count fields when building feature variations
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Oct 22, 2021
1 parent 974ebd2 commit 4cab82e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/fontTools/varLib/featureVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def buildFeatureVariations(featureVariationRecords):
fv = ot.FeatureVariations()
fv.Version = 0x00010000
fv.FeatureVariationRecord = featureVariationRecords
fv.FeatureVariationCount = len(featureVariationRecords)
return fv


Expand All @@ -442,9 +443,11 @@ def buildFeatureVariationRecord(conditionTable, substitutionRecords):
fvr = ot.FeatureVariationRecord()
fvr.ConditionSet = ot.ConditionSet()
fvr.ConditionSet.ConditionTable = conditionTable
fvr.ConditionSet.ConditionCount = len(conditionTable)
fvr.FeatureTableSubstitution = ot.FeatureTableSubstitution()
fvr.FeatureTableSubstitution.Version = 0x00010000
fvr.FeatureTableSubstitution.SubstitutionRecord = substitutionRecords
fvr.FeatureTableSubstitution.SubstitutionCount = len(substitutionRecords)
return fvr


Expand All @@ -454,6 +457,7 @@ def buildFeatureTableSubstitutionRecord(featureIndex, lookupListIndices):
ftsr.FeatureIndex = featureIndex
ftsr.Feature = ot.Feature()
ftsr.Feature.LookupListIndex = lookupListIndices
ftsr.Feature.LookupCount = len(lookupListIndices)
return ftsr


Expand Down
1 change: 1 addition & 0 deletions Tests/feaLib/data/variable_conditionset.ttx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
</ConditionSet>
<FeatureTableSubstitution>
<Version value="0x00010000"/>
<!-- SubstitutionCount=1 -->
<SubstitutionRecord index="0">
<FeatureIndex value="0"/>
<Feature>
Expand Down

0 comments on commit 4cab82e

Please sign in to comment.