I'don't know if this is a bug or misconfiguration or something.
Kitty render underline as:

While iTerm2 render underline as:

I've tried to adjust the adjust_line_height but won't work.
So how do I make kitty render underline like iTerm2 does?
Thanks!
I'm afraid that there is no setting to control underline rendering
in kitty. Underline thickness and position comes from the informatin in
the font, specifically CTFontGetUnderLinePosition() see core_text.m for
details.
I'm afraid that there is no setting to control underline rendering
in kitty. Underline thickness and position comes from the informatin in
the font, specifically CTFontGetUnderLinePosition() see core_text.m for
details.
In my configuration Kitty and iTerm2 use the same font.
So does this mean iTerm2 use something rather than CTFontGetUnderLinePosition() to get underline positions? Is there a way to optimize this?
No idea, iTerm is open source am sure you can check. Rendering the same
as iTerm is not really a goal for kitty though. If there is some actual
improvement that can be made to the algorithm to place underlines, I'm
open to ideas.
No idea, iTerm is open source am sure you can check. Rendering the same
as iTerm is not really a goal for kitty though. If there is some actual
improvement that can be made to the algorithm to place underlines, I'm
open to ideas.
I know that rendering the same as iTerm does is not Kitty's goal. And it shouldn't.
But underline rendering indeed iTerm do better than Kitty.
So I've checked the iTerm's source code. there's no CTFontGetUnderLinePosition() function. And do have some function regarding underline, but I'm not a native developer so it's hard for me to read into iTerm's source code.
Then I decide why don't I just change the return value of CTFontGetUnderLinePosition and CTFontGetUnderlineThickness. So here's What I do:

I know it seems ugly and might break upon future commit (currently on release 0.14.04).
But I work's for me. So I decide just paste I out incase anyone have the same problem.
Tested on macOS 10.14.6 with both retina and regular monitor.
Here's what Kitty's underline rending looks like after what I did:

You cant use hard-coded offsets since the vaues depend on font family and font size, which is the whole reason kitty uses CTFontGetUnderLinePosition() in the first place, which is th erecommended practive by Apple for text rendering.
Please reopen to open this question.
I think there are two aspects to the improvement of the underline.
Consider providing underline_offset and underline_thickness options to configure the position and thickness of the underline by the user.
Please reopen to open this question.
I think there are two aspects to the improvement of the underline.
- The location of the underline. Underline is too close to the text. I changed a lot of fonts, the display effect is not ideal;
- The other is the thickness. Thin lines make it difficult to identify. Vi m generally uses the underline to display errors, warnings, etc., so I prefer it to be conspicuous.
Consider providing
underline_offsetandunderline_thicknessoptions to configure the position and thickness of the underline by the user.
I think that's a preety good workaround instead of recompile kitty every time it gets update. Please consider it @kovidgoyal
Not something I am interested in, but patches are welcome.
To add to this discussion, not only is there a difference in the thickness and offset of the underline, the iTerm underline keeps the text in front of the underline, allowing for elegant breaks:

in a manner similar to text-decoration-skip-ink in CSS.
@kovidgoyal sorry for resurrecting this thread and I know you said it before, but since it's been a year I want to confirm before opening a PR: would you take a patch adding config parameters as suggested by @ingjieye?
Thanks!
yes, i would, although nowadays, vim finally uses curly underlines, so the options would not be useful for the original use case anyway.
Most helpful comment
Please reopen to open this question.
I think there are two aspects to the improvement of the underline.
Consider providing
underline_offsetandunderline_thicknessoptions to configure the position and thickness of the underline by the user.