italicAngle with anisotropic interpolations
The big picture:
from fontMath import MathInfo
from defcon import Info
i1 = Info()
i1.italicAngle = 0
i2 = Info()
i2.italicAngle = 0
mi1 = MathInfo(i1)
mi2 = MathInfo(i2)
r = mi1 + (mi2 - mi1) * (-0.21, -0.386)
print(r.italicAngle)
This prints out -180.0 as a interpolation result for the italicAngle.
Narrowed down to the factorAngle function:
from fontMath.mathFunctions import factorAngle
from fontMath.mathFunctions import mul
r = factorAngle(0, (-0.21, -0.21), mul)
print(r)
I have no solution, factorAngle divides the angle to sin/cos mimicking x/y and applies the anisotropic factor, which makes sense, only the result is not as expected.
See also https://github.com/robotools/fontMath/issues/236
In the factor (-0.21, -0.21) the x and y are flipping to negative. That would make all points flip to below the baseline, and left of the leftMargin. What value would we expect for the italic angle in this case? -180 is vertical, down, right? It might make sense?
the math makes totally sense, only unexpected when the starting italic angle is 0 and you get -180.
Do you really need to scale (-0.21, -0.386) or was that for the demo?
its a sliders setting from UFOStretch
Is the input being 0 the only case that this is unintuitive? If so, would it be inelegant to just add a check and zero it out?
def factorAngle(angle, f, func):
if angle == 0 and func in (mul, div):
return 0.0
# ...
Otherwise, is there a way to use tan or something, rather than separating out x and y using sin and cos?