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

Invisible underscore #690

Closed
S1nus opened this issue Jun 29, 2018 · 14 comments
Closed

Invisible underscore #690

S1nus opened this issue Jun 29, 2018 · 14 comments

Comments

@S1nus
Copy link

S1nus commented Jun 29, 2018

Underscore "_" character not visible with my font and colorscheme.

Font is "Menlo", size is 14.0 pt, colorscheme is:

@S1nus
Copy link
Author

S1nus commented Jun 29, 2018

Changing my font size from 14.0 pt to 16.0 pt fixed it

@S1nus S1nus closed this as completed Jun 29, 2018
@roipoussiere
Copy link

roipoussiere commented Apr 23, 2019

Same problem here.

Is it possible to re-open the issue? In my opinion, changing font size is not really a way to fix it. What if I really would like to set it to 14.0?

Not that with many other terminal emulators, with the same font and size, the underscore is well rendered.

@martinetd
Copy link
Contributor

There have been many similar tickets like #1064 with other workarounds:

  1. Adjust font size
  2. Use adjust_line_height
  3. Use symbol map to get the underscore from elsewhere

I looked at this in details at some point (e.g. screenshot, zoom and count pixels) and basically the font really draws outside of its "box", so given how kitty works I don't see how there could be a general solution for this (letting a cell draw on top of other cells just isn't going to happen)

@kovidgoyal
Copy link
Owner

The only solution I can think of is to special case the underscore and detect it rendering out of the box and shift it upwards by the needed amount. This is way too much work, to work around buggy fonts, at least for me, but patches are most welcome.

@martinetd
Copy link
Contributor

This unfortunately isn't specific to underscore, on some font / size combinaison for example the 'g' can look like a 'q' because the lower part is too low and not drawn; that's what caused me to look into it further at the time (after picking underscore from another font, but it would just look wrong to have a single letter from a different font...)

Honestly I don't think there's a good solution, it's buggy fonts (or admittedly not computing the cell size correctly for some reason, but I don't see why)

@kovidgoyal
Copy link
Owner

Well in theory, when calculating cell size, one could try rendering underscore and adjust the cell height to ensure it renders, that should automatically fix g, etc. However, this is an ugly workaround, as it imposes a performance penalty on everybody to workaround some broken fonts.

@roipoussiere
Copy link

Ok I understand.

I set adjust_line_height to 1 so underscores can be rendered correctly.

Thank you.

@parity3
Copy link

parity3 commented Jun 28, 2019

Not detecting a font's bugs that have been supported out-of-box by many other terminals should:

  • not really blame the font any more
  • run a pass through the font to clean it up
  • not require a workaround, even if it's as painless as setting a configuration variable
  • refuse to load the font on startup, fail hard instead with an option to "accept buggy fonts"
  • allow the overlap / fonts to infect space outside their boxes (if that truly was how the font was designed)
  • tell the user in docs that only fonts are supported, and fonts are not supported, and/or provide a utility to detect such buggy fonts, or just provide non-system fonts that are blessed

I'm running 0.14.2, linux mint 19.1 MATE, 2560x1440 with the default Noto Sans font. Also tried with 2 other fonts: monospace and just plain Sans. Underscores start disappearing at an admittedly uncomfortably small point size, but it points to an underlying issue that is not present in other terminals. This is not a hardware issue or a hackfix either; alacrity seems to do this even though it prides itself on performance and correctness. I'll be monitoring this project eagerly so I can switch back when fixed.

It could just be as simple a fix as adjust_line_height should never be 0, or at least default to 1?

@kovidgoyal
Copy link
Owner

Again, this has already been fixed, cell_height is auto adjusted to
compensate for broken fonts. Read the linked commit. The underlying
issue is broken fonts, the correct place to fix it is in the fonts. But
given that is never going to happen, I have added the workaround of
auto-adjustment for broken fonts.

@kovidgoyal
Copy link
Owner

And just btw Noto Sans is not a monospaced font, so you cannot be using it in kitty. If you want to see what actual font is used, use the --debug-font-fallback option.

@parity3
Copy link

parity3 commented Jun 28, 2019

I was able to get underscores to show up by installing fonts-firacode and configuring Fira Code as the font_family in the conf file. Thanks for pointing me in the right direction with the debug switch. FYI, the broken font it was choosing on my system was DejaVuSansMono. I'm not sure why mint would include broken fonts as their defaults or even runner-ups, but I guess that's their problem.

@kovidgoyal
Copy link
Owner

Interesting, I implemented the fix and tested it using DejaVu Sans Mono
and on my system, the underscore shows up with it at all font sizes
with that font. Are you sure you are running 0.14.2?

@parity3
Copy link

parity3 commented Jun 28, 2019

Yes 0.14.2. It starts happening at a low 5.0 font size. It's there at 6.0. On Terminator it never goes away before it gets so small I can't read the text any more.

@udnaan
Copy link

udnaan commented Feb 27, 2020

@kovidgoyal Do you by any chance be suing a 4k monitor with scaling set to 200%? I recently ran into this issue when 200% scaling was changed to 100%, the underscore disappeared.

The workaround of adjusting line height fixed it. Maybe this should be set to 1 by default.

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

6 participants