Skip to content

Commit

Permalink
Merge pull request #1597 from ryanoasis/bugfix/Ubuntu-ligatures
Browse files Browse the repository at this point in the history
Bugfix Ubuntu ligatures
  • Loading branch information
Finii authored Apr 10, 2024
2 parents f88122f + 8516c9c commit c59bacd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from __future__ import absolute_import, print_function, unicode_literals

# Change the script version when you edit this script:
script_version = "4.13.0"
script_version = "4.13.1"

version = "3.2.0"
projectName = "Nerd Fonts"
Expand Down Expand Up @@ -338,9 +338,9 @@ class font_patcher:
def patch(self, font):
self.sourceFont = font
self.setup_version()
self.get_essential_references()
self.assert_monospace()
self.remove_ligatures()
self.get_essential_references()
self.get_sourcefont_dimensions()
self.setup_patch_set()
self.improve_line_dimensions()
Expand Down Expand Up @@ -1135,14 +1135,14 @@ class font_patcher:
# glyphs intact.
# 0x0000-0x017f is the Latin Extended-A range
# 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
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:
continue
basic_glyphs.add(glyph)
for possub in self.sourceFont[glyph].getPosSub('*'):
if possub[1] == 'Substitution' or possub[1] == 'Ligature':
basic_glyphs.add(glyph)
basic_glyphs.add(self.sourceFont[possub[2]].unicode)
basic_glyphs.discard(-1) # the .notdef glyph
for glyph in basic_glyphs:
Expand Down
2 changes: 2 additions & 0 deletions src/unpatched-fonts/Ubuntu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ you are expressly encouraged to experiment, modify, share and improve.

http://font.ubuntu.com/

The `fi`, `fl`, and similar ligatures are removed because they would block some Font Awesome glyphs.

Version: 0.83

## Preprocessed Source Font
Expand Down
5 changes: 5 additions & 0 deletions src/unpatched-fonts/Ubuntu/config.json
Original file line number Diff line number Diff line change
@@ -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" ]

0 comments on commit c59bacd

Please sign in to comment.