goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.82k stars 109 forks source link

Rendering differences between terminals #137

Closed musjj closed 2 years ago

musjj commented 2 years ago

Wezterm: image Alacritty: image Neovide: image

I'm not sure which is supposed to be correct, but the way Wezterm renders it seems more "correct". What is causing the spacing between the lines in Alacritty and Neovide? I'm using the default config from NvChad

goolord commented 2 years ago

i don't know, it's up to the terminal emulator to implement font rendering, not this vim plugin, lol. could be up to line spacing, font size, font hinting differences.. either way this isn't the appropriate place to ask

musjj commented 2 years ago

Can you help me provide a small function that can replicate and test the way alpha render the splash? Not really sure how alpha does its stuff.

goolord commented 2 years ago

https://neovim.io/doc/user/api.html#nvim_buf_set_lines()

goolord commented 2 years ago

all of the logic in alpha is basically just doing string concatenation and calling [nvim_buf_set_lines()](https://neovim.io/doc/user/api.html#nvim_buf_set_lines()), i can't modify the font rendering or render wider/narrower/taller/shorter than multiples of a cell using the neovim api

musjj commented 2 years ago

Ah, it seems that Wezterm does some special stuff when rendering certain characters Thanks for the hint

goolord commented 2 years ago

if you're running linux then i think you can set up fontconfig to configure a fallback font for ranges of glyphs. i tried to do that with box drawing characters here https://github.com/goolord/dotfiles/blob/main/home/.config/fontconfig/fonts.conf#L13-L26 but i don't recall if I was successful

bew commented 2 years ago

For your info @musjj, I was the one who implemented pixel-perfect braille characters rendering in wezterm, exactly for this usecase, to have super-clean-looking images rendered using braille-as-a-dot-matrix.

In wezterm there are a number of glyphs (like box drawing characters, braille characters) which are not looked up in fonts, but are instead defined and drawn by the terminal, to properly adapt to cell size, and completely fill it, use all space available.

The other terminals usually use the braille characters in the first font that has those characters, and rhe braille characters usually don't fully fill the cells, that's why you see empty lines around.


If you want to disable the custom glyphs in wezterm and use the braille characters from fonts, you can set the config custom_block_glyph = false in your wezterm config (ref: https://wezfurlong.org/wezterm/config/lua/config/custom_block_glyphs.html). (there is currently no way only disable custom braille chars whioe keeping box drawing ones, I'm still working on it)

musjj commented 2 years ago

@goolord From what I've read, I don't think the problem can be solved via fonts, which is why some terminal emulators ended up custom rendering them, not so sure though.

@brew Thanks for the contribution, it's a really neat feature! It seems that Alacritty does something similar, but only for U+2500 - U+259f which excludes braille characters.