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

map between design, external, and internal coordinates correctly #22

Closed
anthrotype opened this issue Dec 1, 2022 · 4 comments
Closed
Assignees

Comments

@anthrotype
Copy link
Member

designspace coordinates can be interpreted using so-called user-space (e.g. fvar axis [min,default,max], or OT registered axes predefined ranges) or as internal design-space coordinates (arbitrary numbers convenient to designers for defining source locations).
Designspace axes contain a <map> elements to map from the former to the latter, and are the basis for defining the avar table that "bends" the default normalization process (the one mapping min to -1, default to 0 and max to +1 and lerp anything in between).

Currently we don't even parse these map elements and assume there's no such user vs design vs normalised space distinction.

See #18 (comment)

@rsheeter
Copy link
Contributor

Copied from @anthrotype's note on #43 (comment):

The master axis values in Glyphs are in internal design coordinates. The global axes definitions (the min/default/max that go in fvar, the .designspace axes min/default/max, and hence also our ir:Axis) are in user-space coordinates.
The mapping between user-space to internal design-space coordinates is defined in Glyphs in multiple ways

directly via the "Axis Mappings" font custom parameter
via "Axis Location" custom parameters set on each font master
implicitly by deriving it for wght and wdth axis only from the user-space location of the instances
it's one of the most complicated pieces of code in glyphsLib, for your amusement

https://github.com/googlefonts/glyphsLib/blob/f6e9c4a29ce764d34c309caef5118c48c156be36/Lib/glyphsLib/builder/axes.py#L155

I think we'll want explicit types so you cannot accidentally stick designspace coords in as userspace and vice versa.

@rsheeter rsheeter self-assigned this Dec 11, 2022
@rsheeter rsheeter changed the title map between user-space vs design-space coordinates map between design, external, and internal coordinates correctly Dec 13, 2022
@rsheeter
Copy link
Contributor

googlefonts/glyphsLib#280 (comment) appears to explain how to interpret "Axis Location": the mapping is

design locations = xxxValue and user locations = "Axis Location" parameter

@rsheeter
Copy link
Contributor

rsheeter commented Jan 11, 2023

#83 left out instances: #83 (comment) notes:

the Axis Location custom parameter can also appear on instances, and these also contribute to defining the axis mappings.

And if an instance has the same internal design coordinate as a master, it also must share the same external/user-space axis location coordinate as that master, otherwise the two would be inconsistent.

And of course, the instances coords must be within the range of the masters' as the former are interpolated from the latter.

@rsheeter
Copy link
Contributor

rsheeter commented Sep 4, 2024

#918 tracks instances Axis Location. As that is not itself a mapping between coordinates issue I think we can close this.

@rsheeter rsheeter closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants