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

[glypsh-reader] fix ParseIntError when custom param has unquoted string #626

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

anthrotype
Copy link
Member

If you create a New Font from Glyphs.app and then add a 'Variable Font Origin' custom parameter (which we currently do support) and set this to the first and only master that the newly created font comes with (which Glyphs.app assigns the id of m01 using an unquoted plist string), and then attempt to compile, you will get a ParseIntError when parsing the custom parameters, because glyphs-reader thinks that it is an integer.

I add a reproducer first, and follow up with the actual fix.

@anthrotype
Copy link
Member Author

https://github.com/googlefonts/fontc/actions/runs/7104626540/job/19340026073?pr=626

failures:

---- font::tests::vf_origin_unquoted_string stdout ----
thread 'font::tests::vf_origin_unquoted_string' panicked at glyphs-reader/src/font.rs:411:84:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    font::tests::vf_origin_unquoted_string

test result: FAILED. 50 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s

…st values

I need to be able to parse float values (for the underline thickness/position) in custom parameters.
Also, for custom parameters that have simple unquoted strings we currently crash attempting to parse them as int, we can simply parse plist 'atoms' as such (int/float/unquoted string).
@anthrotype anthrotype changed the title [glypsh-reader] repro ParseIntError when custom param has unquoted string [glypsh-reader] fix ParseIntError when custom param has unquoted string Dec 5, 2023
@anthrotype anthrotype added this pull request to the merge queue Dec 5, 2023
Merged via the queue into main with commit b919e69 Dec 5, 2023
10 checks passed
@anthrotype anthrotype deleted the unquoted-variable-custom-origin branch December 5, 2023 18:03
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.

2 participants