From f0941e3265e95d38a77026116f3fe9a2eb42d84e Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Sat, 11 Nov 2023 23:15:16 +0100 Subject: [PATCH] font-patcher: Allow filename as naming source [why] With Martian Mono we have a font that uses aggressive abbreviation for the weights and styles (two letters mostly) in all name fields. That is very hard to parse. [how] Adding rules that detect these very short abbreviations might trigger in a lot wrong places. As this is the only font that uses that we do not want to risk that. Instead we rewrite the filenames of the source font (Martian Mono) such that it contains all the necessary information and add a new flag to the patcher that allows it to use the filename as naming source. Yes, as in days long past ;-) Signed-off-by: Fini Jastrow --- font-patcher | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/font-patcher b/font-patcher index 9964583b51..7de8650115 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.6.1" +script_version = "4.7.0" version = "3.0.2" projectName = "Nerd Fonts" @@ -582,6 +582,8 @@ class font_patcher: parser_name = font.fullname elif self.args.force_name == 'postscript': parser_name = font.fontname + elif self.args.force_name == 'filename': + parser_name = os.path.basename(font.path).split('.')[0] else: parser_name = self.args.force_name user_supplied_name = True @@ -1899,7 +1901,7 @@ def setup_arguments(): expert_group.add_argument('--has-no-italic', dest='noitalic', default=False, action='store_true', help='Font family does not have Italic (but Oblique), to help create correct RIBBI set') expert_group.add_argument('-l', '--adjust-line-height', dest='adjustLineHeight', default=False, action='store_true', help='Whether to adjust line heights (attempt to center powerline separators more evenly)') expert_group.add_argument('--metrics', dest='metrics', default=None, choices=get_metrics_names(), help='Select vertical metrics source (for problematic cases)') - expert_group.add_argument('--name', dest='force_name', default=None, type=str, help='Specify naming source (\'full\', \'postscript\', or concrete free name-string)') + expert_group.add_argument('--name', dest='force_name', default=None, type=str, help='Specify naming source (\'full\', \'postscript\', \'filename\', or concrete free name-string)') expert_group.add_argument('--postprocess', dest='postprocess', default=False, type=str, help='Specify a Script for Post Processing') progressbars_group_parser = expert_group.add_mutually_exclusive_group(required=False) expert_group.add_argument('--removeligs', '--removeligatures', dest='removeligatures', default=False, action='store_true', help='Removes ligatures specificed in JSON configuration file (needs --configfile)')