From 683734abba82191ce1654f8b93436a4a59474be8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 1 Jan 2024 00:32:17 +0000 Subject: [PATCH] chore: change batteries --- bin/scripts/name_parser/FontnameParser.py | 16 +--------- font-patcher | 37 ++++++++++------------ src/glyphs/original-source.otf | Bin 154520 -> 154680 bytes 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/bin/scripts/name_parser/FontnameParser.py b/bin/scripts/name_parser/FontnameParser.py index f4b64aa..5768c42 100644 --- a/bin/scripts/name_parser/FontnameParser.py +++ b/bin/scripts/name_parser/FontnameParser.py @@ -180,24 +180,10 @@ class FontnameParser: sub = FontnameTools.postscript_char_filter(sub) return self._make_ps_name(fam + sub, False) - def long_family(self): - """Get unabbreviated Familyname""" - (name, rest) = self._shortened_name() - return FontnameTools.concat(name, rest, self.other_token, self.family_suff) - - def long_subfamily(self): - """Get unabbreviated Styles""" - return FontnameTools.concat(self.weight_token, self.style_token) - def preferred_family(self): """Get the SFNT Preferred Familyname (ID 16)""" (name, rest) = self._shortened_name() - other = self.other_token - weights = self.weight_token - aggressive = self.use_short_families[2] - if self.use_short_families[1]: - [ other, weights ] = FontnameTools.short_styles([ other, weights ], aggressive) - pfn = FontnameTools.concat(name, rest, other, self.short_family_suff) + 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 '' diff --git a/font-patcher b/font-patcher index 386d1e8..84ae5a1 100755 --- a/font-patcher +++ b/font-patcher @@ -1,14 +1,14 @@ #!/usr/bin/env python # coding=utf8 -# Nerd Fonts Version: 3.1.0 +# Nerd Fonts Version: 3.1.1 # Script version is further down from __future__ import absolute_import, print_function, unicode_literals # Change the script version when you edit this script: -script_version = "4.8.1" +script_version = "4.8.3" -version = "3.1.0" +version = "3.1.1" projectName = "Nerd Fonts" projectNameAbbreviation = "NF" projectNameSingular = projectName[:-1] @@ -306,20 +306,16 @@ def get_old_average_x_width(font): s += font[g].width * weights[g] return int(s / 1000) -def create_filename(patcher, fonts): +def create_filename(fonts): """ Determine filename from font object(s) """ - pfam = patcher.long_family - psubfam = patcher.long_subfamily sfnt = { k: v for l, k, v in fonts[0].sfnt_names } - if not pfam: - pfam = sfnt.get('Preferred Family', sfnt['Family']) - if not psubfam or len(psubfam) < 1: - psubfam = sfnt.get('Preferred Styles', sfnt['SubFamily']) + sfnt_pfam = sfnt.get('Preferred Family', sfnt['Family']) + sfnt_psubfam = sfnt.get('Preferred Styles', sfnt['SubFamily']) if len(fonts) > 1: - return pfam.replace(' ', '') - if len(psubfam) > 0: - psubfam = '-' + psubfam - return (pfam + psubfam).replace(' ', '') + return sfnt_pfam + if len(sfnt_psubfam) > 0: + sfnt_psubfam = '-' + sfnt_psubfam + return (sfnt_pfam + sfnt_psubfam).replace(' ', '') class font_patcher: @@ -337,8 +333,6 @@ class font_patcher: self.essential = set() self.config = configparser.ConfigParser(empty_lines_in_values=False, allow_no_value=True) self.xavgwidth = [] # list of ints - self.long_family = None - self.long_subfamily = None def patch(self, font): self.sourceFont = font @@ -432,11 +426,11 @@ class font_patcher: break outfile = os.path.normpath(os.path.join( sanitize_filename(self.args.outputdir, True), - sanitize_filename(create_filename(self, sourceFonts)) + ".ttc")) + sanitize_filename(create_filename(sourceFonts)) + ".ttc")) sourceFonts[0].generateTtc(outfile, sourceFonts[1:], flags=gen_flags, layer=layer) message = " Generated {} fonts\n \===> '{}'".format(len(sourceFonts), outfile) else: - fontname = create_filename(self, sourceFonts) + fontname = create_filename(sourceFonts) if not fontname: fontname = sourceFont.cidfontname outfile = os.path.normpath(os.path.join( @@ -755,8 +749,6 @@ class font_patcher: # inject_suffix(family, ps_fontname, short_family) n.inject_suffix(verboseAdditionalFontNameSuffix, ps_suffix, short_family) n.rename_font(font) - self.long_family = n.long_family() - self.long_subfamily = n.long_subfamily() font.comment = projectInfo font.fontlog = projectInfo @@ -1220,7 +1212,7 @@ class font_patcher: 'height': self.sourceFont.descent + self.sourceFont.ascent, } our_btb = self.sourceFont.descent + self.sourceFont.ascent - elif self.font_dim['height'] < 0: + if self.font_dim['height'] <= 0: logger.critical("Can not detect sane font height") sys.exit(1) @@ -1274,6 +1266,9 @@ class font_patcher: if self.font_dim['width'] < self.font_dim['xmax']: logger.debug("Font has negative right side bearing in extended glyphs") self.font_dim['xmax'] = self.font_dim['width'] # In fact 'xmax' is never used + 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']) self.xavgwidth.append(self.args.xavgwidth) diff --git a/src/glyphs/original-source.otf b/src/glyphs/original-source.otf index 422fc3dec336a2e6b971243a1072d7c3748ae2e6..ed81a903147917b2af14e632715d5e007ea677c8 100644 GIT binary patch delta 545 zcmXw#O=uHQ5Xa}e7dLELNvhq0q|rb_FVdK7R1_3fQzJxZ0w##1kfv#91hB*1AkBeXrB3QvoC4%NTE%@O7W|-f9W*)Cv6YF)c z97`l(Ac77IT;WK>`}*_6y#QOj0ZqJ#o!TQOzn-=L2;dpXsOiG;!p=5;t%S8`E}I_f zbGk;6&7=0`uwcK*)-Yc|`Esf@)#uyw0O-&&^q181Q~?@sM9@MB6KVBmHa>anB*GB@ z<}T!m8m~bJAMgqd-p##i$J|r1<8sP*XdOCiSO)kq^U3!=R;+KAJ9|8a&f6yN=7TG%bAK7xmu>!3oX}zbd4@Qp=a5tTv zjma*&w??}*@=g!_1=$AA&2d2^;+(i3J``VwAI(+!6|v`RDl=Ks@@fioZgcox_QIGq zlAq9u#(COpUhk?98$ALIvv<2p86B9ONlLRxiPVx3{S_`-oK4SK691$B)H%G|4IDB> zo%4IY6;A7q6%NCK#bNZjW#?p>APFy`y&YG8^Xee-yMBweJyo4U!4I6Qj$?KwqX-<< y-s$}B{U5r-S=ou52b$P3e--(#faFBX;tpJd~hiHkAeg6Pufsp|S z5|VQh3r@|I1In}10L8pAQWI0uxV=vT<>mmfSq4ymeG2m%Ao~gst7PPsRH&)Q7cwwK z$pF|#8>%~u9)7N9T#!^0-#B`|v80b9mh6aTp~Zrtp`xSNsDa1yffqnj2IY<^$hfkCU0T>3RJ&}C4-UcGQ*E6j6be2{kS$+hRs0w z7{4sYWC0+_Ybgj~^T;wV1t$wJ?Ae^oR>H_Wk#jcZcFxnApRjjxvVu+9+$gx7k%?i~ kW)oo}rsho1_DoU6?U|xX-<+qvjAXjFeNPlqH6tSf0C!ts_W%F@