-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
glyphs2fontir/src/source.rs
Outdated
}); | ||
CoordConverter::new(mappings, default_idx) | ||
} else { | ||
// There is no mapping; design == user |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this 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
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.