nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

FiraCode Nerd Font not considered as a monospace font

Open ronyclau opened this issue 2 years ago • 15 comments

🗹 Requirements

  • [x] I have searched the issues for my issue and found nothing related and/or helpful
  • [x] I have searched the FAQ for help
  • [x] I have searched the Wiki for help

🎯 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

  • Which font are you using (e.g. Anonymice Powerline Nerd Font Complete.ttf)?
  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
    • kitty
    • I can force it to use FiraCode Nerd Font without problem though, but some applications prompt warnings regarding the font.
  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    • MacOS Catalina 10.15.7

★ Screenshots (Optional)

ronyclau avatar Sep 09 '22 08:09 ronyclau

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 avatar Sep 09 '22 10:09 Finii

$ 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?

Finii avatar Sep 09 '22 10:09 Finii

Is the unpatched Fira Code detected as monospaced?

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

ronyclau avatar Sep 09 '22 11:09 ronyclau

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.

ronyclau avatar Sep 09 '22 11:09 ronyclau

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

Finii avatar Sep 09 '22 11:09 Finii

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.

ronyclau avatar Sep 09 '22 12:09 ronyclau

image

Finii avatar Sep 09 '22 12:09 Finii

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

Finii avatar Sep 09 '22 12:09 Finii

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 :)

ronyclau avatar Sep 09 '22 13:09 ronyclau

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

Finii avatar Sep 09 '22 13:09 Finii

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 avatar Sep 09 '22 13:09 ronyclau

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

ronyclau avatar Sep 09 '22 13:09 ronyclau

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?

ronyclau avatar Sep 09 '22 13:09 ronyclau

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 avatar Sep 09 '22 14:09 Finii

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 avatar Sep 09 '22 14:09 Finii

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.

Finii avatar May 05 '23 08:05 Finii

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

Solved intsalling the font "for all users"

StefanoTesla avatar Sep 04 '23 06:09 StefanoTesla

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.

github-actions[bot] avatar Mar 11 '24 00:03 github-actions[bot]