TypeTogether / Playwrite

Sensei primary repository.
SIL Open Font License 1.1
85 stars 3 forks source link

🔥 FAIL Check hhea.caretSlopeRise and hhea.caretSlopeRun #43

Closed vv-monsalve closed 2 months ago

vv-monsalve commented 2 months ago

@simoncozens, this Fail was not reported for the previous build (TT)

Reported with the same values for

🔥 FAIL Check hhea.caretSlopeRise and hhea.caretSlopeRun
> > Checks whether hhea.caretSlopeRise and hhea.caretSlopeRun > match with post.italicAngle. > > For Upright fonts, you can set hhea.caretSlopeRise to 1 > and hhea.caretSlopeRun to 0. > > For Italic fonts, you can set hhea.caretSlopeRise to head.unitsPerEm > and calculate hhea.caretSlopeRun like this: > round(math.tan( > math.radians(-1 * font["post"].italicAngle)) * font["head"].unitsPerEm) > > This check allows for a 0.1° rounding difference between the Italic angle > as calculated by the caret slope and post.italicAngle > > Original proposal: https://github.com/fonttools/fontbakery/issues/3670 * 🔥 **FAIL**

hhea.caretSlopeRise and hhea.caretSlopeRun do not match with post.italicAngle. Got: caretSlopeRise 390 and caretSlopeRun 126 Expected: caretSlopeRise 1000 and caretSlopeRun 123

[code: caretslope-mismatch]
vv-monsalve commented 2 months ago

I've just double-checked for this on the GHA fonts and previous CI runs (like at commit 12e85c7), and all the B2 fonts are reporting this Fail.

I also confirmed the slant axis value in the source file is negative.

What could be the case here?

simoncozens commented 2 months ago

It seems the caret values are being produced by fonttools varLib.instancer, based on the values in the MVAR table. Interpolating MVAR (as with interpolating any value in OpenType) expects the values to vary linearly. Playwrite Upright (slnt=0) has values of rise=1/run=0; Playwrite Italic (slant=-18) has values rise=1000/run=325. So it is not surprising that Playwrite GB J Italic (slant=-7) has values rise=1+(999 -7 / -18)=390, run=325 -7 / -18=126. The problem is that this isn't how we want these values to interpolate: angles on a tangent aren't a linear relationship. If Playwrite Upright had rise=1000 we would have a better value, but that would cause other problems (we want rise=1/run=0 for upright fonts).

gftools-fix-font should probably fix this. I'll work on a gftools PR.

vv-monsalve commented 2 months ago

Solved by 7e9466993e6729a2ef58b37e12d0d561db83caaf