adobe-type-tools / afdko

Adobe Font Development Kit for OpenType
https://adobe-type-tools.github.io/afdko/
Other
1.06k stars 167 forks source link

Fix rounding in otfautohint #1759

Closed skef closed 1 month ago

skef commented 1 month ago

This is a very simple fix for rounding stem locations in otfautohint. I didn't really add new tests, but @punchcutter and I updated some existing tests with new output, some of which demonstrate the rounding.

This problem crept in because the old and new code have difference sources of stem "locations", particularly when it comes to inflection points and spline extrema. So while most of the rounding was handled by having round spline endpoint locations, some of it wasn't. This PR adds rounding at the point where "segments" (which are used down-stream to choose stem locations) are added.

Simply rounding BlueValue locations like this wouldn't work because stems have to be within a blue zone to be affected by one, as I learned with the more recent FreeType fix. But with stems it seems to be a matter of just being near enough to one side (which makes conceptual sense). So I think we should integrate this and then do basic verification using Momochidori.

Checklist: