diff --git a/bin/scripts/name_parser/FontnameParser.py b/bin/scripts/name_parser/FontnameParser.py index 5768c42..1621ceb 100644 --- a/bin/scripts/name_parser/FontnameParser.py +++ b/bin/scripts/name_parser/FontnameParser.py @@ -180,16 +180,29 @@ class FontnameParser: sub = FontnameTools.postscript_char_filter(sub) return self._make_ps_name(fam + sub, False) - def preferred_family(self): + def preferred_family(self, short_alternative = False): """Get the SFNT Preferred Familyname (ID 16)""" + # When short_alternative we get the short named alternative needed for some Windows applications (name, rest) = self._shortened_name() + if short_alternative: + # Try to come up with a shortened family name + # This is in principle the code from family() but without including weights + # because weights shall still end up in ID 17 + other = self.other_token + if self.use_short_families[1]: + [ other ] = FontnameTools.short_styles([ other ], self.use_short_families[2]) + pfn = FontnameTools.concat(name, rest, other, self.short_family_suff) + # Only return something if it is different to our standard behavior + if pfn == self.preferred_family(False): + return '' + return pfn pfn = FontnameTools.concat(name, rest, self.other_token, self.family_suff) if self.suppress_preferred_if_identical and pfn == self.family(): # Do not set if identical to ID 1 return '' return pfn - def preferred_styles(self): + def preferred_styles(self, _ = False): """Get the SFNT Preferred Styles (ID 17)""" styles = self.style_token weights = self.weight_token @@ -231,7 +244,7 @@ class FontnameParser: def ps_familyname(self): """Get the PS Familyname""" - fam = self.preferred_family() + fam = self.preferred_family(False) if len(fam) < 1: fam = self.family() return self._make_ps_name(fam, True) @@ -296,6 +309,18 @@ class FontnameParser: os2_weight, ps_weight, name_weight, font.os2_weight, font.weight, weight)) + def pfam_to_sfnt(self, name_function, entry, message): + """Prepare SFNT entries for short and long form as two different languages""" + languages = [ 'English (US)', 'English (British)' ] + names = [ name_function(False), name_function(True) ] + ret = [ ] + for i in range(2): + if len(names[i]): + ret += [( languages[i], entry, self.checklen(31, message, names[i]) )] + else: + break + return ret + def rename_font(self, font): """Rename the font to include all information we found (font is fontforge font object)""" font.fondname = None @@ -339,9 +364,9 @@ class FontnameParser: # back, but only as 'English (US)'. This makes sure we do not leave contradicting # names over different languages. for l, k, v in list(font.sfnt_names): - if not k in TO_DEL: + if not k in TO_DEL and l == 'English (US)': sfnt_list += [( l, k, v )] - if k == 'Version' and l == 'English (US)': + if k == 'Version': version_tag = ' ' + v.split()[-1] sfnt_list += [( 'English (US)', 'Family', self.checklen(31, 'Family (ID 1)', self.family()) )] # 1 @@ -349,13 +374,8 @@ class FontnameParser: sfnt_list += [( 'English (US)', 'UniqueID', self.fullname() + version_tag )] # 3 sfnt_list += [( 'English (US)', 'Fullname', self.checklen(63, 'Fullname (ID 4)', self.fullname()) )] # 4 sfnt_list += [( 'English (US)', 'PostScriptName', self.checklen(63, 'PSN (ID 6)', self.psname()) )] # 6 - - p_fam = self.preferred_family() - if len(p_fam): - sfnt_list += [( 'English (US)', 'Preferred Family', self.checklen(31, 'PrefFamily (ID 16)', p_fam) )] # 16 - p_sty = self.preferred_styles() - if len(p_sty): - sfnt_list += [( 'English (US)', 'Preferred Styles', self.checklen(31, 'PrefStyles (ID 17)', p_sty) )] # 17 + sfnt_list += self.pfam_to_sfnt(self.preferred_family, 'Preferred Family', 'PrefFamily (ID 16)') # 16 + sfnt_list += self.pfam_to_sfnt(self.preferred_styles, 'Preferred Styles', 'PrefStyles (ID 17)') # 17 font.sfnt_names = tuple(sfnt_list) diff --git a/bin/scripts/name_parser/FontnameTools.py b/bin/scripts/name_parser/FontnameTools.py index 1806856..39eb4c4 100644 --- a/bin/scripts/name_parser/FontnameTools.py +++ b/bin/scripts/name_parser/FontnameTools.py @@ -219,6 +219,7 @@ class FontnameTools: ( '(.*r)adon', r'\1n'), # Monaspace shorten face name ( '(im ?writing ?q)uattro', r'\1uat'), # Rename iM Writing Quattro to Quat ( '(im ?writing ?(mono|duo|quat)) ?s', r'\1'), # Remove S from all iM Writing styles + ( '(r)ec( ?)(m)ono( ?)(s)emicasual', r'\1ec\3ono\5emi'), # Shorten RecMonoSemicausal ] # From https://adobe-type-tools.github.io/font-tech-notes/pdfs/5088.FontNames.pdf diff --git a/font-patcher b/font-patcher index 0ee19f0..28b82cc 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 = "4.8.4" +script_version = "4.12.0" version = "3.1.1" projectName = "Nerd Fonts" @@ -308,7 +308,8 @@ def get_old_average_x_width(font): def create_filename(fonts): """ Determine filename from font object(s) """ - sfnt = { k: v for l, k, v in fonts[0].sfnt_names } + # Only consider the standard (i.e. English-US) names + sfnt = { k: v for l, k, v in fonts[0].sfnt_names if l == 'English (US)' } sfnt_pfam = sfnt.get('Preferred Family', sfnt['Family']) sfnt_psubfam = sfnt.get('Preferred Styles', sfnt['SubFamily']) if len(fonts) > 1: @@ -699,6 +700,7 @@ class font_patcher: 'firasans' : 'furasans', 'IntelOneMono' : 'IntoneMono', 'IntelOne Mono' : 'Intone Mono', + 'Intel One Mono' : 'Intone Mono', } # remove overly verbose font names @@ -839,6 +841,7 @@ class font_patcher: # '1' means occupu 1 cell (default for 'xy') # '2' means occupy 2 cells (default for 'pa') # '!' means do the 'pa' scaling even with non mono fonts (else it just scales down, never up) + # '^' means that scaling shall fill the whole cell and not only the icon-cap-height (for mono fonts, other always use the whole cell) # Dont_copy does not overwrite existing glyphs but rescales the preexisting ones # # Be careful, stretch may not change within a ScaleRule! @@ -847,63 +850,67 @@ class font_patcher: 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}} } SYM_ATTR_POWERLINE = { - 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}}, + 'default': {'align': 'c', 'valign': 'c', 'stretch': '^pa', 'params': {}}, # Arrow tips - 0xe0b0: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.7}}, - 0xe0b1: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.7}}, - 0xe0b2: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.7}}, - 0xe0b3: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.7}}, + 0xe0b0: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.7}}, + 0xe0b1: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'xy-ratio': 0.7}}, + 0xe0b2: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.7}}, + 0xe0b3: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'xy-ratio': 0.7}}, + + # Inverse arrow tips + 0xe0d6: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.05, 'xy-ratio': 0.7}}, + 0xe0d7: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.05, 'xy-ratio': 0.7}}, # Rounded arcs - 0xe0b4: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.01, 'xy-ratio': 0.59}}, - 0xe0b5: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.5}}, - 0xe0b6: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.01, 'xy-ratio': 0.59}}, - 0xe0b7: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.5}}, + 0xe0b4: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.59}}, + 0xe0b5: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'xy-ratio': 0.5}}, + 0xe0b6: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.06, 'xy-ratio': 0.59}}, + 0xe0b7: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'xy-ratio': 0.5}}, # Bottom Triangles - 0xe0b8: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, - 0xe0b9: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, - 0xe0ba: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, - 0xe0bb: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}}, + 0xe0b8: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02}}, + 0xe0b9: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {}}, + 0xe0ba: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02}}, + 0xe0bb: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {}}, # Top Triangles - 0xe0bc: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, - 0xe0bd: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, - 0xe0be: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, - 0xe0bf: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}}, + 0xe0bc: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02}}, + 0xe0bd: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {}}, + 0xe0be: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02}}, + 0xe0bf: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {}}, # Flames - 0xe0c0: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}}, - 0xe0c1: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, - 0xe0c2: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}}, - 0xe0c3: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, + 0xe0c0: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': 0.01}}, + 0xe0c1: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {}}, + 0xe0c2: {'align': 'r', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': 0.01}}, + 0xe0c3: {'align': 'r', 'valign': 'c', 'stretch': '^xy2', 'params': {}}, # Small squares - 0xe0c4: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}}, - 0xe0c5: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}}, + 0xe0c4: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}}, + 0xe0c5: {'align': 'r', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}}, # Bigger squares - 0xe0c6: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}}, - 0xe0c7: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}}, + 0xe0c6: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}}, + 0xe0c7: {'align': 'r', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}}, # Waveform - 0xe0c8: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}}, - 0xe0ca: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}}, + 0xe0c8: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': 0.01}}, + 0xe0ca: {'align': 'r', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': 0.01}}, # Hexagons - 0xe0cc: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02, 'xy-ratio': 0.85}}, - 0xe0cd: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'xy-ratio': 0.865}}, + 0xe0cc: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'overlap': 0.02, 'xy-ratio': 0.85}}, + 0xe0cd: {'align': 'l', 'valign': 'c', 'stretch': '^xy2', 'params': {'xy-ratio': 0.865}}, # Legos - 0xe0ce: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}}, - 0xe0cf: {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}}, - 0xe0d0: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}}, - 0xe0d1: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}}, + 0xe0ce: {'align': 'l', 'valign': 'c', 'stretch': '^pa', 'params': {}}, + 0xe0cf: {'align': 'c', 'valign': 'c', 'stretch': '^pa', 'params': {}}, + 0xe0d0: {'align': 'l', 'valign': 'c', 'stretch': '^pa', 'params': {}}, + 0xe0d1: {'align': 'l', 'valign': 'c', 'stretch': '^pa', 'params': {}}, # Top and bottom trapezoid - 0xe0d2: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02, 'xy-ratio': 0.7}}, - 0xe0d4: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02, 'xy-ratio': 0.7}} + 0xe0d2: {'align': 'l', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02, 'xy-ratio': 0.7}}, + 0xe0d4: {'align': 'r', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02, 'xy-ratio': 0.7}} } SYM_ATTR_TRIGRAPH = { 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa1!', 'params': {'overlap': -0.10, 'careful': True}} @@ -921,7 +928,7 @@ class font_patcher: 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa1!', 'params': {'ypadding': 0.3, 'careful': True}} } SYM_ATTR_BOX = { - 'default': {'align': 'c', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02, 'dont_copy': box_keep}}, + 'default': {'align': 'c', 'valign': 'c', 'stretch': '^xy', 'params': {'overlap': 0.02, 'dont_copy': box_keep}}, # No overlap with checkered greys (commented out because that raises problems on rescaling clients) # 0x2591: {'align': 'c', 'valign': 'c', 'stretch': 'xy', 'params': {'dont_copy': box_keep}}, # 0x2592: {'align': 'c', 'valign': 'c', 'stretch': 'xy', 'params': {'dont_copy': box_keep}}, @@ -985,8 +992,15 @@ class font_patcher: range(0x2594, 0x259f + 1), # quards (Note: quard 2597 in Hack is wrong, scales like block!) ]} CODI_SCALE_LIST = {'ScaleGroups': [ - range(0xeb6e, 0xeb71 + 1), # triangles + [0xea61, 0xeb13], # lightbulb range(0xeab4, 0xeab7 + 1), # chevrons + [0xea7d, *range(0xea99, 0xeaa1 + 1), 0xebcb], # arrows + [0xeaa2, 0xeb9a, 0xec08, 0xec09], # bells + range(0xead4, 0xead6 + 1), # dot and arrow + [0xeb43, 0xec0b, 0xec0c], # (pull) request changes + range(0xeb6e, 0xeb71 + 1), # triangles + [*range(0xeb89, 0xeb8b + 1), 0xec07], # smallish dots + range(0xebd5, 0xebd7 + 1), # compasses ]} DEVI_SCALE_LIST = {'ScaleGlyph': 0xE60E, # Android logo 'GlyphsToScale': [ @@ -1056,14 +1070,14 @@ class font_patcher: {'Enabled': True, 'Name': "Seti-UI + Custom", 'Filename': "original-source.otf", 'Exact': False, 'SymStart': 0xE4FA, 'SymEnd': 0xE5FF, 'SrcStart': 0xE5FA, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': True, 'Name': "Heavy Angle Brackets", 'Filename': "extraglyphs.sfd", 'Exact': True, 'SymStart': 0x276C, 'SymEnd': 0x2771, 'SrcStart': None, 'ScaleRules': HEAVY_SCALE_LIST, 'Attributes': SYM_ATTR_HEAVYBRACKETS}, {'Enabled': box_enabled, 'Name': "Box Drawing", 'Filename': "extraglyphs.sfd", 'Exact': True, 'SymStart': 0x2500, 'SymEnd': 0x259F, 'SrcStart': None, 'ScaleRules': BOX_SCALE_LIST, 'Attributes': SYM_ATTR_BOX}, - {'Enabled': True, 'Name': "Devicons", 'Filename': "devicons.ttf", 'Exact': False, 'SymStart': 0xE600, 'SymEnd': 0xE6C5, 'SrcStart': 0xE700, 'ScaleRules': DEVI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, + {'Enabled': True, 'Name': "Devicons", 'Filename': "devicons/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}, - {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0A3, 'SymEnd': 0xE0A3, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, - {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0B4, 'SymEnd': 0xE0C8, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, - {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0CA, 'SymEnd': 0xE0CA, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, - {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0CC, 'SymEnd': 0xE0D4, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, - {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0x2630, 'SymEnd': 0x2630, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_TRIGRAPH}, + {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "powerline-extra/PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0A3, 'SymEnd': 0xE0A3, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, + {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "powerline-extra/PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0B4, 'SymEnd': 0xE0C8, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, + {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "powerline-extra/PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0CA, 'SymEnd': 0xE0CA, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, + {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "powerline-extra/PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0xE0CC, 'SymEnd': 0xE0D7, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_POWERLINE}, + {'Enabled': self.args.powerlineextra, 'Name': "Powerline Extra Symbols", 'Filename': "powerline-extra/PowerlineExtraSymbols.otf", 'Exact': True, 'SymStart': 0x2630, 'SymEnd': 0x2630, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_TRIGRAPH}, {'Enabled': self.args.pomicons, 'Name': "Pomicons", 'Filename': "Pomicons.otf", 'Exact': True, 'SymStart': 0xE000, 'SymEnd': 0xE00A, 'SrcStart': None, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.fontawesome, 'Name': "Font Awesome", 'Filename': "font-awesome/FontAwesome.otf", 'Exact': True, 'SymStart': 0xF000, 'SymEnd': 0xF2E0, 'SrcStart': None, 'ScaleRules': FONTA_SCALE_LIST, 'Attributes': SYM_ATTR_FONTA}, {'Enabled': self.args.fontawesomeextension, 'Name': "Font Awesome Extension", 'Filename': "font-awesome-extension.ttf", 'Exact': False, 'SymStart': 0xE000, 'SymEnd': 0xE0A9, 'SrcStart': 0xE200, 'ScaleRules': None, 'Attributes': SYM_ATTR_DEFAULT}, # Maximize @@ -1077,7 +1091,7 @@ class font_patcher: {'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons/octicons.ttf", 'Exact': True, 'SymStart': 0x2665, 'SymEnd': 0x2665, 'SrcStart': None, 'ScaleRules': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Heart {'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.codicons, 'Name': "Codicons", 'Filename': "codicons/codicon.ttf", 'Exact': True, 'SymStart': 0xEA60, 'SymEnd': 0xEC1E, 'SrcStart': None, 'ScaleRules': CODI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, {'Enabled': self.args.custom, 'Name': "Custom", 'Filename': self.args.custom, 'Exact': True, 'SymStart': 0x0000, 'SymEnd': 0x0000, 'SrcStart': None, 'ScaleRules': None, 'Attributes': CUSTOM_ATTR} ] @@ -1182,7 +1196,7 @@ class font_patcher: # print("FINI hhea {} typo {} win {} use {} {} {}".format(hhea_btb, typo_btb, win_btb, use_typo, our_btb != hhea_btb, self.sourceFont.fontname)) - self.font_dim = {'xmin': 0, 'ymin': 0, 'xmax': 0, 'ymax': 0, 'width' : 0, 'height': 0, 'ypadding': 0} + self.font_dim = {'xmin': 0, 'ymin': 0, 'xmax': 0, 'ymax': 0, 'width' : 0, 'height': 0, 'iconheight': 0, 'ypadding': 0} if metrics == Metric.HHEA: self.font_dim['ymin'] = self.sourceFont.hhea_descent - half_gap(self.sourceFont.hhea_linegap, False) @@ -1204,18 +1218,28 @@ class font_patcher: # Assume we are using our prepared templates self.symbolsonly = True self.font_dim = { - 'xmin' : 0, - 'ymin' : -self.sourceFont.descent, - 'xmax' : self.sourceFont.em, - 'ymax' : self.sourceFont.ascent, - 'width' : self.sourceFont.em, - 'height': self.sourceFont.descent + self.sourceFont.ascent, + 'xmin' : 0, + 'ymin' : -self.sourceFont.descent, + 'xmax' : self.sourceFont.em, + 'ymax' : self.sourceFont.ascent, + 'width' : self.sourceFont.em, + 'height' : self.sourceFont.descent + self.sourceFont.ascent, + 'iconheight': self.sourceFont.descent + self.sourceFont.ascent, + 'ypadding' : 0, } our_btb = self.sourceFont.descent + self.sourceFont.ascent if self.font_dim['height'] <= 0: logger.critical("Can not detect sane font height") sys.exit(1) + self.font_dim['iconheight'] = self.font_dim['height'] + if self.args.single and self.sourceFont.capHeight > 0: + # Limit the icon height on monospaced fonts because very slender and tall icons render + # excessivly tall otherwise. We ignore that effect for the other variants because it + # does not look so much out of place there. + # Icons can be bigger than the letter capitals, but not the whole cell: + self.font_dim['iconheight'] = (self.sourceFont.capHeight * 2 + self.font_dim['height']) / 3 + # Make all metrics equal self.sourceFont.os2_typolinegap = 0 self.sourceFont.os2_typoascent = self.font_dim['ymax'] @@ -1269,7 +1293,9 @@ class font_patcher: if self.font_dim['width'] <= 0: logger.critical("Can not detect sane font width") sys.exit(1) - logger.debug("Final font cell dimensions %d w x %d h", self.font_dim['width'], self.font_dim['height']) + logger.debug("Final font cell dimensions %d w x %d h%s", + self.font_dim['width'], self.font_dim['height'], + ' (with icon cell {} h)'.format(int(self.font_dim['iconheight'])) if self.font_dim['iconheight'] != self.font_dim['height'] else '') self.xavgwidth.append(self.args.xavgwidth) if isinstance(self.xavgwidth[-1], int) and self.xavgwidth[-1] == 0: @@ -1295,7 +1321,8 @@ class font_patcher: # font_dim['height'] represents total line height, keep our symbols sized based upon font's em # Use the font_dim['height'] only for explicit 'y' scaling (not 'pa') - target_height = self.font_dim['height'] * (1.0 - self.font_dim['ypadding']) + target_height = self.font_dim['height'] if '^' in stretch else self.font_dim['iconheight'] + target_height *= 1.0 - self.font_dim['ypadding'] scale_ratio_y = target_height / sym_dim['height'] if 'pa' in stretch: diff --git a/src/glyphs/codicons/README.md b/src/glyphs/codicons/README.md new file mode 100644 index 0000000..c746f31 --- /dev/null +++ b/src/glyphs/codicons/README.md @@ -0,0 +1,9 @@ +# Codicons + +For more information have a look at the upstream website: https://github.com/microsoft/vscode-codicons + +## Source bugs fixed + +Glyph 0xEB40 and 0xEB41 are defective in the original font. We fixed that manually. + +Version: 0.0.35 diff --git a/src/glyphs/codicons/codicon.ttf b/src/glyphs/codicons/codicon.ttf index ae1034e..c32cd9d 100644 Binary files a/src/glyphs/codicons/codicon.ttf and b/src/glyphs/codicons/codicon.ttf differ diff --git a/src/glyphs/codicons/codicon_orig.ttf b/src/glyphs/codicons/codicon_orig.ttf new file mode 100644 index 0000000..0694339 Binary files /dev/null and b/src/glyphs/codicons/codicon_orig.ttf differ diff --git a/src/glyphs/devicons/README.md b/src/glyphs/devicons/README.md new file mode 100644 index 0000000..6d0f3ba --- /dev/null +++ b/src/glyphs/devicons/README.md @@ -0,0 +1,12 @@ +# Devicons + +For more information have a look at the upstream website: https://github.com/vorillaz/devicons + +This is taken directly from the repository default branch, which is ahead of release 1.8.0. +We call it 1.8.1 here, but there is no such release. + +## Source bugs fixed + +Glyph 0xE6B6 is defective in the original font. We hand optimized and fixed that. + +Version: 1.8.1 diff --git a/src/glyphs/devicons/devicons.ttf b/src/glyphs/devicons/devicons.ttf new file mode 100644 index 0000000..e882ad5 Binary files /dev/null and b/src/glyphs/devicons/devicons.ttf differ diff --git a/src/glyphs/devicons/devicons_orig.ttf b/src/glyphs/devicons/devicons_orig.ttf new file mode 100644 index 0000000..b4980db Binary files /dev/null and b/src/glyphs/devicons/devicons_orig.ttf differ diff --git a/src/glyphs/original-source.otf b/src/glyphs/original-source.otf index ed81a90..2838fa9 100644 Binary files a/src/glyphs/original-source.otf and b/src/glyphs/original-source.otf differ diff --git a/src/glyphs/powerline-extra/LICENSE b/src/glyphs/powerline-extra/LICENSE new file mode 100644 index 0000000..c71d827 --- /dev/null +++ b/src/glyphs/powerline-extra/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Ryan L McIntyre + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/glyphs/powerline-extra/PowerlineExtraSymbols.otf b/src/glyphs/powerline-extra/PowerlineExtraSymbols.otf new file mode 100644 index 0000000..b1477fe Binary files /dev/null and b/src/glyphs/powerline-extra/PowerlineExtraSymbols.otf differ diff --git a/src/glyphs/powerline-extra/README.md b/src/glyphs/powerline-extra/README.md new file mode 100644 index 0000000..3a50b03 --- /dev/null +++ b/src/glyphs/powerline-extra/README.md @@ -0,0 +1,16 @@ +# Powerline Extra + +For more information have a look at the upstream website: https://github.com/ryanoasis/powerline-extra-symbols + +Version: 1.000 (from about 2016) + +## Source modified + +* Add missing Ice Waveform Mirrored glyph (0xE0CA) +* Add Trigraph Heaven glyph (0x2630) +* Simplify Waveform glyphs (0xE0C8, 0xE0CA) +* Glyph 0xE0B4 and 0xE0B6 got an additional 7% strip on their straight side. +* Add inverse triangular glyphs at 0xE0D6 and 0xE0D7 +* Change version of font to 1.100 + +Version: 1.100 (our version) diff --git a/src/glyphs/powerline-symbols/README.md b/src/glyphs/powerline-symbols/README.md new file mode 100644 index 0000000..858e124 --- /dev/null +++ b/src/glyphs/powerline-symbols/README.md @@ -0,0 +1,9 @@ +# Powerline Symbols + +For more information have a look at the upstream website: https://github.com/powerline/powerline + +## Source modified + +* Glyph 0xE0B0 and 0xE0B2 got an additional 7% strip on their straight side. + +Version: 1.000 (from about 2013)