[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)
[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
to
with
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)