hismailbulut / Neoray

Simple and lightweight GUI client for Neovim
MIT License
148 stars 5 forks source link

Feature request: pixel grid aligned box drawing/braile characters #12

Closed andis-sprinkis closed 2 years ago

andis-sprinkis commented 3 years ago

It looks very nice when box drawing graphical characters get special treatment and are always drawn aligned to pixel grid (instead of using font default anti-aliased glyphs) - e.g. always having sharp text indentation lines without gaps (indentline.vim), or precise sharp corners for popup windows with outlines..

Patch that enables it on st: https://st.suckless.org/patches/boxdraw/

Demontstrations (on top - st, on bottom - neoray):

hismailbulut commented 3 years ago

This will be a good feature but I need to think and do some research on this. I don't promise that it will be added but I will work on this in my free time.

hismailbulut commented 2 years ago

Hi @andis-sprinkis I almost finished all of box drawing and block drawing characters but I used vector library to do that which is same with most of the fonts. This solves gap problem but doesn't solve antialiased smooth lines (which sometimes blurry) and I wanted to ask you which is better? Also who is watching this issue I want to know your ideas.

andis-sprinkis commented 2 years ago

I do like that the characters are always connected, so I consider it a good improvement over default handling of those glyphs (of font I use - CascadiaCodePL). Minor thing I keep noticing that radius on round corners chars seems to be off, somewhat stretched (see fzf prompt corners).

Not a fan of antialiasing being applied to rectangular chars as it makes them blurry. I personally prefer the sharp bitmap drawing of these characters on standard DPI.

Looks better than what I get in iterm2 or NeovimQt, but worse than the patched st.

explorer_1jkL2mvCB1 (Neoray with flag FALSE and TRUE)

andis-sprinkis commented 2 years ago

Result now is tad closer to patched st boxdraw patch rendering, like how htop in terminal buffer looks now :) VirtualBoxVM_QPd6KCUcfS (st with boxdraw and Neoray with flag TRUE)

hismailbulut commented 2 years ago

Minor thing I keep noticing that radius on round corners chars seems to be off, somewhat stretched (see fzf prompt corners).

Yeah this is my mistake. It's easy to fix.

I like St's drawings but I need to solve a few problems to integrate it directly. The first problem is crosses and curves. I can make the curves by drawing two lines that do not meet in the center as in st, but vector drawing is necessary for the diagonal lines to look good. The second problem is the thickness of the lines. If I set the thin lines to be 1 pixel and the thick lines to be 2, the lines will be very small on high dpi screens (I haven't tested this). Also, since the thin line cannot be drawn in the middle of the thick line, it will still look bad. If I adjust the line thickness dynamically, this time it will be as if I drew vector graphics myself, which will be worse than what the library draws :) If we apply vector and pixel drawing together, the glyphs will not match each other this time. The best solution I've come up with so far is to ignore the thick lines and draw them all the same size. I actually made the current implementation to try it out. Also, I ask you, there is a file named boxdrawingchars.txt in the root folder of the project. I want you to take a screenshot for me by opening the part up to blocks with st in this file. The reason I'm asking you this is because I don't have a linux computer and can't use st. If you post these I can better understand how st draws. Thanks in advance.

hismailbulut commented 2 years ago

Sorry your last image actually shows how st draws. I think they are using 1 pixel for thick lines and 3 pixel for bold lines. And they doesn't draw cross lines with this feature. I think this is enough for me.

andis-sprinkis commented 2 years ago

Well, I hope these are somewhat useful (output from st 8.2 with boxdraw patch): VirtualBoxVM_W4sjPNN0BX ) VirtualBoxVM_hs0IUw8A9m

hismailbulut commented 2 years ago

I think this is fully implemented as requested.

andis-sprinkis commented 2 years ago

Looks crisp and pleasant to look at 👍 VirtualBoxVM_G2OTAgsQaK