Merge pull request #2860 from fonttools/set-redundant-attrs

[otlLib|featureVars] sort name records after building STAT, set redundant Counts
This commit is contained in:
Cosimo Lupo 2022-10-20 17:31:45 +01:00 committed by GitHub
commit 6fd5bc270e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -2781,6 +2781,7 @@ def buildStatTable(
locations, axes, nameTable, windowsNames=windowsNames, macNames=macNames
)
axisValues = multiAxisValues + axisValues
nameTable.names.sort()
# Store AxisRecords
axisRecordArray = ot.AxisRecordArray()
@ -2790,6 +2791,8 @@ def buildStatTable(
statTable.DesignAxisRecord = axisRecordArray
statTable.DesignAxisCount = len(axisRecords)
statTable.AxisValueCount = 0
statTable.AxisValueArray = None
if axisValues:
# Store AxisValueRecords
axisValueArray = ot.AxisValueArray()

View File

@ -337,6 +337,7 @@ def addFeatureVariationsRaw(font, table, conditionalSubstitutions, featureTag='r
langSystems = [lsr.LangSys for lsr in scriptRecord.Script.LangSysRecord]
for langSys in [scriptRecord.Script.DefaultLangSys] + langSystems:
langSys.FeatureIndex.append(varFeatureIndex)
langSys.FeatureCount = len(langSys.FeatureIndex)
varFeatureIndices = [varFeatureIndex]
@ -383,6 +384,7 @@ def buildGSUB():
srec.Script = ot.Script()
srec.Script.DefaultLangSys = None
srec.Script.LangSysRecord = []
srec.Script.LangSysCount = 0
langrec = ot.LangSysRecord()
langrec.LangSys = ot.LangSys()

View File

@ -8,9 +8,6 @@
<namerecord nameID="256" platformID="3" platEncID="1" langID="0x409">
Roman
</namerecord>
<namerecord nameID="256" platformID="3" platEncID="1" langID="0x411">
ローマン
</namerecord>
<namerecord nameID="257" platformID="3" platEncID="1" langID="0x409">
Optical Size
</namerecord>
@ -68,6 +65,9 @@
<namerecord nameID="275" platformID="3" platEncID="1" langID="0x409">
Caption
</namerecord>
<namerecord nameID="256" platformID="3" platEncID="1" langID="0x411">
ローマン
</namerecord>
</name>
<STAT>