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.69k stars 3.59k forks source link

font-patcher: Correct icon path direction #1549

Closed Finii closed 3 months ago

Finii commented 3 months ago

[why] We create fonts with lots of path in the wrong direction. Although that is usually fine it is not guaranteed to be ok with all renderers.

[how] Just flatten the inserted glyph and then correct the path directions.

Output a debug message when that made the glyph worse or at least did not fix the direction.

A complete patched font changes from

======== AurulentSansMNerdFont-Regular_OLD.otf ========
Sum of problems: open 0, intersect 295, direction 5099 (for a total of 9710 glyphs)
======== CaskaydiaCoveNerdFont-Regular_OLD.ttf ========
Sum of problems: open 0, intersect 188, direction 5201 (for a total of 12477 glyphs)

to

======== AurulentSansMNerdFont-Regular_NEW.otf ========
Sum of problems: open 0, intersect 222, direction 4 (for a total of 9710 glyphs)
======== CaskaydiaCoveNerdFont-Regular_NEW.ttf ========
Sum of problems: open 0, intersect 185, direction 0 (for a total of 12477 glyphs)

with

DEBUG: Problematic glyph E0D0 (4 -> 8): uniE0D0
DEBUG: Problematic glyph E261 (8 -> 4): chess-pawn
DEBUG: Problematic glyph E2A2 (4 -> 8): isle
DEBUG: Problematic glyph E74C (4 -> 8): uniE64C
DEBUG: Problematic glyph E767 (4 -> 8): uniE667
DEBUG: Problematic glyph F342 (0 -> 4): QubesOS
DEBUG: Problematic glyph F34E (4 -> 2): OpenSCAD
DEBUG: Problematic glyph F470 (4 -> 8): logo-github
DEBUG: Problematic glyph F0DE4 (8 -> 4): pen-off
DEBUG: Problematic glyph F10F7 (8 -> 4): application-brace
DEBUG: Problematic glyph F1304 (8 -> 4): ski
DEBUG: Problematic glyph F1367 (8 -> 4): sticker-check
DEBUG: Problematic glyph F1675 (8 -> 4): paw-outline

where the bits are 2 : open path 4 : self intersecting 8 : wrong direction

One TTF and one OTF is shown because the standard direction is opposite for both formats.

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)