From 59c5cb5a1f33139b79838f010fafea26623ed046 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 10 Feb 2023 16:24:54 +0100 Subject: [PATCH] font-patcher: Patch in heavy angle brackets [why] The heavy angle brackets (276E and 276F) are used for a lot of prompts, but we do not yet patch them in and a lot of fonts do not bring them themselves. [how] One time rip the glyphs out from Hack and patch them in always, but careful (do not replace existing glyph). We take the whole set 276C - 2771. [note] Usually we should never again need to run the generate-extraglyphs script, we rip them out now and they look good. Whatever Hack does with new versions we can follow but that is optional. Related: #1110 Signed-off-by: Fini Jastrow --- bin/scripts/README.md | 1 + bin/scripts/generate-extraglyphs.py | 32 ++++++++++++++++++++++++++++ font-patcher | 6 +++++- src/glyphs/extraglyphs.sfd | Bin 0 -> 3234 bytes 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 bin/scripts/generate-extraglyphs.py create mode 100644 src/glyphs/extraglyphs.sfd diff --git a/bin/scripts/README.md b/bin/scripts/README.md index 1dd1a4ecf..6d015b6e6 100644 --- a/bin/scripts/README.md +++ b/bin/scripts/README.md @@ -11,6 +11,7 @@ Note: Usually you need to call the scripts in this directory while actually bein * `fpfix.py`: Can be used to set isFixedPitch property in a font [x] * `generate-casks.sh`: Generates cask files for fonts from data in `archives/` [6] * `generate-css.sh`: Generates the Nerd Fonts CCS, which can be used to access the glyphs on a web page, and the Cheat Sheet [1] +* `generate-extraglyphs.py:` Generates `extraglyphs.sfd` from Hack Regular [4] * `generate-fontconfig.sh`: Generates font configuration to enable use of unpatched fonts with Symbols Only Nerd Font [1] * `generate-font-image-previews.sh`: Generates the preview images for `nerdfonts.com` (i.e. gh-pages) [3] * `generate-glyph-info-from-set.py`: Generate the `i_xxx.sh` file from a glyph source (font) file, if the glyphs are named correctly [4] diff --git a/bin/scripts/generate-extraglyphs.py b/bin/scripts/generate-extraglyphs.py new file mode 100755 index 000000000..2dcf3cc39 --- /dev/null +++ b/bin/scripts/generate-extraglyphs.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# Nerd Fonts Version: 2.3.3 +# Script Version: 1.0.0 +# Generates extrasymbols.sfd from Hack + +import os +import fontforge + +srcdir = '../../src' +srcfont = 'unpatched-fonts/Hack/Regular/Hack-Regular.ttf' +outfont = 'glyphs/extraglyphs.sfd' + +print('Opening {}'.format(outfont)) +font = fontforge.open(os.path.join(srcdir, srcfont)) + +font.selection.select( + 0x276C, # medium left-pointing angle bracket + 0x276D, # medium right-pointing angle bracket + 0x276E, # heavy left-pointing angle quotation mark + 0x276F, # heavy right-pointing angle quotation mark + 0x2770, # heavy left-pointing angle bracket + 0x2771, # heavy right-pointing angle bracket +) + +num_icons = len(list(font.selection)) + +font.selection.invert() +font.clear() + +print('Generating {} with {} glyphs'.format(outfont, num_icons)) +font.generate(os.path.join(srcdir, outfont), flags=("no-FFTM-table",)) +font.close() diff --git a/font-patcher b/font-patcher index 8d6d49e0c..534ddcb75 100755 --- a/font-patcher +++ b/font-patcher @@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals # Change the script version when you edit this script: -script_version = "3.5.3" +script_version = "3.5.4" version = "2.3.3" projectName = "Nerd Fonts" @@ -796,6 +796,9 @@ class font_patcher: 0xf0dd: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}}, 0xf0de: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}} } + SYM_ATTR_HEAVYBRACKETS = { + 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {'careful': True}} + } CUSTOM_ATTR = { # 'pa' == preserve aspect ratio @@ -895,6 +898,7 @@ class font_patcher: # Symbol font ranges self.patch_set = [ {'Enabled': True, 'Name': "Seti-UI + Custom", 'Filename': "original-source.otf", 'Exact': False, 'SymStart': 0xE4FA, 'SymEnd': 0xE5AA, 'SrcStart': 0xE5FA, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, + {'Enabled': True, 'Name': "Heavy Angle Brackets", 'Filename': "extraglyphs.sfd", 'Exact': True, 'SymStart': 0x0000, 'SymEnd': 0x0000, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_HEAVYBRACKETS}, {'Enabled': True, 'Name': "Devicons", 'Filename': "devicons.ttf", 'Exact': False, 'SymStart': 0xE600, 'SymEnd': 0xE6C5, 'SrcStart': 0xE700, 'ScaleRules': DEVI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.powerline, 'Name': "Powerline Symbols", 'Filename': "powerline-symbols/PowerlineSymbols.otf", 'Exact': True, 'SymStart': 0xE0A0, 'SymEnd': 0xE0A2, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, {'Enabled': self.args.powerline, 'Name': "Powerline Symbols", 'Filename': "powerline-symbols/PowerlineSymbols.otf", 'Exact': True, 'SymStart': 0xE0B0, 'SymEnd': 0xE0B3, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, diff --git a/src/glyphs/extraglyphs.sfd b/src/glyphs/extraglyphs.sfd new file mode 100644 index 0000000000000000000000000000000000000000..45f63aa61c9947cff1dee3cec0d1355b880b072b GIT binary patch literal 3234 zcmeH~dsGuw9>>E&S0XARP}k=T5(On>@eq z!1@9aMJtF^w$uk`RVt`Z6|1h5%B!N-6&6JV#RXA2L0hH%({uKpo;^Er&dj~{_q)IQ zy}#dQ=FB7;WsafIn2Z21%R`P!VIhu@ERGZ827Dy4SXLk$qd_GE;5k7MZ&3t~!{IA9 zT!C{Gi-1vBqJ|d%l2k}EB(6j-64+}wP756X3kA-AMF0T=SjzzyqHYO*LtT9U$Atq} z-T;-57+@*h-c`W%{nc1O9!_KeX$x5KU^!rg0u~8aVZhdw&SVB5BnpofM`wn>gc`vy zw?B_eF9Md3lq7EnNvRbQ2oSxf7iUmctlKP@?6AIR+SnI1vLI)N&ynN99Jsk5O*Qq z@Tpef=r{oqirEoOl+<4}`C}8k?mm^pV5R(#2E+OQ< z4HzQGGz38f7-5T=`)gl;P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