font-patcher: Fix crash on some custom sets #1006
Merged
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.
Description
[why]
When a custom set is to be patched and that set contains the
.notdef
glyph the script crashes.[how]
The glyphs has an unicode codepoint of -1, a code that we explicitely not patch. That leads to confusion when we try to determine the codepoint to be used for that glyph, because it has none.
Exclude negative codepoint glyphs when we determine the selection of to-be-patched glyphs.
As last resort for broken custom sets skip over glyphs that come out of order (which should be impossible).
Fixes: #1005
Requirements / Checklist
What does this Pull Request (PR) do?
Allow patching with custom sets that contain the
notdef
glyph.How should this be manually tested?
Any background context you can provide?
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)