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
55.17k stars 3.65k forks source link

Unpatched CommitMono and patched CommitMono looks different #1696

Open doongjohn opened 3 months ago

doongjohn commented 3 months ago

Requirements

Experienced Behavior

CommitMono-400-Regular vs CommitMonoNerdFont-Regular looks different. Unpatched font is little bit thicker than patched font.

Expected Behavior

They should be same.

Example Symbols or Text

Any text.

Font Used

CommitMonoNerdFont-Regular.otf

Source of Font File

https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CommitMono.zip

Terminal Emulator (and the title of the terminal window)

No response

Operating System and Version

Windows 11

Screenshots

image image

doongjohn commented 3 months ago

I actually think patched version looks better. 🤔

Finii commented 3 months ago

Strange, the original font does not have hints ("blue zones" as that is a postscript open type font):

image

image

The outlines are identical but the hints help to render text at small sizes better.

I assume the difference gets smaller and smaller the bigger the size is? I believe we do not ever add any hints to truetype opentype fonts (ttf), but I never checked it explicitly; and I never even looked at it for otf fonts. Trying to find something...

Edit: Here blue zones in the patched font but not in the original

image

Finii commented 3 months ago

Hmm, in fontforge even when one disables generating postscript hints in the "generate" dialog, the created font file does contain Blue values :roll_eyes:

image

This is also true if given in the Python font.generate(..., flags=('no-hints',)) function... :thinking:

Finii commented 3 months ago

This is a bug with the CommitMono repo

We fix the problem of the original font automagically when patching :grimacing:

I will try to get the original with blues...

Edit: Add 'when patching'

Finii commented 3 months ago

Please try the original fonts from THIS link:

https://github.com/eigilnikolajsen/commit-mono/tree/main/src/fonts/fontlab

First uninstall the current CommitMono fonts; do not install the font from the link above just "over" existing fonts - the version is the same so Windows will not detect any change and use the cached font file.

BlueValues from the files in the link above (400-Regular)

[-10 0 740 750 700 710 540 550]

BlueValues we deduce and put into the patched font, same same, reconstruction / repair successful :tada:

[-10 0 540 550 700 710 740 750]

(Hmm, normally the BlueValues should be ordered, like we do - no clue if that has any detrimental effect. Can not find any real specs for Postscriptfonts :grimacing: )

Please do a comparison and report back :smiley_cat:

Finii commented 3 months ago

This is how the hints of the original-original CommitMono looks like: Blues and Stem definitions :+1: But all is absent in the CommitMono release font files. Patching creates the smallest set of hints as default Fontforge behavior.

image

doongjohn commented 3 months ago

Please try the original fonts from THIS link:

https://github.com/eigilnikolajsen/commit-mono/tree/main/src/fonts/fontlab Please do a comparison and report back 😺

Unpatched one is still thicker than the patched one. image

fontlab one looks different to zip one. image If you see f, i, h, ... it is quite different.

I still think nerd font version is the best looking one. 😮

Finii commented 3 months ago

image Screenshots assembled

image 400% no interpolation (dot for dot)

Finii commented 3 months ago

Hmm, I do not quite understand it.

Anyhow, checked what happens if we patch a 'correct' Postscript font, i.e. one with Blue values. Took the "fontlab" font and patched it. The Blue values are preserved, just a BlueShift is added. With 6 that should make no difference at your font size. [1]

Maybe you can check that font, and produce a screenshot like the ones before. Sorry to bother you with this, but I have no Windows box here; usually I test via RDP or NX on some other machine, but especially hinting is often completely ignored over network protocol.

CommitMonoV143400NerdFont-Regular.otf.zip 2MB


private BlueValues (-10.0, 0.0, 740.0, 750.0, 700.0, 710.0, 540.0, 550.0)
private OtherBlues (-210.0, -200.0)
private FamilyBlues (-10.0, 0.0, 540.0, 550.0, 700.0, 710.0, 740.0, 750.0)
private FamilyOtherBlues (-210.0, -200.0)
private StdHW (55.0,)
private StdVW (60.0,)
private StemSnapH (55.0,)
private StemSnapV (60.0,)
privateState A

CommitMonoV143-400Regular.otf

private BlueValues (-10.0, 0.0, 740.0, 750.0, 700.0, 710.0, 540.0, 550.0)
private OtherBlues (-210.0, -200.0)
private FamilyBlues (-10.0, 0.0, 540.0, 550.0, 700.0, 710.0, 740.0, 750.0)
private FamilyOtherBlues (-210.0, -200.0)
private BlueShift 6.0
private StdHW (55.0,)
private StdVW (60.0,)
private StemSnapH (55.0,)
private StemSnapV (60.0,)
privateState A

CommitMonoV143400NerdFont-Regular.otf

and additionally:

privateState 10000

CommitMono-400-Regular.otf

private BlueValues (-10.0, 0.0, 540.0, 550.0, 700.0, 710.0, 740.0, 750.0)
private OtherBlues (-205.0, -200.0)
private BlueShift 20.0
private StdHW (53.0,)
private StdVW (296.0,)
private StemSnapH (53.0, 70.0, 74.0, 82.0, 88.0, 126.0, 149.0, 172.0, 272.0, 300.0)
private StemSnapV (65.0, 78.0, 296.0, 339.0)
privateState 0

CommitMonoNerdFont-Regular.otf

[1] https://glyphsapp.com/learn/hinting-postscript-autohinting#g-blueshift

Edit: Add link to Glyphs

Finii commented 3 months ago

Fired up Glyphs3 to examine the fonts further...

Note:

https://github.com/user-attachments/assets/65acae98-3ab7-44cd-ad4d-0713a37dffdf

doongjohn commented 3 months ago

Maybe you can check that font, and produce a screenshot like the ones before. Sorry to bother you with this, but I have no Windows box here; usually I test via RDP or NX on some other machine, but especially hinting is often completely ignored over network protocol.

CommitMonoV143400NerdFont-Regular.otf.zip 2MB

image

I think CommitMonoV143400NerdFont-Regular.otf looks same as CommitMonoV143-400-Regular.otf

doongjohn commented 3 months ago

I still think nerd font version is the best looking one. 😮

After using CommitMonoV143 400 for a bit, I think the "proper" version looks better than the bugged one.

Finii commented 3 months ago

Glad to hear that :-)

I will try to help upstream to get the font file bugs squished out (see https://github.com/eigilnikolajsen/commit-mono/issues/69 further down).

The next NF release will use the 'correct' CommitMono files.

Thank you so much for helping actively!! :green_heart:

Finii commented 3 months ago

@allcontributors please add @doongjohn for bug

allcontributors[bot] commented 3 months ago

@Finii

I've put up a pull request to add @doongjohn! :tada: