Closed madig closed 3 years ago
So what's going on seems to be that both italicAngle
and postscriptSlantAngle
are handled by MathInfo._processMathTwoAngle
, which calls factorAngle
. If there is no anisotropy going on, it just returns the value that was passed in, when it should linearly interpolate the value.
@typesupply not quite sure what to do here. I'd assume that we want to interpolate the value like any other, but factor in anisotropy?
I defer to @LettError.
Interesting that this never came up before!
Here is a small change that seems to bring the expected results. I don't know where the factorAngle
logic came from, I'd have to study it to see how it works. What are the expected results for anisotropic math?
https://github.com/robotools/fontMath/commit/13148c362d5376eca18a7ccdaff9d1aa562fb78d
Simpler example that doesn't need fontmake.
import math
from fontParts.world import RFont
f = RFont()
f.info.italicAngle = 10
m = f.info.toMathInfo(guidelines=True)
m1 = m - m
r1 = RFont()
m1.extractInfo(r1.info)
assert r1.info.italicAngle == 0
m2 = m + m + m
r2 = RFont()
m2.extractInfo(r2.info)
assert r2.info.italicAngle == 30
m3 = 10 * m
r3 = RFont()
m3.extractInfo(r3.info)
assert r3.info.italicAngle == 100
m4 = m / 20
r4 = RFont()
m4.extractInfo(r4.info)
assert r4.info.italicAngle == 0.5
@madig Just checking in on this
Hi! :wave: need anything from me?
I stumbled over this again and eventually remembered that I opened this PR a year ago :D I implemented LettError's suggestion.
@benkiel @LettError
LGTM. The test values are indeed what one would expect to see.
A fontinfo's
italicAngle
andpostscriptSlantAngle
do not seem to interpolate correctly.Initially found with this reproducer (the last assert fails):
After some digging with @belluzj, we found that
test_mul
fails on these two attributes if they're non-zero, as if they're skipped. More digging required.