Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[glyphs] Parse kerning as floats #1145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[glyphs] Parse kerning as floats #1145

wants to merge 1 commit into from

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Nov 26, 2024

Glyphs kern values can be floats, but we were parsing them as integers.

This also uncovered something else fishy: our integer parsing logic in glyps-reader/ascii-plist-derive will happy parse something like "1.321" as an integer, by parsing to a float and casting.

I think this is incorrect? I think it is reasonable to go the other way (to accept an integer value as a float) and it might be reasonable to accept an integer value with no fractional component as a float, but I definitely don't think we should parse a float with a fractional value as an integer; it hides bugs like this.

Glyphs kern values can be floats, but we were parsing them as integers.

This also uncovered something else fishy: our integer parsing logic in
glyps-reader/ascii-plist-derive will happy parse something like "1.321"
as an integer, by parsing to a float and casting.

I think this is incorrect? I think it is reasonable to go the other way
(to accept an integer value as a float) and it _might_ be reasonable to
accept an integer value with no fractional component as a float, but I
definitely don't think we should parse a float with a fractional value
as an integer; it hides bugs like this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant