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

FiraCode Nerd Font not considered as a monospace font #924

Closed ronyclau closed 1 year ago

ronyclau commented 2 years ago

🗹 Requirements

🎯 Subject of the issue

Experienced behavior: FiraCode Nerd Font is not considered a monospace font by the OS, meanwhile, FiraCode Nerd Font Mono is correctly recognized as a monospace font.

I created a smart collection in Font Book, which filters by Design style is monospace. FiraCode Nerd Font is NOT in the collection, while FiraCode Nerd Font Mono does.

Expected behavior: FiraCode Nerd Font is recognized as a monospace font.

Example symbols: Not applicable.

🔧 Your Setup

★ Screenshots (Optional)

Finii commented 2 years ago

Sorry to hear you have a problem.

Is the unpatched Fira Code detected as monospaced?

I noticed that the unpatched Fira Code does not have it's monospace 'bit' set, and the patching does not modify such things in the font (except in the Nerd Font Mono versions). The reason is that we also patch proportional fonts, so we can not just set it...

Finii commented 2 years ago
$ showttf git/nerd-fonts/patched-fonts/FiraCode/Retina/complete/Fira\ Code\ Retina\ Nerd\ Font\ Complete.ttf | grep -i advanceW
    advanceWidthMax=1200
$ fontforge -quiet query_mono git/nerd-fonts/patched-fonts/FiraCode/Retina/complete/Fira\ Code\ Retina\ Nerd\ Font\ Complete.ttf
Examining 1 font files
OK       Fira Code Retina Nerd Font Complete (width 1200 / 1200 - 1200) Panose says "monospace -1" [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Panose is completely unset (all zeroes), that means 'unknown properties'

"monospace -1" means 'unknow if monospaced' There are also "monospace true" and "monospace false".

The gnome-terminal (one that can only work with monospaced fonts) allows the file, because it detects 'Panose is rubbish' and check the advanceWidthMax agains some typical characters like A or whatever (I have no clue what it actually does).

Compare for example with FiraCode:

$ fontforge -quiet query_mono git/nerd-fonts/patched-fonts/FiraMono/Regular/complete/Fura\ Mono\ Regular\ Nerd\ Font\ Complete.otf
Examining 1 font files
OK       Fura Mono Regular Nerd Font Complete (width 599 / 599 - 599) Panose says "monospace true" [2, 11, 5, 9, 5, 0, 0, 2, 0, 4]

Is that correctly detected by Font Book?

ronyclau commented 2 years ago

Is the unpatched Fira Code detected as monospaced?

Yes. Both Font Book and kitty detect it as monospaced.

ronyclau commented 2 years ago

I updated from an at-least-1-year-old build, and it has always been alright. I replaced the files directly so no idea what the version was.

Finii commented 2 years ago

Yes. Both Font Book and kitty detect it as monospaced.

Ah kitty is also affected? I can check kitty (on Linux)

Edit: Hmm, no problems?

image

ronyclau commented 2 years ago

It works well if I specify the font in kitty config, but kitty +list-fonts | grep -i fira doesn't list the font, likely because it's not detected as monospaced.

Finii commented 2 years ago

image

Finii commented 2 years ago

Maybe it's still 2.2.1, at least in the font cache? Did you clear that and/or reboot or something?

ronyclau commented 2 years ago

Good idea, I'll reboot and try again.

...though I am guessing this isn't exactly a cache problem, cuz the previously installed version always got recognized as a monospaced font (both Font Book and Kitty). If it is a stale font cache, the new font should be detected as monospaced too. But, yeah, no harm to reboot :)

Finii commented 2 years ago

no harm to reboot :) Thanks for trying.

Yes, unlikely, but also unlikely that you have a problem while I can not reproduce with the same application (kitty).

Maybe you unknowingly updated to 2.2.1 and the 2.2.2 font is not read because of the cache? ;-)

One other thing ... I installed just that one font. Sometimes there are problems with the Family names etc pp. That can always be a problem, esp when one installs 'all fonts'. Often ppl install 'normal' and Windows Compat fonts, which should be mutually exclusive, right? And the Family naming is still broken, so I could easily imagine problems in that field.... Hmm.

Edit: Still looks good:

image

ronyclau commented 2 years ago

Restarted, still the same.

🤔 perhaps Kitty is using OS-provided font facilities to characterize fonts. Kitty isn't the the only application that see it like this on MacOS.

One other thing ... I installed just that one font. Sometimes there are problems with the Family names etc pp. That can always be a problem, esp when one installs 'all fonts'. Often ppl install 'normal' and Windows Compat fonts, which should be mutually exclusive, right? And the Family naming is still broken, so I could easily imagine problems in that field.... Hmm.

I didn't install the "Windows compatible" files, I only have FiraCode Nerd Font and FiraCode Nerd Font Mono (and unmodified FiraCode) installed.

ronyclau commented 2 years ago

FWIW, I've got Haslug Nerd Font and JetBrainsMono Nerd Font too, they are properly detected as monospaced.

ronyclau commented 2 years ago

Perhaps it really is the Panose monospace flag you mentioned in https://github.com/ryanoasis/nerd-fonts/issues/924#issuecomment-1241784470. Is it possible to patch that flag and see if it helps?

Finii commented 2 years ago

Meanwhile I managed to remote access some mac, but I'm too stupid to do anything there :unamused:

image

Yes, writing that flag is easy. But the 'original' Fira Code also does not have it set. Which raises the question: Which version of the original Fira Code do you have, and does THAT have Panose set or not?

Maybe you can open the original Fira Code font file in fontforge:

image

Click on Element -> Font Info Click on OS/2, click Panose tab, look at Proportion

This is how Fira unpatched looks like:

image

It is version

image

Finii commented 2 years ago

Hmm, Fira Code 6.2 still ... not proportional in Panose

image

image

Edit: OK means 'is monospaced'. Other possible outputs of the script are NOT MONO and LIES if Panose and actual font glyphs do not match in monospaciety.

Finii commented 1 year ago

I believe this is at least fixed with 3.0.0. If not, please reopen. Meanwhile I have a Mac to directly debug on the affected platform.

StefanoTesla commented 1 year ago

Hi guys, same problem in windows 11, any suggestion?

Solved intsalling the font "for all users"

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.