[glyphs] Apply *origin to layer geometry, not just propagated anchors - #2072
Open
anthrotype wants to merge 3 commits into
Open
[glyphs] Apply *origin to layer geometry, not just propagated anchors#2072anthrotype wants to merge 3 commits into
anthrotype wants to merge 3 commits into
Conversation
Shift contours, component transforms, and source anchors by -*origin during Glyphs conversion. This also covers simple glyphs, whose anchors are not rewritten by propagation; retain the generic IR adjustment for other callers.
rsheeter
reviewed
Aug 5, 2026
| const GLYPHS_ORIGIN_ANCHOR: &str = "*origin"; | ||
|
|
||
| /// The `*origin` anchor's position, if the layer has one. | ||
| fn layer_origin(layer: &Layer) -> Option<kurbo::Point> { |
Contributor
There was a problem hiding this comment.
Nit: layer.origin() or layer.find_origin() would be nicer, might it make sense to use a trait or move this into glyphs-reader?
rsheeter
reviewed
Aug 5, 2026
| unitsPerEm = 1000; | ||
| }"#, | ||
| ) | ||
| .unwrap(); |
Contributor
There was a problem hiding this comment.
IMHO this would be nicer as an actual .glyphs file we load
rsheeter
reviewed
Aug 5, 2026
rsheeter
approved these changes
Aug 5, 2026
Try to denoise tests a little
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Glyphs.app treats
*originas a layer-wide coordinate shift: everything else on the layer is drawn as if*originwere at (0, 0) and then translated back by -origin. fontc only applied this to anchors, during propagation, and never to contours or components. Even that anchor adjustment was silently skipped for non-composite glyphs, because propagate_anchors only writes propagated anchors back for composite glyphs, so a simple glyph with*origincame out unshifted everywhere.This applies the shift during Glyphs source conversion instead, to contours, components and the raw anchor collection, so simple glyphs are covered too.
propagate_anchors keeps the current
origin_adjusted_anchorsfor other potential IR callers, but on the Glyphs path it becomes a no-op.(related to #769 which handled the anchor half of this in 2024; this is the rest of it)
glyphsLib does the same thing as of googlefonts/glyphsLib#1155, which merged yesterday (July 31), so the two compilers will continue to agree.
We should hold this until a glyphsLib release containing googlefonts/glyphsLib#1155 is out and fontc requirements are bumped.