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

Not using the fonts asked for (not monospace?) #179

Closed
kazuoteramoto opened this issue Nov 22, 2017 · 16 comments
Closed

Not using the fonts asked for (not monospace?) #179

kazuoteramoto opened this issue Nov 22, 2017 · 16 comments

Comments

@kazuoteramoto
Copy link

I'm trying to use kitty with Iosevka. But its not loading it either if I set font_family or run it with kitty -o "font_family=Iosevka". I checked that is loading a default font (using lsof).

I supose the reason is that Iosevka don't have spacing: 100:

$ fc-match -v Iosevka|grep -E '(fullname|spacing):'
fullname: "Iosevka"(s)
spacing: 90(i)(w)

Iosevka is also not listed under kitty list-fonts. Iosevka Term works with kitty but it don't have ligatures.

Another font with the same behaviour (don't load but the Mono version without ligatures do) is Pragmata Pro. Is this a bad implementation of ligatures on these fonts or is there something kitty can do about? (Fira Code and Hasklig works for me).

@kovidgoyal
Copy link
Owner

kitty only uses monospace fonts, that is the fonts listed under kitty list-fonts. Because kitty speeds up rendering by storing individual cell glyphs on the GPU, and monospaced font is really needed. It could use non-monospaced fonts, but that would lead to many rendering artifacts and lots of bug reports that I dont want to deal with.

@jpotier
Copy link

jpotier commented Jan 25, 2018

Well, Iosevka is a monospace font, isn't it? There does not seem to be any problems with Fira Code either, although in this case it is accepted by kitty.

I'm also trying to get the ligatures of Iosevka to render with kitty, the same way they did for Fira Code. What does need changing in the font for kitty to accept to use it?

@kovidgoyal
Copy link
Owner

Iosevka is not a monospace font. Iosevka Term (or something similar) is the monospace variant and that does not have ligatures.

@jpotier
Copy link

jpotier commented Jan 26, 2018

Styles related to ligations and spacing:
term : Disable ligations. When this style is present, the font built will not contain ligatures, and its family name will be set to “Iosevka Term”. In case of your OS or editor cannot handle ligatures correctly, you can disable ligations with it.

Iosevka Term is just Iosevka with ligation disabled. How come one can be a monospace font and not the other?

@kovidgoyal
Copy link
Owner

Why dont you ask the creator of Iosevka that? All fonts that identify themselves as monospaced will show up when you do kitty list-fonts. If the font is listed in that, it can be used, if not, it cannot.

@jpotier
Copy link

jpotier commented Jan 26, 2018

Sure, I'll do that. I'm not laying blame here, just trying to understand how this works.

@jpotier
Copy link

jpotier commented Jan 26, 2018

Ok, so Iosevka has a spacing: 90(i)(s) which, according to fontconfig's doc corresponds to FC_DUAL. This should be workable with kitty, right?

What do you think @kovidgoyal ?

@jpotier
Copy link

jpotier commented Jan 26, 2018

What's more I have built a version of Iosevka that is considered monospace, but with the ligations included. They are not loaded in kitty though.

https://github.com/jpotier/Iosevka/tree/v1.13.42

screensel

@kovidgoyal
Copy link
Owner

spacing has nothing to do with ligatures. spacing is about whether individual glyphs in the font are all designed to be equally wide or not.

In monospaced fonts a N character ligature is typically implemented as N-1 dummy glyphs and 1 glyph whose width is N times the width of a single glyph, with a negative left bearing. For example:

hb-shape --cluster-level=1 --show-extents  ~/work/env/conf/fonts/FiraCode-Regular.otf '==='
[LIG=0+600<0,0,0,0>|LIG=1+600<0,0,0,0>|equal_equal_equal.liga=2+600<-1094,538,1588,-452>]

hb-shpae is a frontend to harfbuzz, which is what kitty uses for ligatures.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 26, 2018

The other approach to ligatures, which is common in non-monospaced fonts is to simply substitute a single wide glyph for N monospaced glyphs. Since v 0.7 kitty supports that approach as well. For example:

hb-shape --cluster-level=1 --show-extents  ~/work/env/conf/fonts/OperatorMonoLig-Book.otf '==='
[equal_equal_equal.liga=0+1650<78,564,1494,-513>]

@jpotier
Copy link

jpotier commented Jan 26, 2018

Ok, so even if a font includes wide glyphs, then it is still considered a monospace font?

I see. So in theory no problem for Iosevka then.

Hmmm:

[nix-shell:~]$ hb-shape --cluster-level=1 --show-extents /nix/store/wd45bkd705rp38rgwxsqi69w50vls8rc-iosevka-hskl-1.13.42/share/fonts/iosevka-hskl/iosevka-hskl-regular.ttf '==='
[gid32=0+512<61,520,390,-293>|gid32=1+512<61,520,390,-293>|gid32=2+512<61,520,390,-293>]

There seems to be something wrong with my build of the font

@kovidgoyal
Copy link
Owner

yes, the presence of ligatures does not affect whether a font is considered monospace or not as far as kitty is concerned. All that matters is its spacing.

@jpotier
Copy link

jpotier commented Jan 27, 2018

Ok, now I have a build that is recognized by kitty. Ligations are off somehow though:
screensel

Here is the ttf file of the font: https://framadrop.org/r/163QLHkQI9#y60ZdwuHquUijvj/kaFzxET90CYZwoY7bO4oEaJYpIg=

I'm also talking to the person/team behind Iosevka to see whether this should be resolved at the font level or in kitty.

EDIT: From the font team “The file is correct and the ligations are working, but your terminal shrinked the glyphs with its ink box wider than 1/2em.”

Maybe I should open another issue for that.

@lyneca
Copy link

lyneca commented Apr 19, 2018

+1, same issue here

@IsaacWoods
Copy link

Any progress on this?

@kovidgoyal
Copy link
Owner

See #297

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

No branches or pull requests

5 participants