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 locations, axes, nameTable, windowsNames=windowsNames, macNames=macNames
) )
axisValues = multiAxisValues + axisValues axisValues = multiAxisValues + axisValues
nameTable.names.sort()
# Store AxisRecords # Store AxisRecords
axisRecordArray = ot.AxisRecordArray() axisRecordArray = ot.AxisRecordArray()
@ -2790,6 +2791,8 @@ def buildStatTable(
statTable.DesignAxisRecord = axisRecordArray statTable.DesignAxisRecord = axisRecordArray
statTable.DesignAxisCount = len(axisRecords) statTable.DesignAxisCount = len(axisRecords)
statTable.AxisValueCount = 0
statTable.AxisValueArray = None
if axisValues: if axisValues:
# Store AxisValueRecords # Store AxisValueRecords
axisValueArray = ot.AxisValueArray() 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] langSystems = [lsr.LangSys for lsr in scriptRecord.Script.LangSysRecord]
for langSys in [scriptRecord.Script.DefaultLangSys] + langSystems: for langSys in [scriptRecord.Script.DefaultLangSys] + langSystems:
langSys.FeatureIndex.append(varFeatureIndex) langSys.FeatureIndex.append(varFeatureIndex)
langSys.FeatureCount = len(langSys.FeatureIndex)
varFeatureIndices = [varFeatureIndex] varFeatureIndices = [varFeatureIndex]
@ -383,6 +384,7 @@ def buildGSUB():
srec.Script = ot.Script() srec.Script = ot.Script()
srec.Script.DefaultLangSys = None srec.Script.DefaultLangSys = None
srec.Script.LangSysRecord = [] srec.Script.LangSysRecord = []
srec.Script.LangSysCount = 0
langrec = ot.LangSysRecord() langrec = ot.LangSysRecord()
langrec.LangSys = ot.LangSys() langrec.LangSys = ot.LangSys()

View File

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