WIP: Fix bracket glyph components self-referencing after roundtrip.#679
Open
tomarcher101 wants to merge 3 commits intogooglefonts:mainfrom
Open
WIP: Fix bracket glyph components self-referencing after roundtrip.#679tomarcher101 wants to merge 3 commits intogooglefonts:mainfrom
tomarcher101 wants to merge 3 commits intogooglefonts:mainfrom
Conversation
Collaborator
|
Glyphs 3 can handle both, bracket layers and distinct glyphs+conditions in feature code. |
e65de75 to
6b5b617
Compare
Collaborator
@schriftgestalt is there a tutorial for the latter? I only see the old tutorials that explain things for G2. |
Collaborator
|
the new tutorial is almost finished. The syntax is explained here https://glyphsapp.com/news/glyphs-3-make-things-you-love (search for "#ifdef VARIABLE") |
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.
Currently there is an asymmetry in the implementation of alternating glyph shapes between UFO and glyphs.app that results in roundtripping resulting in glyphs that reference themselves as a component. This self-referencing can then lead to recursion errors.
UFO handles alternating glyphs shapes by including the alternative glyph as a standalone glyph in its own right, found in the glif table. GSUB rules are then implemented to make the base glyph swap out for the alternate glyph when the correct conditions are met.
Glyphs handles alternating glyph shapes using the bracket trick, which instead stores the alternate glyph, not as a different glyph, but as a "bracket" layer of the base glyph.
As a result, if you have an alternate glyph that has its base glyph as a referenced component in a UFO, running
ufo2glyphscombines the base glyph and alternate glyph into a single glyph and you get a self referencing glyph that Glyphs.app cannot display. On the return trip,glyphs2ufodoes not unpack and separate these self referencing glyphs into their base and alternate glyph components correctly; instead creating glifs for the alternate glyphs that reference themselves as a component.This fix is to fix the 2nd problem: allowing
glyphs2ufoto correctly unpack the base and alternate glyphs correctly so the resulting UFO after a round trip isn't broken.