font-patcher: Allow glyphs with altuni for exactEncoding #793
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]
Some symbol fonts might come with glyphs that have multiple codepoints.
When we want to patch them with
'Exact': true
(i.e. at their 'original'codepoints) we want to patch them into the codepoint that has been used
in the selection process. That means between
SymStart
andSymEnd
.But this is not the case. We patch them in into their 'main' codepoint,
which can be outside the expected range of points.
This came up when patching with FontAwesome V6. It has for example these
glyphs:
Glyph 'music' has a main codepoint
0x1F3B5
, but it is present in thefont also on codepoint
0xF001
.Glyph 'heard' has a main codepoint
0x1F9E1
, but it is present in thefont also on codepoints
0x2665
,0x2764
,0xF004
,0xF08A
,0x1F499
, ...When doing a
'Exact': true
patch (i.e. exactEncoding = true) theglyphs is patched into the target font at its (the glyph's) main
codepoint, regardless of our patch-codepoint-range.
[how]
We examine all codepoints that a glyph occupies in the symbol font. From
all these codepoints we take the nearest to the last glyph be patched
in. Nearest means from the possible codepoints the lowest that come
after the previous used codepoint.
For example the 'heard':
Last patched in codepoint was
0xF003
.Main codepoint:
0x1F9E1
Alternate codepoints:
0x2665
,0x2764
,0xF004
,0xF08A
,0x1F499
, ...-=>
0xF004
Later in the patching process we might encounter the same glyph again,
but this time the previous codepoint was
0xF089
, so we need to take0xF08A
.Requirements / Checklist
What does this Pull Request (PR) do?
Put symbol glyphs that have additional unicodes (
altuni
) into the expected (i.e. next possible in the range we work on) codepoint slot.From Fontforge Python Docu:
How should this be manually tested?
Any background context you can provide?
What are the relevant tickets (if any)?
#727 (reply in thread)
Screenshots (if appropriate or helpful)