chore: change batteries

This commit is contained in:
github-actions 2023-06-15 00:32:20 +00:00
parent d8c928efe8
commit af5d4c007a
2 changed files with 19 additions and 16 deletions

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 = "4.3.4" script_version = "4.4.0"
version = "3.0.1" version = "3.0.1"
projectName = "Nerd Fonts" projectName = "Nerd Fonts"
@ -334,7 +334,6 @@ class font_patcher:
self.sourceFont = font self.sourceFont = font
self.setup_version() self.setup_version()
self.get_essential_references() self.get_essential_references()
self.setup_name_backup(font)
self.assert_monospace() self.assert_monospace()
self.remove_ligatures() self.remove_ligatures()
self.get_sourcefont_dimensions() self.get_sourcefont_dimensions()
@ -434,14 +433,14 @@ class font_patcher:
sanitize_filename(self.args.outputdir, True), sanitize_filename(self.args.outputdir, True),
sanitize_filename(fontname) + self.args.extension)) sanitize_filename(fontname) + self.args.extension))
bitmaps = str() bitmaps = str()
if len(self.sourceFont.bitmapSizes): if len(sourceFont.bitmapSizes):
logger.debug("Preserving bitmaps %s", repr(self.sourceFont.bitmapSizes)) logger.debug("Preserving bitmaps %s", repr(sourceFont.bitmapSizes))
bitmaps = str('otf') # otf/ttf, both is bf_ttf bitmaps = str('otf') # otf/ttf, both is bf_ttf
if self.args.dry_run: if self.args.dry_run:
logger.debug("=====> Filename '%s'", outfile) logger.debug("=====> Filename '%s'", outfile)
return return
sourceFont.generate(outfile, bitmap_type=bitmaps, flags=gen_flags) sourceFont.generate(outfile, bitmap_type=bitmaps, flags=gen_flags)
message = " {}\n \===> '{}'".format(self.sourceFont.fullname, outfile) message = " {}\n \===> '{}'".format(sourceFont.fullname, outfile)
# Adjust flags that can not be changed via fontforge # Adjust flags that can not be changed via fontforge
if re.search('\\.[ot]tf$', self.args.font, re.IGNORECASE) and re.search('\\.[ot]tf$', outfile, re.IGNORECASE): if re.search('\\.[ot]tf$', self.args.font, re.IGNORECASE) and re.search('\\.[ot]tf$', outfile, re.IGNORECASE):
@ -451,7 +450,7 @@ class font_patcher:
for idx in range(source_font.num_fonts): for idx in range(source_font.num_fonts):
logger.debug("Tweaking %d/%d", idx + 1, source_font.num_fonts) logger.debug("Tweaking %d/%d", idx + 1, source_font.num_fonts)
xwidth_s = '' xwidth_s = ''
xwidth = self.xavgwidth[idx] xwidth = self.xavgwidth[idx] if len(self.xavgwidth) > idx else None
if isinstance(xwidth, int): if isinstance(xwidth, int):
if isinstance(xwidth, bool) and xwidth: if isinstance(xwidth, bool) and xwidth:
source_font.find_table([b'OS/2'], idx) source_font.find_table([b'OS/2'], idx)
@ -707,7 +706,9 @@ class font_patcher:
fullname = replace_font_name(fullname, additionalFontNameReplacements2) fullname = replace_font_name(fullname, additionalFontNameReplacements2)
fontname = replace_font_name(fontname, additionalFontNameReplacements2) fontname = replace_font_name(fontname, additionalFontNameReplacements2)
if not (FontnameParserOK and self.args.makegroups > 0): if self.args.makegroups < 0:
logger.warning("Renaming disabled! Make sure to comply with font license, esp RFN clause!")
elif not (FontnameParserOK and self.args.makegroups > 0):
# replace any extra whitespace characters: # replace any extra whitespace characters:
font.familyname = " ".join(familyname.split()) font.familyname = " ".join(familyname.split())
font.fullname = " ".join(fullname.split()) font.fullname = " ".join(fullname.split())
@ -1830,17 +1831,18 @@ def setup_arguments():
parser.add_argument('-ext', '--extension', dest='extension', default="", type=str, nargs='?', help='Change font file type to create (e.g., ttf, otf)') parser.add_argument('-ext', '--extension', dest='extension', default="", type=str, nargs='?', help='Change font file type to create (e.g., ttf, otf)')
parser.add_argument('-out', '--outputdir', dest='outputdir', default=".", type=str, nargs='?', help='The directory to output the patched font file to') parser.add_argument('-out', '--outputdir', dest='outputdir', default=".", type=str, nargs='?', help='The directory to output the patched font file to')
parser.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/src/glyphs/", type=str, nargs='?', help='Path to glyphs to be used for patching') parser.add_argument('--glyphdir', dest='glyphdir', default=__dir__ + "/src/glyphs/", type=str, nargs='?', help='Path to glyphs to be used for patching')
parser.add_argument('--makegroups', dest='makegroups', default=1, type=int, nargs='?', help='Use alternative method to name patched fonts (recommended)', const=1, choices=range(0, 6 + 1)) parser.add_argument('--makegroups', dest='makegroups', default=1, type=int, nargs='?', help='Use alternative method to name patched fonts (recommended)', const=1, choices=range(-1, 6 + 1))
# --makegroup has an additional undocumented numeric specifier. '--makegroup' is in fact '--makegroup 1'. # --makegroup has an additional undocumented numeric specifier. '--makegroup' is in fact '--makegroup 1'.
# Original font name: Hugo Sans Mono ExtraCondensed Light Italic # Original font name: Hugo Sans Mono ExtraCondensed Light Italic
# NF Fam agg. # NF Fam agg.
# 0 turned off, use old naming scheme [-] [-] [-] # -1 no renaming at all (keep old names and versions etc) --- --- ---
# 1 HugoSansMono Nerd Font ExtraCondensed Light Italic [ ] [ ] [ ] # 0 turned off, use old naming scheme [-] [-] [-]
# 2 HugoSansMono Nerd Font ExtCn Light Italic [ ] [X] [ ] # 1 HugoSansMono Nerd Font ExtraCondensed Light Italic [ ] [ ] [ ]
# 3 HugoSansMono Nerd Font XCn Lt It [ ] [X] [X] # 2 HugoSansMono Nerd Font ExtCn Light Italic [ ] [X] [ ]
# 4 HugoSansMono NF ExtraCondensed Light Italic [X] [ ] [ ] # 3 HugoSansMono Nerd Font XCn Lt It [ ] [X] [X]
# 5 HugoSansMono NF ExtCn Light Italic [X] [X] [ ] # 4 HugoSansMono NF ExtraCondensed Light Italic [X] [ ] [ ]
# 6 HugoSansMono NF XCn Lt It [X] [X] [X] # 5 HugoSansMono NF ExtCn Light Italic [X] [X] [ ]
# 6 HugoSansMono NF XCn Lt It [X] [X] [X]
parser.add_argument('--variable-width-glyphs', dest='nonmono', default=False, action='store_true', help='Do not adjust advance width (no "overhang")') parser.add_argument('--variable-width-glyphs', dest='nonmono', default=False, action='store_true', help='Do not adjust advance width (no "overhang")')
parser.add_argument('--has-no-italic', dest='noitalic', default=False, action='store_true', help='Font family does not have Italic (but Oblique)') parser.add_argument('--has-no-italic', dest='noitalic', default=False, action='store_true', help='Font family does not have Italic (but Oblique)')
@ -2007,6 +2009,7 @@ def main():
subfont) subfont)
sys.exit(1) sys.exit(1)
patcher.setup_name_backup(sourceFonts[-1])
patcher.patch(sourceFonts[-1]) patcher.patch(sourceFonts[-1])
print("Done with Patch Sets, generating font...") print("Done with Patch Sets, generating font...")

Binary file not shown.