Skip to content

font-patcher: Break alternative unicode links before patching #1457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Dec 10, 2023

[why]
The D2Coding font has a lot of glyphs shared between multiple unicode codepoints.
Usually we just want to change the glyph on one particular codepoint and not on all linked ones; which will affect codepoints not in our patching ranges.

For example the glyph FULL BLOCK is used by codepoint 2588 and E286. In the Exxx range they have a lot of icons, and also a full block.

[how]
Remove all links on glyphs that we are about to patch over, so that we really just patch the codepoint we want to patch (and have no hidden 'links').

[note]
This could in principle break alts or ligs if they rely on another codepoint that we removed. But breaking ligs is always a possibility when patching over existing glyphs.

[note]
I checked several (not all) fonts in our repertoire, and only D2coding is affected.

Fixes: #1454

Reported-by: @hdd1013

Requirements / Checklist

What does this Pull Request (PR) do?

How should this be manually tested?

Once check one font file of all source-fonts via ... there is a test script for that?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

@Finii Finii force-pushed the bugfix/alternative-codepoints branch from 575cc71 to 1415034 Compare January 15, 2024 17:16
Finii added 3 commits January 15, 2024 18:23
[why]
The D2Coding font has a lot of glyphs shared between multiple unicode
codepoints.
Usually we just want to change the glyph on one particular codepoint
and not on all linked ones; which will affect codepoints not in our
patching ranges.

For example the glyph FULL BLOCK is used by codepoint 2588 and E286. In
the Exxx range they have a lot of icons, and also a full block.

[how]
Remove all links on glyphs that we are about to patch over, so that we
really just patch the codepoint we want to patch (and have no hidden
'links').

[note]
This could in principle break alts or ligs if they rely on another
codepoint that we removed. But breaking ligs is always a possibility
when patching over existing glyphs.

[note]
I checked several (not all) fonts in our repertoire, and only D2coding
is massively affected.

The only other fonts are these with 2 codepoints each:
heavy_data.ttf Removing alternate unicode on F001 (FB01)
heavy_data.ttf Removing alternate unicode on F002 (FB02)
Tinos-Regular.ttf Removing alternate unicode on F001 (FB01)
Tinos-Regular.ttf Removing alternate unicode on F002 (FB02)

Fixes: 1454

Reported-by: @hdd1013
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
For testing we might want to execute one command (e.g. font-patcher run)
once for each source font. We need to decide which of the font files is
a good choice.

[how]
Best would maybe to use the font that is used for the image previews.

We add that information for each font into the 'database'. Then we can
for example do stuff like:

while IFS= read -d $'\n' -r f; do
  ls -l ../../src/unpatched-fonts/"${f}"
done < <(jq -r '.fonts | .[] | ."imagePreviewFontSource"' lib/fonts.json)

This is already utilized for the helper tools that are hid in the
generate-font-image-previews.sh script.

Note that DaddyTimeMono and NerdFontSymbolsOnly has "--ext ttf" set in the
config, so the information provided for that fonts is wrong.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The format string is invalid and results in a runtime error if that
particular warning is issued (which is only the case for Terminus).

[how]
A verbatim percent sign must be encoded as '%%'.

[note]
This has already been fixed before with commit
  f81564f  font-patcher: Fix typo in logger output

but the change has been lost by rebasing :-(

See also #1350

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii force-pushed the bugfix/alternative-codepoints branch from 206af5d to 1c73ee4 Compare January 15, 2024 17:24
@Finii Finii merged commit 393c666 into master Jan 15, 2024
@Finii Finii deleted the bugfix/alternative-codepoints branch January 15, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong character for U+2588 (Full Block) in D2Coding
1 participant