font-patcher: Fix vanishing fi ligature

[why]
With Ubuntu-Regular the fi and fl ligatures are replaced by some font
awesome icons.

The problem is that the font uses the non-standard F001 and F002
codepoints as intermediate referencve to create the actual ligatures
that are at codepoints FB01 to FB04.

[how]
All the normal ligature codepoints (FB00-FB06) are added to the glyph
reference checker and codepoints that are referenced by these are not
patched.

This means that F001 and F002 stay on the original ligatures and the
Font Awesome icons are missing, but this can not be fixed automatically
and would need to 'rewrite' the references inside the font.

Fixes: #1221

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-05-10 11:09:16 +02:00 committed by Fini
parent 7e2326b86c
commit a3ec4bb22b

View file

@ -1086,10 +1086,11 @@ class font_patcher:
# Sometimes basic glyphs are constructed from multiple other glyphs.
# Find out which other glyphs are also needed to keep the basic
# glyphs intact.
# 0x00-0x17f is the Latin Extended-A range
# 0x0000-0x017f is the Latin Extended-A range
# 0xfb00-0xfb06 are 'fi' and other ligatures
basic_glyphs = set()
# Collect substitution destinations
for glyph in range(0x21, 0x17f + 1):
for glyph in [*range(0x21, 0x17f + 1), *range(0xfb00, 0xfb06 + 1)]:
if not glyph in self.sourceFont:
continue
basic_glyphs.add(glyph)