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
Custom rendering for box drawing/decoration characters #2491
Comments
I really appreciate this issue as it captures the state of things well. Here are some thoughts and questions that come to mind: 1a. How do we decide how thick to render lines? Maybe we can use the same heuristics that we use for the underline thickness? Im not sure. |
This will actually become a high priority issue soon, with the fractional grid rendering support, so I would appreciate if someone could look into this. It's ok to concentrate on the basics first, where you can assume that the blocks will join at exact pixel coordinates. We need to get it to work where that's not the case as well. But that can be done in a separate PR or as part of the fractional grid support PR. @Kethku. Finally, perhaps this could be done as a separate crate that produces svg images. That way it can be used everywhere, independently of which rendering framework is used. Actually, maybe it does not even need to be code, it could just be a set of SVG images, that we can load and render. Edit: I think it needs to be a library, since I think that scaling svg images won't work properly due to different fonts having different dimensions. But I might be wrong. |
Is your feature request related to a problem? Please describe.
Depending on line-height and font settings, box-drawing boxes and ASCII art can render with unwanted gaps in between characters, and Powerline/NerdFont symbols can be misaligned to the grid.
Compare to the same setup in iTerm2 with "Use built-in Powerline glyphs" enabled:
Describe the solution you'd like
Special-case the rendering of box drawing and similar characters, ignoring the font used for all other text, in order to make them align perfectly to the grid. For reference, kitty's list of characters for which they have custom rendering can be seen here.
Describe alternatives you've considered
In theory it's possible to patch a font so that its glyphs would line up perfectly with the expected size of cells including line height, similar to the patches suggested to fake line-height support before it was implemented.
Additional context
Many terminal emulators (Kitty, Wezterm, iTerm2, gnome-terminal, etc.) use this strategy, and an Alacritty contributor called it "the only way to solve these issues reliably". Most provide an option to disable this, under different names.
This has been suggested/hinted at across a few different threads, in between mentions of different font rendering issues, or inaccurately describing the gaps as a bug. I'm just opening this issue to track this specific solution as a feature request.
Existing mentions of this idea/issues it would solve:
The text was updated successfully, but these errors were encountered: