mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2024-12-21 22:40:44 -06:00
chore: change batteries
This commit is contained in:
parent
d8c928efe8
commit
af5d4c007a
2 changed files with 19 additions and 16 deletions
19
font-patcher
19
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.3.4"
|
||||
script_version = "4.4.0"
|
||||
|
||||
version = "3.0.1"
|
||||
projectName = "Nerd Fonts"
|
||||
|
@ -334,7 +334,6 @@ class font_patcher:
|
|||
self.sourceFont = font
|
||||
self.setup_version()
|
||||
self.get_essential_references()
|
||||
self.setup_name_backup(font)
|
||||
self.assert_monospace()
|
||||
self.remove_ligatures()
|
||||
self.get_sourcefont_dimensions()
|
||||
|
@ -434,14 +433,14 @@ class font_patcher:
|
|||
sanitize_filename(self.args.outputdir, True),
|
||||
sanitize_filename(fontname) + self.args.extension))
|
||||
bitmaps = str()
|
||||
if len(self.sourceFont.bitmapSizes):
|
||||
logger.debug("Preserving bitmaps %s", repr(self.sourceFont.bitmapSizes))
|
||||
if len(sourceFont.bitmapSizes):
|
||||
logger.debug("Preserving bitmaps %s", repr(sourceFont.bitmapSizes))
|
||||
bitmaps = str('otf') # otf/ttf, both is bf_ttf
|
||||
if self.args.dry_run:
|
||||
logger.debug("=====> Filename '%s'", outfile)
|
||||
return
|
||||
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
|
||||
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):
|
||||
logger.debug("Tweaking %d/%d", idx + 1, source_font.num_fonts)
|
||||
xwidth_s = ''
|
||||
xwidth = self.xavgwidth[idx]
|
||||
xwidth = self.xavgwidth[idx] if len(self.xavgwidth) > idx else None
|
||||
if isinstance(xwidth, int):
|
||||
if isinstance(xwidth, bool) and xwidth:
|
||||
source_font.find_table([b'OS/2'], idx)
|
||||
|
@ -707,7 +706,9 @@ class font_patcher:
|
|||
fullname = replace_font_name(fullname, 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:
|
||||
font.familyname = " ".join(familyname.split())
|
||||
font.fullname = " ".join(fullname.split())
|
||||
|
@ -1830,10 +1831,11 @@ 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('-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('--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'.
|
||||
# Original font name: Hugo Sans Mono ExtraCondensed Light Italic
|
||||
# NF Fam agg.
|
||||
# -1 no renaming at all (keep old names and versions etc) --- --- ---
|
||||
# 0 turned off, use old naming scheme [-] [-] [-]
|
||||
# 1 HugoSansMono Nerd Font ExtraCondensed Light Italic [ ] [ ] [ ]
|
||||
# 2 HugoSansMono Nerd Font ExtCn Light Italic [ ] [X] [ ]
|
||||
|
@ -2007,6 +2009,7 @@ def main():
|
|||
subfont)
|
||||
sys.exit(1)
|
||||
|
||||
patcher.setup_name_backup(sourceFonts[-1])
|
||||
patcher.patch(sourceFonts[-1])
|
||||
|
||||
print("Done with Patch Sets, generating font...")
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue