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

Load Glyphs v2 axis mappings, example based on Texturina, into converter #59

Merged
merged 4 commits into from
Dec 15, 2022

Conversation

rsheeter
Copy link
Contributor

@rsheeter rsheeter commented Dec 14, 2022

Based on https://raw.githubusercontent.com/googlefonts/lexend/main/sources/Lexend.glyphs I believe Axis Mappings is a custom param in Glyphs 3 as well.

Step toward #22, #27.

@rsheeter rsheeter marked this pull request as ready for review December 14, 2022 22:02
@rsheeter rsheeter changed the title [WIP] Load Glyphs v2 axis mappings, example based on Texturina, into converter Load Glyphs v2 axis mappings, example based on Texturina, into converter Dec 14, 2022
});
CoordConverter::new(mappings, default_idx)
} else {
// There is no mapping; design == user
Copy link
Member

@anthrotype anthrotype Dec 15, 2022

Choose a reason for hiding this comment

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

when there is no Axis Mappings custom parameter, you can't simply assume design == user and go home..

You have to check for Axis Location custom parameters on the masters and optionally on the instances too, and use those to define {user-space: design-space} axis mappings.

Have a read at "Axis mappings and locations" chapter of https://glyphsapp.com/learn/creating-a-variable-font

Actually, it's interesting that in that doc there's a box on the side with a warning like this:

Axis Mappings are not always working as expected in 3.0.x, and may create faulty entries in the fvar table. We are considering deprecating this method. If possible, use the Axis Location method.

Well, glyphsLib at least gives priority to the more general approach which is Axis Mappings, as the latter allows one to define more mappings than there are masters or instances (if one wished to warp the variation space with greater granularity)...

Finally, if neither Axis Mappings nor Axis Locations are defined.. well, you're in dangerous territory and glyphsLib will do something clever like taking the user-space locations implicitly assigned to instances (which do have weightClass and widthClass attribute corresponding to CSS values) and use those to infer the axis mappings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Axis Location's is TODO, I will update the comment to be more explicit about that

If neither is defined and you take the weight/width from attributes I would have thought you assume design == user?

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.

LGTM

good as a start, but will need more work to support Axis Location custom params, or even the lack of both Axis Mappings and Axis Location if we want to go there

@rsheeter rsheeter merged commit 66aa397 into main Dec 15, 2022
@rsheeter rsheeter deleted the glyphs_glyphs branch December 16, 2022 00:51
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