ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
52.63k stars 3.59k forks source link

font-patcher: Allow to rehint some Cascadia glyphs #1613

Closed Finii closed 2 months ago

Finii commented 2 months ago

[why] Some Caskaydia Cove glyphs that are used in ligatures (to create endless arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static Cascadia Code instances, which upstream just have ttfautohint hints that are different from the hints in the variable fonts and people complained that the look is different.

[how] Add a new field to the config.json file that holds regexes of glyph names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting is not ideal - the global tables are kept and probably less compatible to fontforge's own hinting... But the results are good.

Fixes: #1291 Fixes: #1609

Requirements / Checklist

What does this Pull Request (PR) do?

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

Finii commented 2 months ago

WHY are the config files called config.json and not config.toml?

Just curious :unamused:

Renaming them needs a gotta-patch-em change.

Edit: Answer: They are INI files with JSON values

Finii commented 2 months ago

image

Finii commented 2 months ago

Compared previous and current passed options via this change

index c2535a1dc..4c71ad6e7 100755
--- a/font-patcher
+++ b/font-patcher
@@ -2082,6 +2082,11 @@ def main():
         logger.info("Can not write logfile, disabling")
     logger.debug("Naming mode %d", args.makegroups)

+    qqq = list(vars(args))
+    qqq.sort()
+    print("|||", [[k,vars(args)[k]] for k in qqq])
+    sys.exit(0)
+
     patcher = font_patcher(args)

     sourceFonts = []

Run via gotta-patch-em on all fonts and logging into one file each before and after the PR.

After some sort and uniq -u and so on it could be seen that the delivered options were exactly the same (well, except that some had a configfile set that previously hadn't. These are the fonts which got the parameters before via shell script and now via INI.