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

"Mono" fonts are not working in Kitty terminal

Open sergei-dyshel opened this issue 6 years ago • 35 comments

AFAIU "Mono" versions are explicitly made to fit programs which require monospaced font. I'm trying to recent release (v2.0.0) with Kitty terminal emulator but Kitty doesn't pick them because it does not see them as monospaced.

After opening a issue https://github.com/kovidgoyal/kitty/issues/527 in Kitty's repo the author told me that monospaced fonts are expected to have spacing: 100 when querying them with fontconfig (fc-query <font file>). And indeed the fonts I've tried (Iosevka, Fura Code, Hasklig) don't have this property at all.

Interesting that fonts from previous release (v1.2) do have this property and are properly recognized by Kitty.

sergei-dyshel avatar May 09 '18 16:05 sergei-dyshel

@sergei-dyshel I think I stumbled upon your issue in kitty actually. Thanks for opening an issue!

I cannot give any ETA, but this project will keep moving forward little by little!

ryanoasis avatar May 11 '18 01:05 ryanoasis

Trying this new font for my powerline setup, and just ran across this too. 2.0 mono fonts not seen by kitty.

I got excited for a minute when i read the 1.2 fonts still work, but the font I use is Noto and its not on 1.2 :(

I guess I wait..

cosmicc avatar May 11 '18 04:05 cosmicc

Seems multiple issues are being raised for really the same problem #269

Thraka avatar May 24 '18 17:05 Thraka

Since kitty supports configuring icon fonts for code point ranges, an alternative and more superior approach would be to have an icon-only version of Nerd Fonts and plug it into kitty. #275 is a feature request I made for Nerd Fonts to publish such font.

This would allow to use original coding fonts and not patch anything, simplify migration to a different font once you are bored of your old one, and avoid potential issues that patching process might introduce to the original font.

maximbaz avatar Jun 04 '18 19:06 maximbaz

@maximbaz Did you manage to use the Symbol Nerd Font on kitty? I'm struggling with it because it refuses to display the characters I specify on symbol_map.

kriansa avatar Jul 15 '18 00:07 kriansa

To be honest I didn't even get to try it, as I stumbled upon the missing space issue and couldn't replace Font Awesome with Nerd Fonts anyway. But judging by what you are saying, the Symbol Nerd Font is also not monospace, so this exact issue applies to the Symbol font as well 😞

maximbaz avatar Jul 15 '18 17:07 maximbaz

you can try the fonts in this branch of my fork for the time being, let me know if they work if you try them please. https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix

haasosaurus avatar Aug 01 '18 07:08 haasosaurus

@haasosaurus That works for me. Tested using the Iosevka Term Nerd Font Complete Mono (all styles) and Kitty.

zeorin avatar Jan 03 '19 08:01 zeorin

@haasosaurus: I tried your patched Iosevka fonts on linux, and I see an issue where "ë" is rendered as "e¨" in a much smaller format as the other characters. This also occurs for other accented characters. I don't have this with the unpatched font. @zeorin: Do you have this issue as well?

bartlibert avatar May 29 '19 10:05 bartlibert

@haasosaurus

you can try the fonts in this branch of my fork for the time being, let me know if they work if you try them please. https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix

Absolutely awesome! Got my Kitty terminal finally working well Thank you!

webhive avatar Jul 26 '19 18:07 webhive

Let me just link to the duplicate issue that I just updated... https://github.com/ryanoasis/nerd-fonts/issues/323

duganchen avatar Sep 16 '20 03:09 duganchen

One way to make Kitty recognize any font as monospace is to override the "spacing" attribute directly through configuration.

Take a look at Kitty's changelog:

docs/changelog.rst
- Linux: Allow using fonts with spacing=90 in addition to fonts with spacing=100 (:iss:`1968`)

As an example, the "Noto Sans Mono CJK JP" font is not detected through kitty --list-fonts. I have to set its spacing with <edit name="spacing"> as you'll note in the code below.

$HOME/.config/fontconfig/fonts.conf

<!-- Override monospace detection for custom fonts -->
  <match target="scan">
      <test name="family">
          <string>Noto Sans Mono CJK JP</string>
      </test>
      <edit name="spacing">
          <int>100</int>
      </edit>
  </match>

You'll probably have to run fc-cache -fv after changing that configuration.

resolritter avatar Sep 16 '20 15:09 resolritter

you can try the fonts in this branch of my fork for the time being, let me know if they work if you try them please. https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix

@haasosaurus Are you making a PR to this repo? It would be nice to get the fix upstreamed.

samyak-jain avatar Mar 14 '21 08:03 samyak-jain

Is there a particular fork or patchset I need to patch fonts with this working?

GBeauregard avatar Nov 05 '21 08:11 GBeauregard

Can you suggest a font that is not monospace?

ziriuz84 avatar Nov 06 '21 17:11 ziriuz84

https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix doesn't work anymore, maybe it is too old.

Following instructions from https://hub.docker.com/r/cdalvaro/nerd-fonts-patcher works for me.

c02y avatar Apr 27 '22 06:04 c02y

Hmm, this Issue is rather old, so it is hard to tell what is a current problem still and what not.

There have been some fixes for the Nerd Font Mono fonts to make them 'detectable'. Some more fixes are in the pipeline iirc.

To help you I would need to know which font you want to use? And where you download it (Release, Release Candidate, direct from repo, package manager, ...).

I did a small simple test; I never used kitty before... bear with me.

$ sudo apt install kitty
$ kitty list-fonts
Delugia
    Delugia Bold
    Delugia Bold Italic
    Delugia Italic
    Delugia Regular

Delugia Curly
    Delugia Curly Italic

Hack Nerd Font
    Hack Regular Nerd Font Complete

LiterationMono Nerd Font Mono
    Literation Mono Nerd Font Complete Mono

Menlo Nerd Font Mono
    Menlo Regular Nerd Font Mono

Monaco Nerd Font Mono
    Monaco Nerd Font Mono
[...]

$ echo "font_family      Monaco Nerd Font Mono" > ~/.config/kitty/kitty.conf
$ kitty --debug-config                                                      
kitty 0.19.3 created by Kovid Goyal
Linux Ryzen 5.13.0-40-generic #45-Ubuntu SMP Tue Mar 29 14:48:14 UTC 2022 x86_64
Ubuntu 21.10 \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"
Loaded config files: /etc/xdg/kitty/kitty.conf, /home/fini/.config/kitty/kitty.conf
Running under: X11

Config options different from defaults:
font_family           Monaco Nerd Font Mono
update_check_interval 0.0

$ kitty --debug-font-fallback
[117 12:56:44.129570] Preloaded font faces:
[117 12:56:44.129603] normal face: /home/fini/.local/share/fonts/Monaco Nerd Font Mono.ttf:0
[117 12:56:44.129617] bold face: /home/fini/.local/share/fonts/Monaco Nerd Font Mono.ttf:0
[117 12:56:44.129634] italic face: /home/fini/.local/share/fonts/Monaco Nerd Font Mono.ttf:0
[117 12:56:44.129647] bi face: /home/fini/.local/share/fonts/Monaco Nerd Font Mono.ttf:0
[117 12:56:44.524898] [PARSE ERROR] Unknown OSC code: 7

The Menlo and Monaco are installed from an issue I worked on ~~yesterday I believe~~ two days ago: Issue 210; i.e. are freshly patched by me.

Seems to work?

Edit: Correct information about Menlo&Monaco Edit 2: Just appending this link for me for easier work continuation: https://github.com/kovidgoyal/kitty/issues/ 827 and https://sw.kovidgoyal.net/kitty/conf/

Finii avatar Apr 27 '22 11:04 Finii

https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font

A ha! "If you are trying to use a font patched with NERD font symbols, dont do that as patching destroys fonts." Well, if it destroys them, that is a Nerd Font font-patcher bug, should be reported, and will be fixed.

The solution they suggest is mostly valid. But there is still a reason for patched fonts: Only then are the patched-in symbols aligned (vertically) to match the font's glyphs. I believe (did not check) that Kitty will not do that, just scale. If they do shift the scaled glyphs, let me know :-)

Finii avatar Apr 27 '22 12:04 Finii

https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix doesn't work anymore, maybe it is too old.

That commit is ... needs too much labor to be examined. The author reformated the whole file and changed something (maybe, who knows) in the one same single commit. How shall one see what is changed when every line is changed? :-(

Edit:

Ah, they had the same commit cleaned up in his master: https://github.com/haasosaurus/nerd-fonts/commit/cf625d46b5018615efc2049b3c52585443ef2eaa And that commit IS also here cf625d46b5

@c02y It has been pulled in here.

The docker image ... has its repo here: https://github.com/cdalvaro/docker-nerd-fonts-patcher And I see no differences to us :thinking:

Finii avatar Apr 27 '22 13:04 Finii

https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix doesn't work anymore, maybe it is too old.

That commit is ... needs too much labor to be examined. The author reformated the whole file and changed something (maybe, who knows) in the one same single commit. How shall one see what is changed when every line is changed? :-(

When I run font-patcher from that repo/brach, it says python-fontforage module is not installed, but I already installed fontforge package and there is no python-fontforge module or package, maybe my current development is too new(Archlinux)

c02y avatar Apr 27 '22 13:04 c02y

How do you run it? Try fontforge -script font-patcher ... ?

Finii avatar Apr 27 '22 13:04 Finii

./font-patcher thefontfiles from https://github.com/haasosaurus/nerd-fonts/tree/regen-mono-font-fix#option-8-patch-your-own-font

c02y avatar Apr 27 '22 13:04 c02y

If Python does not find the fontforge module, try calling the font-patcher script through fontforge.

To be honest, on my main machine it also does not work to call font-patcher as stand alone script, only through fontforge.

Your link, ...: image

Edit: WAT? ./fontforge is of course wrong (usually) and should be just fontforge??!!

Finii avatar Apr 27 '22 13:04 Finii

Fixed docu ... ;-)

image

Finii avatar Apr 27 '22 14:04 Finii

Sorry I didn't try the fontforge command, I tried the docker way from the link I posted earlier after the failure, I don't have to worry about the revision of the nerd-fonts repo, or git clone the source code, I only need my original fonts and one docker command, very simple.

c02y avatar Apr 27 '22 14:04 c02y

Yes, but then ... how current is the docker image :grimacing: Looks like 2 years old, missing a lot of fixes. Whatever.

So if there is some concrete font that has problems with kitty, let me know and I will investigate.

Finii avatar Apr 27 '22 14:04 Finii

Yes, but then ... how current is the docker image grimacing Looks like 2 years old, missing a lot of fixes. Whatever.

This docker image is at least not hopelessly old: https://hub.docker.com/r/nerdfonts/patcher

Finii avatar Apr 27 '22 14:04 Finii

Didn't notice there is an official docker way in the doc, I don't know how I found the third party docker hub.

Just tried it:

$ docker run --rm -v $(pwd)/in:/in -v $(pwd)/out:/out nerdfonts/patcher --quiet --no-progressbars --mono --adjust-line-height --complete --careful

put fonts in $(pwd)/in and mkdir $(pwd)/out, flags --quiet --no-progressbars --mono --adjust-line-height --complete --careful is copied from https://hub.docker.com/r/cdalvaro/nerd-fonts-patcher

The generated fonts cannot be recognized by kitty, just like using the font-patcher command from the latest revision of nerd-fonts repo.

If you are curious about the fonts, the fonts are Operator Mono (non-free).

c02y avatar Apr 27 '22 15:04 c02y

This one? https://www.cdnfonts.com/operator-mono.font

I can try to find the problem then.

Finii avatar Apr 27 '22 15:04 Finii

The Download link is dead, if you need the fonts, here is a link, it seems they are piracy though.

c02y avatar Apr 27 '22 16:04 c02y