Repository navigation
[instantiator] allow explicitly empty glyphs in non-default sources - #1018
Merged
Merged
Conversation
The instantiator treats a glyph that is empty in a non-default source, while the default has outlines, as sparse and drops that source, so an instance there gets the outlines interpolated from the other sources. That convention lets sparse sources keep empty placeholder base glyphs for the components they vary. A glyph lib key, com.github.googlei18n.ufo2ft.instantiator.emptyNotSparse, now marks an empty glyph as meant to be empty (e.g. a master layer drawn empty in Glyphs). Such a glyph is kept as a master: an instance at that source stays empty, and an instance between it and incompatible sources raises the usual interpolation error. Unmarked glyphs behave as before.
This was referenced Oct 30, 2026
Collaborator
|
LGTM. |
anthrotype
added a commit
to arrowtype/glyphsLib
that referenced
this pull request
Nov 4, 2026
In Glyphs an empty master layer is meant to be empty, but ufo2ft's instantiator treats a glyph that is empty in a non-default source, while the default has outlines, as sparse and interpolates it from the other sources. So static instances built from the designspace get glyphs that Glyphs.app and fontc leave empty. Set the com.github.googlei18n.ufo2ft.instantiator.emptyNotSparse glyph lib key (googlefonts/ufo2ft#1018) on glyphs that are empty in a non-default master when the default master's layer has paths or components, bracket alternates included. Brace layers are sparse in Glyphs as well and are never marked. The key is recomputed on each conversion, so it is dropped when going back to Glyphs.
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.
When the default source's glyph has outlines, the instantiator treats an empty glyph in another source as missing from that source ("sparse") and interpolates it from the remaining ones. This follows two older conventions. ufoProcessor's
collectMastersForGlyphdrops such empty sources ("if the default glyph is not empty then none can be empty"), and fontmake's instantiator, which later moved here, copied that behaviour. varLib does the same when building gvar, since fonttools/fonttools#2082, which came out of #408: components are resolved within the same UFO layer, so a source that only varies the offsets of some composites still has to contain their base glyphs, and leaving those empty means they don't take part in the variation.The convention can't tell such a placeholder from a glyph that is really meant to be empty in that source. In Glyphs.app only brace (intermediate) layers are sparse; a master layer that is left empty is meant to be empty, and Glyphs and fontc export it as such, whereas fontmake fills the static instance from the other masters.
I'm not thrilled about adding yet another private lib key, but I couldn't find a way around it. The two cases look identical in a UFO, and the distinction is per glyph, not per source: any non-default source, a full master included, may be sparse for some glyphs, so a flag on the source descriptor wouldn't do. Only the tool that produced the UFOs knows which empty glyphs are intentional, so it has to say so. The name I came up with is
com.github.googlei18n.ufo2ft.instantiator.emptyNotSparse. An empty glyph that sets it is kept as a master: an instance at that source stays empty, and an instance between it and incompatible sources raises the usual interpolation error. Unmarked glyphs behave as before, and variable fonts are not affected. A companion glyphsLib PR will set the key on glyphs that are empty in a non-default master (never in brace layers).