Fix normalization error when condition’s minimum/maximum are missing in designspace, update test too

Fixes #1346
This commit is contained in:
David Březina 2018-10-24 18:46:45 +02:00
parent 1a14b38de2
commit 28245afe1e
2 changed files with 10 additions and 4 deletions

View File

@ -389,7 +389,7 @@ def _merge_TTHinting(font, model, master_ttfs, tolerance=0.5):
# cvt table
all_cvs = [Vector(m["cvt "].values) for m in master_ttfs if "cvt " in m]
if len(all_cvs) == 0:
# There is no cvt table to make a cvar table from, we're done here.
return
@ -587,8 +587,14 @@ def _add_GSUB_feature_variations(font, axes, internal_axis_supports, rules):
space = {}
for condition in conditions:
axis_name = condition["name"]
minimum = normalize(axis_name, condition["minimum"])
maximum = normalize(axis_name, condition["maximum"])
if condition["minimum"]:
minimum = normalize(axis_name, condition["minimum"])
else:
minimum = -1.0
if condition["maximum"]:
maximum = normalize(axis_name, condition["maximum"])
else:
maximum = 1.0
tag = axis_tags[axis_name]
space[tag] = (minimum, maximum)
region.append(space)

View File

@ -9,7 +9,7 @@
<rules>
<rule name="dollar-stroke">
<conditionset>
<condition name="weight" minimum="500" maximum="1000" />
<condition name="weight" minimum="500" /> <!-- intentionally omitted maximum -->
</conditionset>
<sub name="uni0024" with="uni0024.nostroke" />
</rule>