Merge pull request #1597 from ryanoasis/bugfix/Ubuntu-ligatures

Bugfix Ubuntu ligatures
This commit is contained in:
Fini 2024-04-10 08:07:56 +02:00 committed by GitHub
commit c59bacd90e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View file

@ -6,7 +6,7 @@
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
# Change the script version when you edit this script: # Change the script version when you edit this script:
script_version = "4.13.0" script_version = "4.13.1"
version = "3.2.0" version = "3.2.0"
projectName = "Nerd Fonts" projectName = "Nerd Fonts"
@ -338,9 +338,9 @@ class font_patcher:
def patch(self, font): def patch(self, font):
self.sourceFont = font self.sourceFont = font
self.setup_version() self.setup_version()
self.get_essential_references()
self.assert_monospace() self.assert_monospace()
self.remove_ligatures() self.remove_ligatures()
self.get_essential_references()
self.get_sourcefont_dimensions() self.get_sourcefont_dimensions()
self.setup_patch_set() self.setup_patch_set()
self.improve_line_dimensions() self.improve_line_dimensions()
@ -1135,14 +1135,14 @@ class font_patcher:
# glyphs intact. # glyphs intact.
# 0x0000-0x017f is the Latin Extended-A range # 0x0000-0x017f is the Latin Extended-A range
# 0xfb00-0xfb06 are 'fi' and other ligatures # 0xfb00-0xfb06 are 'fi' and other ligatures
basic_glyphs = set() basic_glyphs = { c for c in range(0x21, 0x17f + 1) if c in self.sourceFont }
# Collect substitution destinations # Collect substitution destinations
for glyph in [*range(0x21, 0x17f + 1), *range(0xfb00, 0xfb06 + 1)]: for glyph in list(basic_glyphs) + [*range(0xfb00, 0xfb06 + 1)]:
if not glyph in self.sourceFont: if not glyph in self.sourceFont:
continue continue
basic_glyphs.add(glyph)
for possub in self.sourceFont[glyph].getPosSub('*'): for possub in self.sourceFont[glyph].getPosSub('*'):
if possub[1] == 'Substitution' or possub[1] == 'Ligature': if possub[1] == 'Substitution' or possub[1] == 'Ligature':
basic_glyphs.add(glyph)
basic_glyphs.add(self.sourceFont[possub[2]].unicode) basic_glyphs.add(self.sourceFont[possub[2]].unicode)
basic_glyphs.discard(-1) # the .notdef glyph basic_glyphs.discard(-1) # the .notdef glyph
for glyph in basic_glyphs: for glyph in basic_glyphs:

View file

@ -13,6 +13,8 @@ you are expressly encouraged to experiment, modify, share and improve.
http://font.ubuntu.com/ http://font.ubuntu.com/
The `fi`, `fl`, and similar ligatures are removed because they would block some Font Awesome glyphs.
Version: 0.83 Version: 0.83
## Preprocessed Source Font ## Preprocessed Source Font

View file

@ -0,0 +1,5 @@
[Subtables]
ligatures: [
"'liga' Standard Ligatures in Latin lookup 20 subtable",
"'liga' Standard Ligatures in Greek lookup 21 subtable",
"'liga' Standard Ligatures in Cyrillic lookup 22 subtable" ]