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

Support long parameter name for PANOSE, to match glyphsLib #1102

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

Hoolean
Copy link
Contributor

@Hoolean Hoolean commented Nov 7, 2024

glyphsLib supports longer alternative names for some of its parameters, including PANOSE (albeit with the short name taking precedence). This PR adds support for the longer name, and tests that it is parsed and has its precedence weighed correctly.

With this change, most of the OS/2 diff for Noto Sundanese is resolved; an unrelated diff in xAvgCharWidth remains.

$ python resources/scripts/ttx_diff.py https://github.com/notofonts/sundanese#sources/NotoSansSundanese.glyphs

Before:

...
DIFF 'OS_2', [...]/build/default/fontc.OS_2.ttx [...]/build/default/fontmake.OS_2.ttx (79.6%)
...

After:

...
DIFF 'hmtx', [...]/build/default/fontc.hmtx.ttx [...]/build/default/fontmake.hmtx.ttx (98.9%)
...

Note: this is a personal contribution independent of my employer, and so I've submitted from a fork under my personal profile and email to make this distinction

Glyphs supports longer alternative names for some of its parameters,
with the short name taking precedence:

https://github.com/googlefonts/glyphsLib/blob/050ef62c52906bc8ca820e7cfc6963138253f41f/Lib/glyphsLib/builder/custom_params.py#L322-L323

https://github.com/googlefonts/glyphsLib/blob/050ef62c52906bc8ca820e7cfc6963138253f41f/Lib/glyphsLib/builder/custom_params.py#L258-L269

This commit adds support for the longer name for the PANOSE values
custom parameter, and tests that it is parsed and that its precedence is
handled correctly, to improve parity with glyphsLib builds.
assert_eq!(Some(expected), context.static_metadata.get().misc.panose);
assert_eq!(expected, context.static_metadata.get().misc.panose);

// long parameter name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please make these separate tests instead of having one test that does three seperable checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good shout - I've split them now

Copy link
Contributor

@rsheeter rsheeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a couple of nits

@rsheeter rsheeter added this to the fontc 1.0 milestone Nov 7, 2024
@rsheeter
Copy link
Contributor

rsheeter commented Nov 7, 2024

Thank you!

@rsheeter rsheeter added this pull request to the merge queue Nov 7, 2024
Merged via the queue into googlefonts:main with commit 9b7a563 Nov 7, 2024
9 of 10 checks passed
@Hoolean Hoolean deleted the extra-panose-param branch November 7, 2024 23:28
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