kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
22.14k stars 907 forks source link

Option for alternate rendering of shade characters #7398

Closed etzrxd closed 2 weeks ago

etzrxd commented 2 weeks ago

The way kitty renders the Unicode shade characters results in them not tiling seamlessly on most font sizes.

You can see that in this image

image

And (on mac Retina displays anyway) the Moiré patterns this creates are character-aligned, which makes the above image look like the 2nd row is darker or lighter than the rest.

I don't know of any way to fix this while keeping each character identical. But some fonts use diagonal lines instead like below, which solves both issues at the expense of not looking like the majority of fonts

image ( Iosevka in iTerm2 )

Would adding something like this as an alternative option be a good idea?

kovidgoyal commented 2 weeks ago

I'm afraid not, kitty renders these characters as their appearance is specified in the Unicode standard. Having a standard rendering allows writes of programs running in kitty to rely on that appearance in their code.

Personally speaking, I would like shade characters to be rendered as semi-transparent blocks, IMO that's the most useful, but...

etzrxd commented 2 weeks ago

I found a possible solution after-all.

Force the grid's dimensions to be even, spread the left-over columns/rows evenly over the character instead of putting them all at the end, and hide them with some semi-transparent pixels.

I expected this to just create a blurry mess similar to what resampling would do, but it actually works very well. And as a side-effect the 4x4 checkerboard no longer turns into a 5x4 one at small font sizes (I assume that this wasn't intentional in the first place)

C:L A:L

(the opacity values can probably be fine-tuned to make it better)

The 4x4 turning into a 5x4 when small: C:4 (Current) A:4 (Alternate)

kovidgoyal commented 2 weeks ago

What grid's dimensions? And you are welcome to send a PR to improve their rendering as long a their apperance remains consistent with the unicode spec.

etzrxd commented 2 weeks ago

by grid dimensions i mean the number of squares in the pattern along each axis. I'll send a PR after fixing a (literal) corner case