[instancer] Don't produce triples outside <-1,0,+1>
Fixes https://github.com/fonttools/fonttools/issues/3350
This commit is contained in:
parent
4dbf534bc2
commit
8728789c05
@ -178,7 +178,9 @@ def _solve(tent, axisLimit, negative=False):
|
||||
#
|
||||
newUpper = peak + (1 - gain) * (upper - peak)
|
||||
assert axisMax <= newUpper # Because outGain > gain
|
||||
if newUpper <= axisDef + (axisMax - axisDef) * 2:
|
||||
# Disabled because ots doesn't like us:
|
||||
# https://github.com/fonttools/fonttools/issues/3350
|
||||
if False and newUpper <= axisDef + (axisMax - axisDef) * 2:
|
||||
upper = newUpper
|
||||
if not negative and axisDef + (axisMax - axisDef) * MAX_F2DOT14 < upper:
|
||||
# we clamp +2.0 to the max F2Dot14 (~1.99994) for convenience
|
||||
|
@ -1986,7 +1986,10 @@ class LimitTupleVariationAxisRangesTest:
|
||||
TupleVariation({"wght": (0.0, 0.5, 1.0)}, [100, 100]),
|
||||
"wght",
|
||||
0.6,
|
||||
[TupleVariation({"wght": (0.0, 0.833334, 1.666667)}, [100, 100])],
|
||||
[
|
||||
TupleVariation({"wght": (0.0, 0.833334, 1.0)}, [100, 100]),
|
||||
TupleVariation({"wght": (0.833334, 1.0, 1.0)}, [80, 80]),
|
||||
],
|
||||
),
|
||||
(
|
||||
TupleVariation({"wght": (0.0, 0.2, 1.0)}, [100, 100]),
|
||||
@ -2001,7 +2004,10 @@ class LimitTupleVariationAxisRangesTest:
|
||||
TupleVariation({"wght": (0.0, 0.2, 1.0)}, [100, 100]),
|
||||
"wght",
|
||||
0.5,
|
||||
[TupleVariation({"wght": (0.0, 0.4, 1.99994)}, [100, 100])],
|
||||
[
|
||||
TupleVariation({"wght": (0.0, 0.4, 1)}, [100, 100]),
|
||||
TupleVariation({"wght": (0.4, 1, 1)}, [62.5, 62.5]),
|
||||
],
|
||||
),
|
||||
(
|
||||
TupleVariation({"wght": (0.5, 0.5, 1.0)}, [100, 100]),
|
||||
@ -2065,7 +2071,10 @@ class LimitTupleVariationAxisRangesTest:
|
||||
TupleVariation({"wght": (-1.0, -0.5, 0.0)}, [100, 100]),
|
||||
"wght",
|
||||
-0.6,
|
||||
[TupleVariation({"wght": (-1.666667, -0.833334, 0.0)}, [100, 100])],
|
||||
[
|
||||
TupleVariation({"wght": (-1.0, -0.833334, 0.0)}, [100, 100]),
|
||||
TupleVariation({"wght": (-1.0, -1.0, -0.833334)}, [80, 80]),
|
||||
],
|
||||
),
|
||||
(
|
||||
TupleVariation({"wght": (-1.0, -0.2, 0.0)}, [100, 100]),
|
||||
@ -2080,7 +2089,10 @@ class LimitTupleVariationAxisRangesTest:
|
||||
TupleVariation({"wght": (-1.0, -0.2, 0.0)}, [100, 100]),
|
||||
"wght",
|
||||
-0.5,
|
||||
[TupleVariation({"wght": (-2.0, -0.4, 0.0)}, [100, 100])],
|
||||
[
|
||||
TupleVariation({"wght": (-1.0, -0.4, 0.0)}, [100, 100]),
|
||||
TupleVariation({"wght": (-1.0, -1.0, -0.4)}, [62.5, 62.5]),
|
||||
],
|
||||
),
|
||||
(
|
||||
TupleVariation({"wght": (-1.0, -0.5, -0.5)}, [100, 100]),
|
||||
|
@ -43,7 +43,8 @@ class RebaseTentTest(object):
|
||||
(0, 0.2, 1),
|
||||
(-1, 0, 0.8),
|
||||
[
|
||||
(1, (0, 0.25, 1.25)),
|
||||
(1, (0, 0.25, 1)),
|
||||
(0.25, (0.25, 1, 1)),
|
||||
],
|
||||
),
|
||||
# Case 3 boundary
|
||||
@ -51,7 +52,8 @@ class RebaseTentTest(object):
|
||||
(0, 0.4, 1),
|
||||
(-1, 0, 0.5),
|
||||
[
|
||||
(1, (0, 0.8, 1.99994)),
|
||||
(1, (0, 0.8, 1)),
|
||||
(2.5 / 3, (0.8, 1, 1)),
|
||||
],
|
||||
),
|
||||
# Case 4
|
||||
@ -234,7 +236,8 @@ class RebaseTentTest(object):
|
||||
(0, 0.2, 1),
|
||||
(0, 0, 0.5),
|
||||
[
|
||||
(1, (0, 0.4, 1.99994)),
|
||||
(1, (0, 0.4, 1)),
|
||||
(0.625, (0.4, 1, 1)),
|
||||
],
|
||||
),
|
||||
# https://github.com/fonttools/fonttools/issues/3139
|
||||
|
Loading…
x
Reference in New Issue
Block a user