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] Clean up custom params #1141

Merged
merged 1 commit into from
Nov 22, 2024
Merged

[glyphs] Clean up custom params #1141

merged 1 commit into from
Nov 22, 2024

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Nov 21, 2024

We're going to need to support a bunch of of these, and it was becoming hard to keep track of what was being handled and what wasn't. This moves all the custom params (at the font level) into a new CustomFontParameters struct.

It also reduces boilerplate when these are used in glyphs2fontir.

The ultimate goal here is to do smarter parsing of these custom paramaters in such a way as to be able to warn if there are any we aren't handling.

@@ -65,6 +62,15 @@ pub struct Font {
// master id => { (name or class, name or class) => adjustment }
pub kerning_ltr: Kerning,

pub custom_parameters: CustomFontParameters,
Copy link
Member

Choose a reason for hiding this comment

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

how about naming them "FontCustomParameters" instead? To my non-native Engish speaking mind, it reads slightly better as it makes it easier to compare/contrast to the other masters' and instances' custom parameters.
By the way, don't we need to also group the latter two?

Copy link
Member Author

Choose a reason for hiding this comment

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

name sounds good.

And yes, the goal is also to group the other ones, I can take a look at that too.

.map(|v| v as f64),
);

macro_rules! set_metric {
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Copy link
Member

@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

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

+1 much better when they are logically grouped under font.custom_parameters

We're going to need to support a bunch of of these, and it was becoming
hard to keep track of what was being handled and what wasn't. This moves
all the custom params (at the font level) into a new
CustomFontParameters struct.

It also reduces boilerplate when these are used in glyphs2fontir.

The ultimate goal here is to do smarter parsing of these custom
paramaters in such a way as to be able to warn if there are any we
aren't handling.
@cmyr cmyr added this pull request to the merge queue Nov 22, 2024
Merged via the queue into main with commit 6165d68 Nov 22, 2024
10 checks passed
@cmyr cmyr deleted the glyphs-custom-params-type branch November 22, 2024 17:19
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