diff --git a/bin/scripts/name_parser/README.md b/bin/scripts/name_parser/README.md index b304e53bb..fed910789 100644 --- a/bin/scripts/name_parser/README.md +++ b/bin/scripts/name_parser/README.md @@ -48,7 +48,7 @@ Typographically aware applications, on the other hand, get all styles grouped un First experiments showed that the full information can usually be restored already from the file names that our source fonts have. -This new naming is complete optional (but recommended). Give the option `--parser to` font-patcher +This new naming is complete optional (but recommended). Give the option `--makegroups` to `font-patcher` and it will try to come up with reasonable grouping and naming. Leave the option out and it will work as it always did. @@ -60,7 +60,7 @@ In this directory there are two tests. `src/unpatched-fonts/`, then it calculates the naming and compares it to the original naming in the font files. Ideally they would be equal. 2. The second test does a 'production run'. It patches each font in `src/unpatched-fonts/` - and patches it two times: Once without `--parser` and once with. Then it compares the + and patches it two times: Once without `--makegroups` and once with. Then it compares the naming, and it also shows the original font naming (for comparison). All tests base on these assumptions @@ -99,7 +99,7 @@ way changes of the algorithm can be tested with a wide base of inputs. This test compares actually patched fonts. Every font in `src/unpatched-fonts/` is patched two times: First with the 'old/classic' `font-patcher` naming, and second with the new naming -algorithm in action (by specifying `--parser`). Again the name parts are compared with some +algorithm in action (by specifying `--makegroups`). Again the name parts are compared with some lenience and an output generated like test 1 does. Also again a file with known differences (with explanations) is read, and any new or vanished @@ -112,7 +112,7 @@ _Note: Fonts `iosevka-heavyoblique`, `iosevka-term-heavyoblique`, `iosevka-mediu ### Differences -The naming of the patched fonts, if `--parse` is applied, will be different. Of course, that is the goal. +The naming of the patched fonts, if `--makegroups` is applied, will be different. Of course, that is the goal. What are the differences in particular: * `Nerd Font` is not added in the end, but after the extended base name before the style @@ -148,7 +148,7 @@ From the count we see that almost all fonts are affected by incorrect Family nam ### Further steps One can examine all the (current) naming differences in the `name_parser_test2.known_issues` -file. The Explanation is followed by three lines of names: source-file, patched-with-parser, +file. The Explanation is followed by three lines of names: source-file, patched-with-makegroups, and patched-classic. The Explanation sorts most differences into common groups. This helps to weed out @@ -176,7 +176,7 @@ The files consist of entries that spans 3 (for test 1) or 4 (for test 2) lines. |------------------|----------| | # | Reson for the difference (or `AUTOGENERATED`) | | > | Naming fo the original/source font (only test 2) | -| + | Naming with `--parser` (new naming) | +| + | Naming with `--makegroups` (new naming) | | - | Naming classically generated by font-patcher | After any test run a `known_issues.new` file is generated. It contains all the issues diff --git a/bin/scripts/name_parser/name_parser_test2 b/bin/scripts/name_parser/name_parser_test2 index 332f865ef..394d05a6b 100644 --- a/bin/scripts/name_parser/name_parser_test2 +++ b/bin/scripts/name_parser/name_parser_test2 @@ -116,7 +116,7 @@ for filename in sys.argv[1:]: log.write(filename) log.close() - for option in ['--parser', '']: + for option in ['--makegroups', '']: cmd = ['fontforge', '--script', font_patcher, '--powerline', option, filename ] cmd = [ c for c in cmd if len(c) ] ff = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, encoding='utf8') diff --git a/font-patcher b/font-patcher index e14f99b8c..f427c913c 100755 --- a/font-patcher +++ b/font-patcher @@ -310,7 +310,7 @@ class font_patcher: 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('--parser', dest='parser', default=False, action='store_true', help='Use alternative method to name patched fonts (experimental)') + parser.add_argument('--makegroups', dest='makegroups', default=False, action='store_true', help='Use alternative method to name patched fonts (experimental)') # progress bar arguments - https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse progressbars_group_parser = parser.add_mutually_exclusive_group(required=False) @@ -430,7 +430,7 @@ class font_patcher: additionalFontNameSuffix += " M" verboseAdditionalFontNameSuffix += " Mono" - if self.args.parser: + if self.args.makegroups: use_fullname = type(self.sourceFont.fullname) == str # Usually the fullname is better to parse # Use fullname if it is 'equal' to the fontname if self.sourceFont.fullname: @@ -444,12 +444,12 @@ class font_patcher: parser_name = os.path.splitext(os.path.basename(self.args.font))[0] n = FontnameParser(parser_name) if not n.parse_ok: - print("Have only minimal naming information, check resulting name. Maybe omit --parser option") + print("Have only minimal naming information, check resulting name. Maybe omit --makegroups option") n.drop_for_powerline() n.enable_short_families(True, "Noto") n.set_for_windows(self.args.windows) - # All the following stuff is ignored in parser-mode + # All the following stuff is ignored in makegroups-mode # basically split the font name around the dash "-" to get the fontname and the style (e.g. Bold) # this does not seem very reliable so only use the style here as a fallback if the font does not @@ -584,7 +584,7 @@ class font_patcher: fullname = replace_font_name(fullname, additionalFontNameReplacements2) fontname = replace_font_name(fontname, additionalFontNameReplacements2) - if not self.args.parser: + if not self.args.makegroups: # replace any extra whitespace characters: self.sourceFont.familyname = " ".join(familyname.split()) self.sourceFont.fullname = " ".join(fullname.split()) diff --git a/src/unpatched-fonts/CascadiaCode/config.cfg b/src/unpatched-fonts/CascadiaCode/config.cfg index f35d548b1..0f8372a85 100755 --- a/src/unpatched-fonts/CascadiaCode/config.cfg +++ b/src/unpatched-fonts/CascadiaCode/config.cfg @@ -1,3 +1,3 @@ config_rfn="Cascadia Code" config_rfn_substitue="Caskaydia Cove" -config_patch_flags="--parser" +config_patch_flags="--makegroups"