parent
84ebc7d345
commit
345d6b2f81
@ -531,9 +531,13 @@ def changeTupleVariationsAxisLimits(variations, axisLimits):
|
||||
def changeTupleVariationAxisLimit(var, axisTag, axisLimit):
|
||||
assert isinstance(axisLimit, NormalizedAxisTripleAndDistances)
|
||||
|
||||
# Skip when current axis is missing (i.e. doesn't participate),
|
||||
# Skip when current axis is missing or peaks at 0 (i.e. doesn't participate)
|
||||
lower, peak, upper = var.axes.get(axisTag, (-1, 0, 1))
|
||||
if peak == 0:
|
||||
# explicitly defined, no-op axes can be omitted
|
||||
# https://github.com/fonttools/fonttools/issues/3453
|
||||
if axisTag in var.axes:
|
||||
del var.axes[axisTag]
|
||||
return [var]
|
||||
# Drop if the var 'tent' isn't well-formed
|
||||
if not (lower <= peak <= upper) or (lower < 0 and upper > 0):
|
||||
|
@ -2015,6 +2015,19 @@ class LimitTupleVariationAxisRangesTest:
|
||||
0.5,
|
||||
[TupleVariation({"wght": (1.0, 1.0, 1.0)}, [100, 100])],
|
||||
),
|
||||
# test case from https://github.com/fonttools/fonttools/issues/3453
|
||||
(
|
||||
TupleVariation(
|
||||
{
|
||||
"wght": (0.0, 1.0, 1.0),
|
||||
"ital": (0.0, 0.0, 1.0), # no-op axis gets dropped
|
||||
},
|
||||
[100, 100],
|
||||
),
|
||||
"ital",
|
||||
0.0,
|
||||
[TupleVariation({"wght": (0.0, 1.0, 1.0)}, [100, 100])],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_positive_var(self, var, axisTag, newMax, expected):
|
||||
|
Loading…
x
Reference in New Issue
Block a user