RMichelsen / Nvy

Nvy - A Neovim client in C++
MIT License
323 stars 27 forks source link

nvy has display issues #36

Closed LollipopFt closed 1 year ago

LollipopFt commented 3 years ago

image a very minor offset for only a few lines can be seen near the bottom of the screen.

RMichelsen commented 3 years ago

This is odd. Can you share some more information so I can try and debug this, such as font, font size and theme related stuff that may interfere with the rendering.

LollipopFt commented 3 years ago

nevermind, it's gone... seems like a one-off thing, but strange that it happened. font: fira code, cascadia code font size: 11 theme: tokyonight.nvim note: nvim-treesitter enabled.

RMichelsen commented 3 years ago

Hmmm, strange. If you find a way to reproduce it in the future please reopen the issue :)

EtiamNullam commented 2 years ago

@RMichelsen I'm also experiencing lots of rendering issues with JetBrainsMono NF (Nerd font) while basic Consolas seems fine. Especially with powerline symbols and apparently bold text:

image

In the above example both the line number at cursor and return are bold which makes them push the rest of characters to the right.

RMichelsen commented 2 years ago

@EtiamNullam I am unsure what could be causing this, Nvy uses DirectWrite to render the glyphs and for bold text for example it simply sets the font weight of the corresponding text: https://github.com/RMichelsen/Nvy/blob/master/src/renderer/renderer.cpp#L412

I will have try and look into why it doesn't preserve the uniform spacing (which any monospace font should). Is it only JetbrainsMono NF that has this issue? How about the non-NF version for example?

EtiamNullam commented 2 years ago

JetBrainsMono also works fine for me. Looks like FuraCode NF also has problems while BlexMono NF looks fine.

nvim-qt reports JetBrainsMono NF is not a fixed pitch font so its most likely a problem with certain nerd fonts. Only in Nvy though - its fine in nvim (console), nvim-qt and neovide - so it might still be worth looking into.

RMichelsen commented 2 years ago

I wonder if there is a setting somewhere to make DirectWrite enforce a fixed width. nvim and neovide do not use DirectWrite so they may have other means of solving that problem. I'm actually not sure nvim-qt does either. I will have to investigate. In any case I'm not sure there is much I can do without either figuring out a DirectWrite option or figuring out some workaround hack which I would really rather avoid. Hmm.

I probably won't get a fix out for this right away as I have some IRL things to attend to at the moment, I will try to remember to look into it as soon as I get time. Feel free to mess around with it yourself and submit a PR if you find a good solution.

tejasvi commented 2 years ago

Proportional font users, rejoice! Only missing ingredient is character-width based cursor and I will ditch Vscode in an instant. image

EtiamNullam commented 2 years ago

Looks like I had wrongly configured fonts, when downloading JetBrains Mono from nerdfonts I have only installed Regular fontface. Looks like Bold and Italic (possibly also ItalicBold) were needed otherwise Nvy tried to change the font on its own or something, making letter not fit the grid when styling like italic or bold is applied.

RMichelsen commented 2 years ago

Is this still reproducible? If I understand it correctly the bug happens even with monospaced fonts? - I don't think I have any plans to support anything other than monospace fonts for the time being. Neovim being a row/column grid-based editor I don't think time should be spent on proportional fonts

EtiamNullam commented 2 years ago

@RMichelsen: Yes it can also happen for monospaced fonts.

If font doesn't have Bold or Italic (ItalicBold?) fontfaces installed and these styles are applied then these effects would be created out of regular fontface, tilting characters for Italic or making them larger for Bold. Both of these effects result in characters having bigger width and pushing the rest of characters to the side. In Neovide these characters would be clipped to fit in the grid.

It would be nice if user would be acknowledged that font is lacking required fontface (like in neovim-qt) and maybe it should fallback to using regular fontface if Bold or Italic are not supported. Of course you can also clip the character to fit in the grid (like in Neovide) but it can look bad.