instancer: Add axisDefaults to axisLimits
This commit is contained in:
parent
69c8667982
commit
ce1d8a9955
@ -1329,9 +1329,6 @@ def axisValueIsSelected(axisValue, seeker):
|
||||
axisIndex in seeker and seeker[axisIndex] <= axisValue.RangeMaxValue
|
||||
]) else False
|
||||
|
||||
if axisIndex not in seeker:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@ -1395,8 +1392,15 @@ def updateNameTable(varfont, axisLimits):
|
||||
if "STAT" not in varfont:
|
||||
raise ValueError("Cannot update name table since there is no STAT table.")
|
||||
stat = varfont['STAT']
|
||||
fvar = varfont['fvar']
|
||||
nametable = varfont["name"]
|
||||
|
||||
# add default axis values if they are missing from axisLimits
|
||||
fvarDefaults = {a.axisTag: a.defaultValue for a in fvar.axes}
|
||||
for k, v in fvarDefaults.items():
|
||||
if k not in axisLimits:
|
||||
axisLimits[k] = v
|
||||
|
||||
selectedAxisValues = axisValuesFromAxisLimits(stat, axisLimits)
|
||||
_updateNameRecords(varfont, nametable, selectedAxisValues)
|
||||
|
||||
|
@ -479,6 +479,9 @@
|
||||
<namerecord nameID="296" platformID="3" platEncID="1" langID="0x409">
|
||||
TestVariableFont-XCdBd
|
||||
</namerecord>
|
||||
<namerecord nameID="297" platformID="3" platEncID="1" langID="0x409">
|
||||
Normal
|
||||
</namerecord>
|
||||
</name>
|
||||
|
||||
<post>
|
||||
@ -764,6 +767,15 @@
|
||||
<Value value="0.0"/>
|
||||
<LinkedValue value="1.0"/>
|
||||
</AxisValue>
|
||||
<AxisValue index="3" Format="4">
|
||||
<!-- AxisCount=1 -->
|
||||
<Flags value="2"/>
|
||||
<ValueNameID value="297"/> <!-- Normal -->
|
||||
<AxisValueRecord index="0">
|
||||
<AxisIndex value="1"/>
|
||||
<Value value="100.0"/>
|
||||
</AxisValueRecord>
|
||||
</AxisValue>
|
||||
</AxisValueArray>
|
||||
<ElidedFallbackNameID value="2"/> <!-- Regular -->
|
||||
</STAT>
|
||||
|
@ -1209,8 +1209,8 @@ class InstantiateSTATTest(object):
|
||||
@pytest.mark.parametrize(
|
||||
"location, expected",
|
||||
[
|
||||
({"wght": 400}, ["Regular", "Condensed", "Upright"]),
|
||||
({"wdth": 100}, ["Thin", "Regular", "Black", "Upright"]),
|
||||
({"wght": 400}, ["Regular", "Condensed", "Upright", "Normal"]),
|
||||
({"wdth": 100}, ["Thin", "Regular", "Black", "Upright", "Normal"]),
|
||||
],
|
||||
)
|
||||
def test_pin_and_drop_axis(self, varfont, location, expected):
|
||||
@ -1344,7 +1344,7 @@ class InstantiateSTATTest(object):
|
||||
def test_pruningUnusedNames(varfont):
|
||||
varNameIDs = instancer.getVariationNameIDs(varfont)
|
||||
|
||||
assert varNameIDs == set(range(256, 296 + 1))
|
||||
assert varNameIDs == set(range(256, 297 + 1))
|
||||
|
||||
fvar = varfont["fvar"]
|
||||
stat = varfont["STAT"].table
|
||||
|
Loading…
x
Reference in New Issue
Block a user