Fix duplicate postscript names for color layer glyphs#1117
Merged
Conversation
Color layer glyphs (e.g., "Acaron.color0", "Acaron.color1") were getting duplicate postscript names instead of unique ones with the .colorN suffix preserved. The bug occurred because when creating color layer glyphs, to_ufo_glyph() was copying unicode values from the parent glyph. This caused glyphdata.get_glyph() to return the base glyph's production name via unicode lookup, losing the .colorN suffix: Before: Acaron -> uni01CD Acaron.color0 -> uni01CD Acaron.color1 -> uni01CD After: Acaron -> uni01CD Acaron.color0 -> uni01CD.color0 Acaron.color1 -> uni01CD.color1 The fix adds an explicit is_color_layer_glyph parameter to to_ufo_glyph() to prevent setting unicode values on color layer glyphs, which avoids both duplicate unicode mappings and ensures glyphdata.get_glyph() is called with empty unicodes to preserve the .colorN suffix. This also removes the now-redundant "ufo_glyph.unicodes = []" assignments in color_layers.py, since unicodes are never set in the first place for color layer glyphs.
94fc08d to
bea3f75
Compare
Member
Author
|
you may argue that postscript names are useless in particular for these glyphs which are never going to appear in a run of text, but are simply drawn as COLR layers of other color base glyphs... But the problem is, only some of these color layer glyphs would get the duplicate (un-suffixed) postscript name (the ones with a unicode), whereas others like "caroncomb.alt" which doesn't have a unicode to begin with, would get the suffixed postscript name ""caroncomb.alt.color0" etc. This is inconsistent and hard/ugly to replicate in fontc. We can either make sure that all color layer glyphs keep their .colorN suffix, or we deliberately strip it from all. I chose the former, because it appeared like an oversight rather than intentional. |
khaledhosny
approved these changes
Nov 15, 2025
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.
Color layer glyphs (e.g., "Acaron.color0", "Acaron.color1") were getting duplicate postscript names instead of unique ones with the .colorN suffix preserved.
The bug occurred because when creating color layer glyphs, to_ufo_glyph() was copying unicode values from the parent glyph. This caused glyphdata.get_glyph() to return the base glyph's production name via unicode lookup, losing the .colorN suffix:
Before:
After: