Skip to content

Commit

Permalink
feat: apply braille patch to nerd-font-patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
flexiondotorg committed Jul 16, 2024
1 parent 98dd293 commit bb64caf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkgs/nerd-font-patcher/3.1.1/font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ class font_patcher:
if self.args.weather:
additionalFontNameSuffix += " WEA"
verboseAdditionalFontNameSuffix += " Plus Weather Icons"
if self.args.braille:
additionalFontNameSuffix += " B"
verboseAdditionalFontNameSuffix += " Plus Braille Icons"

# add mono signifier to beginning of name suffix
if self.args.single:
Expand Down Expand Up @@ -917,6 +920,10 @@ class font_patcher:
0xf0dd: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}},
0xf0de: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}}
}
SYM_ATTR_BRAILLE = {
# 'pa' == preserve aspect ratio
'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {'overlap': -0.05}}
}
SYM_ATTR_HEAVYBRACKETS = {
'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa1!', 'params': {'ypadding': 0.3, 'careful': True}}
}
Expand Down Expand Up @@ -1047,6 +1054,9 @@ class font_patcher:
# box of this range:
range(0xf000, 0xf0cb + 1), # lots of clouds and other (Please read note above!)
]}
BRAILLE_SCALE_LIST = {'ScaleGroups': [
range(0x2800, 0x28ff + 1), # all Braille glyphs
]}
MDI_SCALE_LIST = None # Maybe later add some selected ScaleGroups


Expand Down Expand Up @@ -1078,6 +1088,7 @@ class font_patcher:
{'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': True, 'SymStart': 0X26A1, 'SymEnd': 0X26A1, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Zap
{'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': False, 'SymStart': 0xF27C, 'SymEnd': 0xF306, 'SrcStart': 0xF4A9, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT},
{'Enabled': self.args.codicons, 'Name': "Codicons", 'Filename': "codicons/codicon.ttf", 'Exact': True, 'SymStart': 0xEA60, 'SymEnd': 0xEBEB, 'SrcStart': None, 'ScaleRules': CODI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT},
{'Enabled': self.args.braille, 'Name': "Braille", 'Filename': "UBraille.ttf", 'Exact': True, 'SymStart': 0x2800, 'SymEnd': 0x28FF, 'SrcStart': None, 'ScaleRules': BRAILLE_SCALE_LIST, 'Attributes': SYM_ATTR_BRAILLE},
{'Enabled': self.args.custom, 'Name': "Custom", 'Filename': self.args.custom, 'Exact': True, 'SymStart': 0x0000, 'SymEnd': 0x0000, 'SrcStart': None, 'ScaleRules': None, 'Attributes': CUSTOM_ATTR}
]

Expand Down Expand Up @@ -1890,6 +1901,7 @@ def setup_arguments():
sym_font_group.add_argument('--powerline', dest='powerline', default=False, action='store_true', help='Add Powerline Glyphs')
sym_font_group.add_argument('--powerlineextra', dest='powerlineextra', default=False, action='store_true', help='Add Powerline Extra Glyphs (https://github.com/ryanoasis/powerline-extra-symbols)')
sym_font_group.add_argument('--weather', dest='weather', default=False, action='store_true', help='Add Weather Icons (https://github.com/erikflowers/weather-icons)')
sym_font_group.add_argument('--braille', dest='braille', default=False, action='store_true', help='Add Braille Glyphs (https://yudit.org/download/fonts/UBraille/)')

expert_group = parser.add_argument_group('Expert Options')
expert_group.add_argument('--boxdrawing', dest='forcebox', default=False, action='store_true', help='Force patching in (over existing) box drawing glyphs')
Expand Down Expand Up @@ -1936,6 +1948,7 @@ def setup_arguments():
args.powerlineextra = True
args.material = True
args.weather = True
args.braille = True

if not args.complete:
sym_font_args = []
Expand Down
Binary file not shown.

0 comments on commit bb64caf

Please sign in to comment.