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

Kitty terminal emulator support #18

Closed
fluix-dev opened this issue May 15, 2020 · 24 comments
Closed

Kitty terminal emulator support #18

fluix-dev opened this issue May 15, 2020 · 24 comments
Labels
CozetteVector CozetteVector problems

Comments

@fluix-dev
Copy link

I'm not sure if this font is considered monospace*, but if it is, then it doesn't get recognized by kitty. The kitty terminal emulator is quite picky about what it takes as a monospaced font and it doesn't detect Cozette. A list of fonts that it deems acceptable can be listed with kitty list-fonts.

Here's three issues for reference and possible solutions (it seems a common one is the font's Spacing parameter): kovidgoyal/kitty#827, kovidgoyal/kitty#557, and ryanoasis/nerd-fonts#268

Regardless of the resolution, thanks for the beautiful font!

*If this font isn't meant to be monospaced, feel free to close this issue.

@slavfox
Copy link
Owner

slavfox commented May 15, 2020

If this font isn't meant to be monospaced, feel free to close this issue.

There... isn't really a useful definition of "monospaced" for people to agree on. The BDF font is specified as monospaced with the XLFD spacing property, but Kitty doesn't accept it because it wants a font considered "scalable" by fontconfig. The other fonts don't really have a way, afaict, of specifying they're monospace - it's generally based on whether the characters in the font are all the same width (and in Cozette, they explicitly aren't, because of eg. double-wide emoji), and some more black magic behind the scenes.

I've found microsoft/cascadia-code#118 (comment), which might be relevant. They seem to have solved the problem of a font with mixed-width glyphs not being recognized as monospace, I'll have to try and figure out how.

@fluix-dev
Copy link
Author

Ah, alright, I've never delved into fonts or font making so I didn't know about all the fine details. Thanks for trying though, I'm happy to test anything!

@slavfox
Copy link
Owner

slavfox commented May 27, 2020

I just realized Kitty doesn't support bitmap fonts, so this is a CozetteVector issue, which makes it much easier to fix. I suspect this might've gotten fixed in #14 and could work as of release 1.8.1. Could you try it out and let me know if it works now?

@slavfox slavfox added the CozetteVector CozetteVector problems label May 27, 2020
@fluix-dev
Copy link
Author

Oh, I didn't know Kitty doesn't support bitmap fonts, but I've just tried CozetteVector and kitty still doesn't detect it. With this new info (about no bitmap support), I don't personally have a need for kitty terminal support but I'm happy to test out any future releases / fixes :)

@colingabr
Copy link

Here's a related issue I opened yesterday without seeing this one kovidgoyal/kitty#2739

Without the patch, I am able to get kitty to render CozetteVector via the below configuration options
cozette

However, as you can see the font is too small for my DPI. @slavfox I'm curious about what your DPI is? I'd really like to use Cozette but might go blind in the process :)

@slavfox
Copy link
Owner

slavfox commented Jun 6, 2020

@novcn the font in your screenshot is not Cozette, as can be seen by eg. the a glyph and its derivatives. Cozette:
image

I'm on a HP Omen X35, 3440x1440 over 35", which comes down to 106.55 PPI. My laptop is 15" 1080p, for 146.86 PPI. I like small fonts :D

If you're looking for a larger bitmap font that still has solid powerline support, I can't recommend Tamzen enough. It's too big for my taste, but might be perfect for you.

I'll add a note with some larger bitmap fonts to the README, since this seems to be a common question. Making a bitmap font with this many glyphs is a lot of work - unlike vector fonts, which can be auto-patched for Nerd Fonts support, I draw each character by hand. I doubt I'm ever going to make larger variants of Cozette for that reason, so the least I can do is refer to some excellent larger bitmap fonts :)

@fluix-dev
Copy link
Author

fluix-dev commented Jun 7, 2020

@novcn the font in your screenshot is not Cozette, as can be seen by eg. the a glyph and its derivatives.

