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: Prevent excessively tall icons in mono fonts #1564

Closed Finii closed 3 months ago

Finii commented 3 months ago

[why] Very slender and tall icons will be scaled huge compared to their fatter neighbors. This happens for example to the chess pieces (E25F ff) or text style icons like italic (EB0D).

[how] When a monospaced font is created use a slightly less tall cell height for all icons (except icons that have to match the actual line height).

This can be prevented by the new scale control character ^ that symbolizes maximized vertical size (height) within the real cell.

The smaller cell (now called icon cell) is less tall than the line height, but higher than the cap height of the font; to prevent people complaining that the icons shrunk too much. It is about 1/3 higher than the cap height compared to the line height:

image

This is NOT applied to the other Nerd Fonts fonts variants (i.e. Regular and Propo) because all icons are generally a bit bigger than the cap height (no scaling down to fit into one advance width) and as the scaling is far less pronounced the slender-and-tall icons scale comparably and do not look out off place there.

Suggested-by: Aaron Bell @aaronbell

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)

Some examples, prior left, with this PR right; glyphs marked blue by Fontforge:

image

image

image

Finii commented 3 months ago

Rebase on master, force push