inter icon indicating copy to clipboard operation
inter copied to clipboard

Misalignment of handles on curves after 2048 UPM change

Open eweracs opened this issue 3 years ago • 8 comments

In almost all glyphs and all their layers, the handles are misaligned (vertically/horizontally off by a unit). image

Also note that the baseline overshoot does not adhere to the defined zone.

eweracs avatar Jun 01 '22 17:06 eweracs

Thank you. I believe this was an unfortunate side effect of downscaling to 2048 UPM (there were LOTS of alignment issues introduced by that change.)

rsms avatar Jun 01 '22 20:06 rsms

Interestingly I see different things. Maybe I "accidentally" fixed some while working on opsz. Screen Shot 2022-06-01 at 13 59 24

rsms avatar Jun 01 '22 21:06 rsms

Your screenshot shows O, mine o. Did a fresh pull right before taking the screenshot, should be up to date :)

eweracs avatar Jun 01 '22 21:06 eweracs

Indeed, Glyphs caused ~75% of Bézier handles on curves to become misaligned during UPM scaling. (Either a floating-point bug or lack of ceil/floor to round coordinates to the grid. cc @schriftgestalt) Thanks for finding this!

rsms avatar Jun 01 '22 21:06 rsms

Do you happen to have a version just before the scaling to 2048? And how exactly did you do it?

schriftgestalt avatar Jun 01 '22 21:06 schriftgestalt

Do you happen to have a version just before the scaling to 2048? And how exactly did you do it?

Yes! This is the .glyphs file just before conversion: https://github.com/rsms/inter/raw/633839ad550073f9d12e6cea7964a30523974b68/src/Inter.glyphs

I did it by opening font info and then the "arrows" icon next to the UPM. Screen Shot 2022-06-01 at 14 49 39

I can reproduce the result (just tried it.)

Before scaling: Screen Shot 2022-06-01 at 14 49 17

After scaling: Screen Shot 2022-06-01 at 14 49 56

rsms avatar Jun 01 '22 21:06 rsms

I found the issue. You have set a grid of 2 units. When rounding coordinates, offcurve nodes are always rounded to a 1 unit grid, otherwise round dots in pixel fonts would be difficult. I’ll see if I can increase the threshold a bit.

schriftgestalt avatar Jun 02 '22 09:06 schriftgestalt

I found the issue. You have set a grid of 2 units. When rounding coordinates, offcurve nodes are always rounded to a 1 unit grid, otherwise round dots in pixel fonts would be difficult. I’ll see if I can increase the threshold a bit.

Ah. Interesting. I wonder if you could improve this "magic" by rounding offcurve nodes that are part of an angle-locked anchor (i.e. is green-colored) with the same constraints as the anchor itself. Maybe pixel fonts uses that?

I'm too far gone now to start over with the scaling, but if I did, would first doubling the grid and then doing the scaling "fix" it? (We're getting OT here, so feel free to ignore this :•)

rsms avatar Jun 02 '22 16:06 rsms

I wrote & ran a script to attempt to repair off-by-one handles, landed in d1272ce9c904201c97e68da030b2fa9530e895a7 — this shouldn't be an issue anymore. However the programmatic approach I took is conservative so there may still be some misaligned handles that will have to be manually corrected.

rsms avatar Apr 28 '23 14:04 rsms