chore: change batteries

This commit is contained in:
github-actions 2023-03-01 01:47:47 +00:00 committed by Daylin Morgan
parent 718ba2179f
commit 04081cc370
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

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 = "3.5.8" script_version = "3.5.11"
version = "2.3.3" version = "2.3.3"
projectName = "Nerd Fonts" projectName = "Nerd Fonts"
@ -131,7 +131,7 @@ class TableHEADWriter:
def goto(self, where): def goto(self, where):
""" Go to a named location in the file or to the specified index """ """ Go to a named location in the file or to the specified index """
if type(where) is str: if isinstance(where, str):
positions = {'checksumAdjustment': 2+2+4, positions = {'checksumAdjustment': 2+2+4,
'flags': 2+2+4+4+4, 'flags': 2+2+4+4+4,
'lowestRecPPEM': 2+2+4+4+4+2+2+8+8+2+2+2+2+2, 'lowestRecPPEM': 2+2+4+4+4+2+2+8+8+2+2+2+2+2,
@ -448,9 +448,12 @@ class font_patcher:
def setup_font_names(self, font): def setup_font_names(self, font):
print(font.persistent)
font.fontname = font.persistent["fontname"] font.fontname = font.persistent["fontname"]
font.fullname = font.persistent["fullname"] if isinstance(font.persistent["fullname"], str):
font.familyname = font.persistent["familyname"] font.fullname = font.persistent["fullname"]
if isinstance(font.persistent["familyname"], str):
font.familyname = font.persistent["familyname"]
verboseAdditionalFontNameSuffix = " " + projectNameSingular verboseAdditionalFontNameSuffix = " " + projectNameSingular
if self.args.windows: # attempt to shorten here on the additional name BEFORE trimming later if self.args.windows: # attempt to shorten here on the additional name BEFORE trimming later
additionalFontNameSuffix = " " + projectNameAbbreviation additionalFontNameSuffix = " " + projectNameAbbreviation
@ -497,7 +500,7 @@ class font_patcher:
verboseAdditionalFontNameSuffix += " Mono" verboseAdditionalFontNameSuffix += " Mono"
if FontnameParserOK and self.args.makegroups: if FontnameParserOK and self.args.makegroups:
use_fullname = type(font.fullname) == str # Usually the fullname is better to parse use_fullname = isinstance(font.fullname, str) # Usually the fullname is better to parse
# Use fullname if it is 'equal' to the fontname # Use fullname if it is 'equal' to the fontname
if font.fullname: if font.fullname:
use_fullname |= font.fontname.lower() == FontnameTools.postscript_char_filter(font.fullname).lower() use_fullname |= font.fontname.lower() == FontnameTools.postscript_char_filter(font.fullname).lower()
@ -734,6 +737,9 @@ class font_patcher:
""" Creates list of dicts to with instructions on copying glyphs from each symbol font into self.sourceFont """ """ Creates list of dicts to with instructions on copying glyphs from each symbol font into self.sourceFont """
# Supported params: overlap | careful # Supported params: overlap | careful
# Overlap value is used horizontally but vertically limited to 0.01 # Overlap value is used horizontally but vertically limited to 0.01
# The xy-ratio limits the x-scale for a given y-scale to make the ratio <= this value (to prevent over-wide glyphs)
# '1' means occupu 1 cell (default for 'xy')
# '2' means occupy 2 cells (default for 'pa')
# Powerline dividers # Powerline dividers
SYM_ATTR_POWERLINE = { SYM_ATTR_POWERLINE = {
'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}}, 'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}},
@ -751,16 +757,16 @@ class font_patcher:
0xe0b7: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.5}}, 0xe0b7: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'xy-ratio': 0.5}},
# Bottom Triangles # Bottom Triangles
0xe0b8: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02}}, 0xe0b8: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}},
0xe0b9: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, 0xe0b9: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}},
0xe0ba: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02}}, 0xe0ba: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}},
0xe0bb: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, 0xe0bb: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}},
# Top Triangles # Top Triangles
0xe0bc: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02}}, 0xe0bc: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}},
0xe0bd: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, 0xe0bd: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}},
0xe0be: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02}}, 0xe0be: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}},
0xe0bf: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, 0xe0bf: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}},
# Flames # Flames
0xe0c0: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}}, 0xe0c0: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}},
@ -769,25 +775,26 @@ class font_patcher:
0xe0c3: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {}}, 0xe0c3: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {}},
# Small squares # Small squares
0xe0c4: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0c4: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}},
0xe0c5: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0c5: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.86}},
# Bigger squares # Bigger squares
0xe0c6: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0c6: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}},
0xe0c7: {'align': 'r', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0c7: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': -0.03, 'xy-ratio': 0.78}},
# Waveform # Waveform
0xe0c8: {'align': 'l', '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}}, 0xe0ca: {'align': 'r', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.01}},
# Hexagons # Hexagons
0xe0cc: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, 0xe0cc: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'overlap': 0.02, 'xy-ratio': 0.85}},
0xe0cd: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0cd: {'align': 'l', 'valign': 'c', 'stretch': 'xy2', 'params': {'xy-ratio': 0.865}},
# Legos # Legos
0xe0ce: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0ce: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}},
0xe0cf: {'align': 'c', 'valign': 'c', 'stretch': 'xy', 'params': {}}, 0xe0cf: {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {}},
0xe0d1: {'align': 'l', 'valign': 'c', 'stretch': 'xy', 'params': {'overlap': 0.02}}, 0xe0d0: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}},
0xe0d1: {'align': 'l', 'valign': 'c', 'stretch': 'pa', 'params': {}},
# Top and bottom trapezoid # Top and bottom trapezoid
0xe0d2: {'align': 'l', '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}},
@ -895,16 +902,24 @@ class font_patcher:
0xf0ca, # dash 0xf0ca, # dash
]} ]}
WEATH_SCALE_LIST = {'ScaleGroups': [ WEATH_SCALE_LIST = {'ScaleGroups': [
[0xf03c, 0xf042, 0xf045 ], # degree signs
[0xf043, 0xf044, 0xf048, 0xf04b, 0xf04c, 0xf04d, 0xf057, 0xf058, 0xf087, 0xf088], # arrows
range(0xf053, 0xf055 + 1), # thermometers
[*range(0xf059, 0xf061 + 1), 0xf0b1], # wind directions
range(0xf089, 0xf094 + 1), # clocks
range(0xf095, 0xf0b0 + 1), # moon phases range(0xf095, 0xf0b0 + 1), # moon phases
range(0xf0b7, 0xf0c3 + 1), # wind strengths range(0xf0b7, 0xf0c3 + 1), # wind strengths
range(0xf053, 0xf055 + 1), # thermometer [0xf06e, 0xf070 ], # solar/lunar eclipse
[0xf06e, 0xf070 ], # solar eclipse # Note: Codepoints listed before that are also in the following range
[0xf042, 0xf045 ], # degree sign # will take the scaling of the previous group (the ScaleGroups are
]} # searched through in definition order).
MDI_SCALE_LIST = {'ScaleGlyph': 0xf068d, # 'solid' fills complete design space # But be careful, the combined bounding box for the following group
'GlyphsToScale+': [ # _will_ include all glyphs in its definition: Make sure the exempt
(0xf0000, 0xfffff) # all because they are very well scaled already # glyphs from above are smaller (do not extend) the combined bounding
# box of this range:
range(0xf000, 0xf0cb + 1), # lots of clouds and other (Please read note above!)
]} ]}
MDI_SCALE_LIST = None # Maybe later add some selected ScaleGroups
# Define the character ranges # Define the character ranges
# Symbol font ranges # Symbol font ranges
@ -1039,6 +1054,7 @@ class font_patcher:
'width' : self.sourceFont.em, 'width' : self.sourceFont.em,
'height': self.sourceFont.descent + self.sourceFont.ascent, 'height': self.sourceFont.descent + self.sourceFont.ascent,
} }
our_btb = self.sourceFont.descent + self.sourceFont.ascent
elif self.font_dim['height'] < 0: elif self.font_dim['height'] < 0:
sys.exit("{}: Can not detect sane font height".format(projectName)) sys.exit("{}: Can not detect sane font height".format(projectName))
@ -1094,7 +1110,7 @@ class font_patcher:
# For monospaced fonts all chars need to be maximum 'one' space wide # For monospaced fonts all chars need to be maximum 'one' space wide
# other fonts allows double width glyphs for 'pa' or if requested with '2' # other fonts allows double width glyphs for 'pa' or if requested with '2'
if self.args.single or (stretch != 'pa' and '2' not in stretch): if self.args.single or ('pa' not in stretch and '2' not in stretch) or '1' in stretch:
relative_width = 1.0 relative_width = 1.0
else: else:
relative_width = 2.0 relative_width = 2.0
@ -1106,7 +1122,7 @@ class font_patcher:
target_height = self.font_dim['height'] target_height = self.font_dim['height']
scale_ratio_y = target_height / sym_dim['height'] scale_ratio_y = target_height / sym_dim['height']
if stretch == 'pa': if 'pa' in stretch:
# We want to preserve x/y aspect ratio, so find biggest scale factor that allows symbol to fit # We want to preserve x/y aspect ratio, so find biggest scale factor that allows symbol to fit
scale_ratio_x = min(scale_ratio_x, scale_ratio_y) scale_ratio_x = min(scale_ratio_x, scale_ratio_y)
if not self.args.single: if not self.args.single:
@ -1286,14 +1302,13 @@ class font_patcher:
x_align_distance += self.font_dim['width'] - sym_dim['width'] x_align_distance += self.font_dim['width'] - sym_dim['width']
if not self.args.single and '2' in sym_attr['stretch']: if not self.args.single and '2' in sym_attr['stretch']:
x_align_distance += self.font_dim['width'] x_align_distance += self.font_dim['width']
# If symbol glyph is wider than target font cell, just left-align
x_align_distance = max(-sym_dim['xmin'], x_align_distance)
if overlap: if overlap:
overlap_width = self.font_dim['width'] * overlap overlap_width = self.font_dim['width'] * overlap
if sym_attr['align'] == 'l': if sym_attr['align'] == 'l':
x_align_distance -= overlap_width x_align_distance -= overlap_width
if sym_attr['align'] == 'r' and not self.args.nonmono:
# Nonmono is 'left aligned' per definition, translation does not help here
x_align_distance += overlap_width
align_matrix = psMat.translate(x_align_distance, y_align_distance) align_matrix = psMat.translate(x_align_distance, y_align_distance)
self.sourceFont[currentSourceFontGlyph].transform(align_matrix) self.sourceFont[currentSourceFontGlyph].transform(align_matrix)