Fix panic with empty color glyphs#1765
Merged
Merged
Conversation
This test reproduces a bug where a glyph like 'CR' has palette layers that trigger the COLRv0 code path, but those layers have no shapes. The test verifies that such glyphs are not incorrectly added to color_glyphs.
This test reproduces the same bug as the COLRv0 test but for the COLRv1 split code.
rsheeter
reviewed
Nov 19, 2025
| }, | ||
| ], | ||
| ..Default::default() | ||
| }; |
Contributor
There was a problem hiding this comment.
Optional: would it be easier to just add a new source?
Member
Author
There was a problem hiding this comment.
maybe.. but I have already done it
rsheeter
approved these changes
Nov 19, 2025
When a glyph has color layers (palette layers for COLRv0 or color attribute for COLRv1) but those layers have no shapes, the glyph was incorrectly added to color_glyphs with empty split_glyph_names. This caused a panic when trying to access shapes[0] in create_paint_glyph. The fix checks if there's actual color content before adding the glyph Also improved error handling in create_paint_glyph to return a proper error instead of panicking if a color glyph unexpectedly has no shapes. Fixes compilation of HonkExportFile.glyphs font.
Member
Author
|
after this patch Honk gets 90.337% COLR |
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.
This test reproduces a panic when compiling
python3 -m ttx_diff 'https://github.com/EkType/Honk?99094d4f6e#sources/HonkExportFile.glyphs'
whereby an empty glyph 'CR' has palette layers that trigger the COLRv0 code path, however those layers have no shapes.
These empty glyphs are being unconditionally added to color_glyphs despite actually having no shapes.