Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Mono" fonts are not working in Kitty terminal #268

Closed
sergei-dyshel opened this issue May 9, 2018 · 37 comments
Closed

"Mono" fonts are not working in Kitty terminal #268

sergei-dyshel opened this issue May 9, 2018 · 37 comments

Comments

@sergei-dyshel
Copy link

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 kovidgoyal/kitty#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.

@ryanoasis
Copy link
Owner

@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!

@cosmicc
Copy link

cosmicc commented May 11, 2018

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..

@Thraka
Copy link

Thraka commented May 24, 2018

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

@maximbaz
Copy link

maximbaz commented Jun 4, 2018

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.

@kriansa
Copy link

kriansa commented Jul 15, 2018

@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.

@maximbaz
Copy link

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 😞

@haasosaurus
Copy link
Contributor

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

@zeorin
Copy link
Contributor

zeorin commented Jan 3, 2019

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

yigitsever pushed a commit to yigitsever/dotfiles that referenced this issue Jan 23, 2019
francois-pasquier added a commit to francois-pasquier/dotfiles that referenced this issue Jan 26, 2019
@bartlibert
Copy link

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

@webhive
Copy link

webhive commented Jul 26, 2019

@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!

@duganchen
Copy link
Contributor

Let me just link to the duplicate issue that I just updated... #323

@resolritter
Copy link

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.

@samyak-jain
Copy link

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.

akinsho added a commit to akinsho/dotfiles that referenced this issue Oct 16, 2021
This was a nightmare to get working again as the font needed to be
patched as it had been depending on some kitty trickery where the actual
patched font wasn't used but the icons for the other fonts was used
instead.

So I had to get the font patcher fork from ryanoasis/nerd-fonts/issues/268
and patch it remembering to pass the --mono flag
@GBeauregard
Copy link

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

@ziriuz84
Copy link

ziriuz84 commented Nov 6, 2021

Can you suggest a font that is not monospace?

@c02y
Copy link

c02y commented Apr 27, 2022

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.

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

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
Copy link
Collaborator

Finii commented Apr 27, 2022

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
Copy link
Collaborator

Finii commented Apr 27, 2022

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: haasosaurus@cf625d4
And that commit IS also here cf625d4

@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 🤔

@c02y
Copy link

c02y commented Apr 27, 2022

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)

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

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

@c02y
Copy link

c02y commented Apr 27, 2022

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

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
Copy link
Collaborator

Finii commented Apr 27, 2022

Fixed docu ... ;-)

image

@c02y
Copy link

c02y commented Apr 27, 2022

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.

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

Yes, but then ... how current is the docker image 😬 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
Copy link
Collaborator

Finii commented Apr 27, 2022

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

@c02y
Copy link

c02y commented Apr 27, 2022

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

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

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

I can try to find the problem then.

@c02y
Copy link

c02y commented Apr 27, 2022

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

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

Found this https://github.com/ajaybhatia/Operator-Mono which is probably a fork, but has a powerline folder ... Whatever.

What do you use? Medium?

Edit: Remove useless image

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

Looks good so far:
image

And starting ...
Kitty is in the back:
image

Edit: The colourful output in the right (Tilix) window is from kitty list-fonts

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

Patching with
fontforge -script font-patcher --complete --adjust-line-height --mono --careful ~/Downloads/Operator-Mono-master/src/Operator\ Mono/OperatorMono-Medium.otf
also yields a usable font:

image

@Finii
Copy link
Collaborator

Finii commented Apr 27, 2022

So I can see no problem with font-patcher HEAD.

I would say this has been solved. Shall we close this?

@c02y
Copy link

c02y commented Apr 28, 2022

What do you use? Medium?

I use Medium, can not install other weight such as Bold, or Bold will be used instead of Medium.

And yeah, fontforge -script font-patcher ... and ./font-patcher ... commands are both actually working fine, the generated fonts can be used by kitty.

I think I know why it didn't work at the first beginning, I didn't pass the right flags --quiet --no-progressbars --mono --adjust-line-height --complete --careful, and --mono here is the key, the generated font will be recognized by kitty even if I only pass --mono like ./font-patcher --mono OperatorMono-Medium.otf (some icons are missing of course since I didn't pass right the flag of symbols such as -c)

Maybe it is better to add a warning about the flags for kitty in the README in Option 8: Patch Your Own Font part?

So I can see no problem with font-patcher HEAD.

I would say this has been solved. Shall we close this?

It is solved for me and for Operator Mono font specifically, maybe you need other people's feedback before closing this issue.

@Finii
Copy link
Collaborator

Finii commented Jan 30, 2023

I think I know why it didn't work at the first beginning, I didn't pass the right flags --quiet --no-progressbars --mono --adjust-line-height --complete --careful, and --mono here is the key

--mono is not needed after #764, see also #969

@github-actions
Copy link
Contributor

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 github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests