Which italic fonts play well with kitty? #6164
Replies: 6 comments 1 reply
-
To recap what I have said elsewhere. No those other terminals dont display italics correctly, they just bleed them into the neighboring cells, which is fine if the neighboring cell has a few empty pixels on the left edge but has the same issue if it doesnt. kitty just makes the problem consistent. The correct fix for this is for font designers making monospace fonts to make italic and bold italic faces that are metric compatible with the regular face. Until they do your best option is to either ignore the clipping or widen the cells or use a font face/font size combination that only has the issue to an extent that doesnt bother you. And kitty is unique amongst all terminals as far as I know in rendering the screen as independent cells in parallel. Search the issues here for "renderdoc" to see some screenshots illustrating that. That is one of the reasons kitty can outperform terminals that have only a 10th of its features. |
Beta Was this translation helpful? Give feedback.
-
On Sun, Apr 09, 2023 at 12:41:25AM -0700, cdelledonne wrote:
> No those other terminals dont display italics correctly, they just bleed them into the neighboring cells, which is fine if the neighboring cell has a few empty pixels on the left edge but has the same issue if it doesnt. kitty just makes the problem consistent.
Yes, this is clear. Nevertheless, the end user doesn't really perceive the difference between a consistent problem (character clipping in kitty) and a situation-dependent problem (character overlap in other terminals). All they see is some problem, and more importantly *how often* this problems manifests itself in a text file. I've done code development, paper writing and sysadmin in terminals for a few years, and I've never registered the character overlap issue — I'm sure it occurs, it's probably just not so frequent for me to even notice.
Whether a particular person is sensitive to a particular issue is a very
personal thing. For instance I use italic fonts in kitty all the time
and have yet to be bothered by clipping.
> The correct fix for this is for font designers making monospace fonts to make italic and bold italic faces that are metric compatible with the regular face.
I'm no font designer, but this seems like a strict constraint. So strict that in fact most italic font faces I have tried — some of which are rather modern — seems to "fail" at this. And even if in principle your argument makes sense, this character clipping situation only occurs in a minor portion of all existing terminals and text editors, so if I were a font designer I would probably not factor in this constraint in my design.
It's not a strict constraint at all. If you want to design a monospaced
typeface your typeface should be monospaced. There is no earthly reason
why italic faces cant be metric compatible. For instance a common
failure is to have the / character in the italic face overflow. There is
no need for this, indeed the / character should really be identical
between italic and non-italic faces. In my personal kitty.conf I use
symbol_map for this character to achieve this.
Nonetheless, I'm not saying that font designers will never come up with an italic font face that is both legible and metric-compatible. But as of today, the net results of this constraint are:
- Users are somewhat forced to pick a font that meets such a design constraint, whether they like the font or not
*Some* users.
- Finding a font that abides by such a constraint (at least to some extent) is difficult, there's no universal resource on the internet that guides the user through this process
You are most welcome to contribute a guide/table to help pick such a
font for users.
> Until they do your best option is to either ignore the clipping or widen the cells
These two options are a no-no for most fonts honestly, not just for aesthetics reasons. Excessive clipping forces your brain to try to fill in the missing pixels and thus increases fatigue on the long run (at least that's my experience). Wider cells make it more difficult to distinguish between an actual space character and inter-character spacing, which again results in additional strain on the eye.
I have the reverse experience. After a few days of using a new font all
such issues (and with a new font there are far more issues than just
clipping or spacing) just melt away once my brain gets used to the new shapes.
> or use a font face/font size combination that only has the issue to an extent that doesnt bother you.
This third option is what I'm trying to go for, and that's exactly the reason why I've started a discussion on this topic for the umpteenth time. I obviously respect your design decision in kitty, and since so many other people are willing to put up with this character clipping inconvenience, I though of helping the community navigating the solution space. Nowhere have I seen a decent list of "good" font options.
All I'm asking is to consider exposing this information (at least a list of "good" fonts) somewhere more discoverable than the tens of issues/discussions. I think the community would love this, given that this is such a recurring topic.
By all means I am all for more documentation. PRs are most welcome.
|
Beta Was this translation helpful? Give feedback.
-
That's great. I'll summarize what I have in mind here, before submitting a PR. First of all, I would suggest enriching the documentation with more information about how kitty displays fonts, and what makes a font a good candidate to be used in kitty — basically, an edited version of what was pointed out in the issues/discussion I linked above. I would perhaps add a brief summary in the general "kitty.conf > Fonts" section (https://sw.kovidgoyal.net/kitty/conf/#fonts), and some more detailed/technical explanation and a chart of fonts and their metrics in a dedicated page. This chart would be a list of fonts and, for each font, which (ASCII) characters would be clipped and by how much, when using italic and bold-italic faces. These figures would be extracted using the I would appreciate some input on the following questions:
On top of that, one could also add an option to the |
Beta Was this translation helpful? Give feedback.
-
On Thu, Apr 13, 2023 at 01:31:42PM -0700, cdelledonne wrote:
> By all means I am all for more documentation. PRs are most welcome.
That's great. I'll summarize what I have in mind here, before submitting a PR.
First of all, I would suggest enriching the documentation with more information about how kitty displays fonts, and what makes a font a good candidate to be used in kitty — basically, an edited version of what was pointed out in the issues/discussion I linked above. I would perhaps add a brief summary in the general "kitty.conf > Fonts" section (https://sw.kovidgoyal.net/kitty/conf/#fonts), and some more detailed/technical explanation and a chart of fonts and their metrics in a dedicated page. This chart would be a list of fonts and, for each font, which (ASCII) characters would be clipped and by how much, when using italic and bold-italic faces. These figures would be extracted using the `freetype` library.
Except that this isnt so simple to extract. Whether you get clipping is
a function of the font face, the font size, the DPI and the font
rendering engine. You would essentially need to render all the chars in
the font at all the pixel sizes from say 8px to 40px on Linux and macOS
to generate a report.
Not to mention that you are basically claiming that clipping status == font
good for kitty. That may be true for you, but it isnt true in general.
There are many axes on which to judge font suitability.
That said if you want to generate such a report, I am willing to include
it in the documentation.
I would appreciate some input on the following questions:
1. Where should the detailed explanation and list of fonts be placed?
In a separate document linked to from the FAQ.
2. What fonts should be included in list? Just some popular fonts? Or something more extensive? Which criteria should be used when selecting the fonts to include in the list?
Pick half a dozen popular ones.
3. Should the list of fonts be fixed, or somehow extensible?
Presumably you are going to write a script to generate this report,
so fonts can always be added to that script in the future.
4. Should the script used to extract font metrics be checked into the repository as well?
Yes.
On top of that, one could also add an option to the `kitty +list-fonts` command (or some other command) to show whether a certain font is a good candidate to be used in kitty, showing more or less the same information that would be shown in the aforementioned list of fonts in the documentation. Is this something you would consider?
I am fine with that, provided the information is robust, aka generated
in the way I described in the first paragraphs.
|
Beta Was this translation helpful? Give feedback.
-
I might need some guidance there. The input to a function that extracts the metrics of interest is:
Of course. I used "good fonts" just as a shortcut, I wasn't trying to suggest that this is the only criterion that one should use when picking a font. The phrasing in the documentation would be more appropriate. |
Beta Was this translation helpful? Give feedback.
-
On Tue, Apr 18, 2023 at 05:15:10AM -0700, cdelledonne wrote:
* DPI — I looked at [`get_window_content_scale()`](https://github.com/kovidgoyal/kitty/blob/6269f78ed227df38306c233c2f4290e87d346852/kitty/glfw.c#L690) in glfw.c, and it seems that the returned DPI value is a function of the display server, the OS, and obviously the display. Am I looking at the wrong thing? What set/range of values should be fed to the function that extracts our metrics of interest? A report that includes all this information is probably more confusing than clarifying, no?
Basically you go by pixel size, go over a range of font pixel sizes
since actual rendering is pixel based. pixel size is basically point
size and dpi combined.
* Rendering engine — do you mean FreeType vs Core Text?
Yes.
|
Beta Was this translation helpful? Give feedback.
-
It seems that this topic has been discussed a few times already (#3445, #4121, #4143, #4718), but I haven't come across a satisfying answer yet. I'll try to summarize the issue again, hoping that it will either get addressed or be discussed in the manual/FAQs.
Problem
Kitty is great, no doubt about that. It can do things that were just unfathomable a few years ago, including displaying images in a terminal! For many of us, this means that we hardly need to resort to other programs to achieve most daily tasks.
In my experience, though, there are still a few wrinkles that need ironing out before I can confidently recommend kitty as a daily driver to anyone who uses a terminal.
One thing that I find particularly odd is the rendering of italic fonts. I'm a big fan of the Meslo font, and I was disappointed to see that some characters were getting cut off when displayed in italic.
I went through kitty's config manual several times, but I couldn't see any mention of this. Digging through GitHub issues and discussions, I found that kitty "requires fonts that render well in a fixed width cell," and that other users have experienced similar problems with other fonts (#3445, #4121, #4143, #4718). A suggestion to mitigate this problem was to use
adjust_cell_width
(now calledmodify_font cell_width
I think), but the normal cell width is just perfect in my opinion, and larger values result in something unaesthetic, and harder to read.One FAQ also says that "kitty achieves its stellar performance by caching alpha masks of each rendered character on the GPU, and rendering them all in parallel. This means it is a strictly character cell based display. As such it can use only monospace fonts, since every cell in the grid has to be the same size."
Stellar performance sounds cool, right? So I guess I'll just try another font that both pleases my eyes and doesn't get bitten off by kitty. Until I found that the fonts I like the most are still not looking great in italic.
This, for me, is a major dilemma. I like performance obviously, but I cannot sleep at night if my terminal doesn't look exactly as I want it to look. And the sad thing is that other terminals which I like less than kitty — be it for subpar performance, or lack of features, or whatever else — don't suffer from this font rendering problem. For instance, I've been using another great, GPU-accelerated terminal for some time (Alacritty), and I've never experienced this issue.
What to do?
In the best case scenario, I would love to see this issue addressed in kitty at some point. If instead there's a fundamental limitation behind this problem, I would be curious to hear about that. Finally, if solving this issue would result in degraded performance, I would be curious to hear what the performance hit would be, given again that a well-performing terminal like Alacritty doesn't suffer from this problem.
Anyway, I'm still committed to using kitty as my main terminal, and thus would love to hear the community's experience with this issue. What fonts do you use? Are their italic versions properly displayed? Did you experience any issues with other fonts too?
I will try to list the fonts I've tried, and which of these are rendered better. This analysis is merely based on visual inspection of all ASCII printable characters when displayed in italic. Also, this rendering issue is more prominent at certain font sizes, but I'll stick to
font_size 13.0
, which is what I use on my HiDPI laptop.Feel free to suggest new entries, or share a different experience you've had with one of the fonts already listed. This would help me a lot, and hopefully would be a good resource for newcomers too.
& @ D H K M N W X Z m p
& @ D H K M N W X Z m p
(alsoA B
in bold italic)% M
(also/
in bold italic)%
(also& / @ M
in bold italic)& @ D H K M N W X Z m p
%
(also/ M m p
in bold italic)Beta Was this translation helpful? Give feedback.
All reactions