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

Vertical gap between braille characters #4499

Closed
lcheylus opened this issue Jan 12, 2022 · 10 comments
Closed

Vertical gap between braille characters #4499

lcheylus opened this issue Jan 12, 2022 · 10 comments
Labels

Comments

@lcheylus
Copy link

Describe the bug
I'm using btop tool https://github.com/aristocratos/btop/ to monitor my Linux system. This tool is a "modern" version of top/htop to display CPU, memory, processes, disk usage with graphic representation in terminal.

btop uses some graphic characters to print graphs (see code in https://github.com/aristocratos/btop/blob/main/src/btop_draw.cpp).

I have some difference with graphics using Kitty terminal and other VTE terminal (Terminator).

Screenshots
btop screenshot with Kitty 0.24.1
Screenshot_Kitty

btop screenshot with Terminator 2.1.1
Screenshot_Terminator

Environment details
Linux Debian testing (bookworm) on amd64.

Kitty config (partial)
kitty 0.24.1 created by Kovid Goyal
Linux echoes 5.15.0-2-amd64 #1 SMP Debian 5.15.5-2 (2021-12-18) x86_64
Debian GNU/Linux bookworm/sid echoes /dev/tty

Running under:X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/bash
Loaded config files:
  /etc/xdg/kitty/kitty.conf
  /home/fox/.config/kitty/kitty.conf

Config options different from defaults:
cursor_blink_interval 0.0
disable_ligatures     2
enable_audio_bell     False
enabled_layouts       ['splits:split_axis=horizontal']
font_family           DejaVuSansMono Nerd Font Mono
font_size             9.0
update_check_interval 0.0
@lcheylus lcheylus added the bug label Jan 12, 2022
@kovidgoyal
Copy link
Owner

Matching another terminals rendering of a character is not a design goal for kitty. if you feel some character is not rendered correctly as per the unicode standard by kitty, feel free to post that character an what you think is wrong with its rendering. The characters here are all rendered correctly by kitty as far as I can see. by doing

echo " ", "░", "░", "▒", "▒""⡇", "⡏", "⡟", "⡿", "⣿"; read

if there is some other character you think is not rendered properly do an echo of it and post a screenshot. And I will examine in more detail.

@page-down
Copy link
Contributor

page-down commented Jan 12, 2022

Please note that the font you use also affects the rendering.
I actually tried this program under macOS with the fonts I am using and all I can say is that btop is working perfectly.

You can also use symbol_map to apply a different font to these characters.
https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.symbol_map

@kovidgoyal
Copy link
Owner

The braille symbols are rendered indepependent of fonts, based on their
shapes form the unicode standard.

@page-down
Copy link
Contributor

Oh, maybe I didn't understand this well enough. Thanks for pointing that out.

@page-down
Copy link
Contributor

Now that you mention it, I tried this again.
I found that it looked different under Linux and macOS.
Then I did a test under macOS using kitty -o font_size=18.0 , kitty -o font_size=19.0.
I found that the gap is very wide when in certain font sizes.

@kovidgoyal
Copy link
Owner

That's to be expected. If the cell height is not an even multiple of 8 (there are 8 rows in a braille character) there will be some left over. Causing an extra gap at the bottom. One could in theory distribute that extra left over among the the gap rows to avoid it, but I am not at all sure that would actually look better. But sure if you wish to try it, it should be a fun and simple patch to the function braille_dot in box_drawing.py

@lcheylus
Copy link
Author

It's also my issue : there is a vertical gap between braille characters => see my screenshot with Kitty in my first post.

@page-down
Copy link
Contributor

Thanks. I tried the latest changes and it renders quite nice.

@lcheylus
Copy link
Author

lcheylus commented Jan 13, 2022

Thanks, I applied your modifications for fonts/box_drawing.py : no more vertical gap between braille characters => rendering in Kitty with btop tool is perfect.

I change the original title of issue to reflect the initial cause.

@lcheylus lcheylus changed the title Graphic display with btop tool Vertical gap between braille characters Jan 13, 2022
@clort81
Copy link

clort81 commented Jan 21, 2023

I see now the many special cases handled in
/usr/lib/kitty/kitty/fonts/render.py
While it is perhaps laudable that you attempt to 'fix' box and block drawing for your users, I reccommend providing a means to disable this behavior in kitty.conf.
"I will override user font choices" is not respecting your users.
In particular, braille characters are useful as box-drawing characters. We view these glyphs on screens, with our eyes.
Blind people do not need to read braille on screens, with their eyes, which don't work, because they are blind.
Terminal users do need to have control over their font rendering.
Please add an option to disable your overriding user font choices in kitty.conf

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

No branches or pull requests

4 participants