I think this has to do with your command line. You should probably specify CozetteVector not Cozette (because Kitty doesn't have bitmap support), although I haven't had success with either, hence this issue.

@colingabr
Copy link

@slavfox thanks for the info! I'll give Tamzen a shot sometime.

Kitty was indeed falling back to Nimbus Mono

I was able to get kitty to load Cozette-otb using the patched branch mentioned in the kitty issue I linked.

cozette-otb

CozetteVector is working for me as well! (Without patched kitty) and the size is perfect and scalable.
2020-06-06-190831_1324x511_scrot

@fluix-dev
Copy link
Author

fluix-dev commented Jun 7, 2020

I was able to get kitty to load Cozette-otb using the patched branch mentioned in the kitty issue I linked.

Damn, I really wanted this to work, but I tried it as well and it just... doesn't 😞

Not really sure why, I built both cozette-otb and kitty from source. I guess this should probably be closed though, since it seems to work for you and others in the kitty thread you linked.

@slavfox
Copy link
Owner

slavfox commented Jun 7, 2020

I'd like to leave this open until (if) bitmap font support gets merged into kitty master. Cozette bitmap should work correctly on the new branch, Cozette Vector still doesn't look right in @novcn's screenshot - the bottoms of the glyphs are cut off, although I suspect that's just a Kitty configuration issue, I'd try playing with adjust_line_height.

Compare eg. g, p, and q in @novcn's second screencap:
image

To the bitmap version, which renders correctly:
image

As far as I can tell, bitmap Cozette gets correctly detected as monospace because the bitmap font formats allow me to explicitly define the spacing as monospace, but CozetteVector... doesn't, despite having the panose tables set. I think fontconfig might be basing that on individual glyph widths.

@TheAvidDev I didn't realize I never asked for this - are you on Linux or MacOS? novcn is on Mac, so this might be a system-specific problem (kitty uses coretext rather than fontconfig on Mac).

@slavfox slavfox reopened this Jun 7, 2020
@colingabr
Copy link

I'm actually on Linux @slavfox

@fluix-dev
Copy link
Author

I'm on Arch Linux x86_64 - 5.6.15-arch1-1. I also have a quick question:

new branch

Do you mean the kitty fork?

@colingabr
Copy link

Based on the creator of Kitty's comment here kovidgoyal/kitty#97 (comment) it doesn't look like bitmap font support will be merged into kitty master FYI.

I'll mess around with the kitty config in a bit to fix Cozette Vector rendering.

@slavfox
Copy link
Owner

slavfox commented Jun 7, 2020

Ah, my bad! I assumed it was Mac because of the .dfonts 😅 I didn't realize it was possible to get them to work on Linux.

I also misread that fork as being a branch on the upstream kitty repo. Yeah, I saw that old issue, just assumed the creator had a change of heart since then.

Doesn't really look like I can do much more here - I'll add a note about mainline Kitty being incompatible, and a link to the fork, to the README tomorrow, and close this, in that case 😞

@fluix-dev
Copy link
Author

Yep, a note about a potential workaround would make sense.

@fluix-dev
Copy link
Author

Also about that fork, it doesn't look like that's going to be up forever, a link to the specific commit in that fork is probably wiser in the long term.

@colingabr
Copy link

I'm also on Arch @TheAvidDev

Here's some more info on my set-up in case it helps you.

λ › kitty --version
kitty 0.17.4 created by Kovid Goyal

I built Cozette from source off master and then moved the build dir over to ~/.fonts where I keep my fonts. I then ran a script I wrote to install them: ~/.fonts/recache

#!/bin/bash

fonts_base="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd $fonts_base

for font in `ls -d */ | sed 's/\///g'`; do
  echo "found font $fonts_base/$font"
  xset +fp $fonts_base/$font
done

xset fp rehash
fc-cache
fc-cache -fv

cd -

Not sure if this is the best way to do things, but worked for me.

@fluix-dev
Copy link
Author

Thanks, I'll try it out soon.

@slavfox
Copy link
Owner

slavfox commented Jun 7, 2020

I've added notes on kitty to the README: 0647b41

@fluix-dev
Copy link
Author

Looks good, I also use alacritty and it works great, it's just slow when starting which is why I'd like to switch to kitty. But the rejection of bitmap makes me want to use it less and less.

@4e554c4c
Copy link

Hello, sorry to bump but I published an AUR package with a patch that allows Cozette (otb) to be used.
https://aur.archlinux.org/packages/kitty-bitmap/

@fluix-dev
Copy link
Author

fluix-dev commented Jul 29, 2020

Hello, sorry to bump but I published an AUR package with a patch that allows Cozette (otb) to be used.
https://aur.archlinux.org/packages/kitty-bitmap/

Thanks, I'll try it out -- in the meantime, perhaps you should change the description, etc.

Edit: Whoops, looks like I didn't read carefully.

@slavfox
Copy link
Owner

slavfox commented Jul 29, 2020

Updated the README; thank you!

@clort81
Copy link

clort81 commented Jan 21, 2023

Kitty will NEVER render the font you specify because the program author has determined he knows better what certain glyphs should look like.
kovidgoyal/kitty#5910

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CozetteVector CozetteVector problems
Projects
None yet
Development

No branches or pull requests

5 participants