-
Notifications
You must be signed in to change notification settings - Fork 515
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
Font renders brighter and slightly thicker #1231
Comments
To me the font looks brighter in neovide (it doesn't look like the weight of the font has changed). This is probably due to the way neovide handles fonts. |
The font is definitely more bold too. I'm also experiencing this issue. |
Its possible this is a font selection issue on linux. Though, like @PyGamer0, I'm not convinced this isn't just a subtle change in the way the font is rendered. As such I'm going to change the name of this issue unless someone can show a side by side comparison which shows the bold variant of a font which matches the font rendered in neovide. |
The font is only rendered more bold, it's not actually a different font. For example my icon font is rendered considerably more bold and it certainly doesn't have a bold font variant. |
Yes, I just installed Neovide on Windows and noticed the difference too. I tried to set |
I just installed neovide on windows as well and I see the same thing. |
I tried all the available edging and hinting combinations and none of them achieves a result similar to Alacritty or Kitty. |
font renders correctly when using light theme as someone says in this issue #1635 |
This is also happening to me. Seems like a very common bug, I've seen quite a few threads that seem to say they've resolved them and even with the proposed fixes it still isn't the same. |
@avegancafe Could you give me links to those threads please? |
That issue is slightly different than the one reported here, although you do see too thick glyphs as well But your main issue is that the font size is rendered wrong. An IBM Plex Mono font with a size of 12 has the pixel dimensions of 16.0 x 9.6. Neoivde uses an integer sized grid, so something has to be done to render the font properly. There are a few different approaches:
|
As for the original problem that can be fixed by diff --git a/src/renderer/fonts/font_loader.rs b/src/renderer/fonts/font_loader.rs
index 0a36a9a8..0d9328e2 100644
--- a/src/renderer/fonts/font_loader.rs
+++ b/src/renderer/fonts/font_loader.rs
@@ -3,8 +3,9 @@ use std::sync::Arc;
use log::trace;
use lru::LruCache;
use skia_safe::{
- font::Edging as SkiaEdging, Data, Font, FontHinting as SkiaHinting, FontMgr, FontStyle,
- Typeface,
+ font::Edging as SkiaEdging,
+ font_style::{Slant, Weight, Width},
+ Data, Font, FontHinting as SkiaHinting, FontMgr, FontStyle, Typeface,
};
use crate::renderer::fonts::font_options::{FontEdging, FontHinting};
@@ -163,7 +164,7 @@ fn font_style(bold: bool, italic: bool) -> FontStyle {
(true, true) => FontStyle::bold_italic(),
(false, true) => FontStyle::italic(),
(true, false) => FontStyle::bold(),
- (false, false) => FontStyle::normal(),
+ (false, false) => FontStyle::new(Weight::LIGHT, Width::NORMAL, Slant::Upright),
}
} I don't know why Skia renders weight normal (400) thicker than it should. Or maybe the CSS font weights means something different than regular UI font weights? But that's something we need to figure out, changing the weight to light does not sound like the correct fix. Also note that we should make both weight and width configurable, once we have figured out the proper configuration format for the fonts. |
It would be great if someone could do a similar comparison on other platforms as well. For the web browser images I used https://fonts.google.com/, and edited the website style with the fonts and backgrounds. Since the font sizes are not exact as explained in #1231 (comment), I also adjusted them slightly for roughly matching sizes. But at least based on the above images, I would close the issue and say that Alacritty renders it wrong. Note that Noevide renders this too wide, because I use floating point sizes here to make the actual glyph size the same One more comparison, Chrome, Neovide, WezTerm, Alacrity, Windows Terminal, and Notepad. Alacritty stands out the most, it also renders the font width completely wrong. Note that Neovide also renders the width wrong, because I use floating point sizes to match the size of the others. |
@fredizzimo Did you see my second post in this thread? You can see the difference easier if you zoom in on the screenshots, I'm going to do the same, but with other terminals. I also want to point out that this happens when the background is dark and the font is light. Something I want to say that might be helpful: More information about Kitty's option text_composition_strategy Here comes the comparison, to appreciate the difference I recommend opening each image in a tab of your browser on your laptop or desktop PC and switch between tabs. Kitty ( Kitty ( Alacritty, Foot and Kitty with the It's possible that there is a "legacy" option in Neovide like there is in Kitty? |
Do you have the images in their original sizes? It's impossible to do a proper comparison with zoomed in images like that. That's not how you look at the fonts in real life. But other than comparing different, programs to each other there's very little we can do. We use the same font rendering engine as all Chromium based browsers, so unless you can prove that we do something wrong and those browsers render the text differently, I think this bug will stay as a won't fix. The only thing we can do is to allow a configurable weight, which can be numeric typically between 0 and 1000 and 400 as the default. By modifying the code, you can already test it out as I explained here #1231 (comment). It's also very subjective. at least on Windows I find the Neovide and Edge font rendering to be the most readable. But other people probably have different opinions. |
You are right, I just thought this was the best way to see the difference, those little pixels make the difference.
I will try Here are the images in their original size: Kitty ( |
To me there doesn't seem to be a huge difference, other than for the really bright colors. But admittedly that inconsistency looks pretty bad. I have not noticed that on Linux myself since my color scheme (everforest) does not suffer from that. Which color scheme and font is that, so I can replicate it exactly? I'm guessing Edit: It's not the same theme, your background is completely black, mine is not. I will try again when I know what it is. |
The font is Roboto Mono, font size 10.5, color scheme is dark_modern.nvim with transparent background and the background of my terminal is black.
Wayland |
Strange The color scheme does not seem to match, it should be And there are not much difference between dark and white backgrounds (both transparent) |
I did the comparison on Windows and the font in Neovide looks thicker than Alacritty: Here I am using the builtin colorscheme industry (execute
|
I believe this added as much customization as we can allow through skia
Note that the color is mostly a function of the weight for small font sizes, thinner fonts on dark backgrounds will get darker, and lighter on light backgrounds. All terminals and Neovide renders the fonts too dark on dark backgrounds, so none of it is correct, and therefore the correctness is subjective. The correct weight is also subjective, since it's not possible to render correctly unless you have a very high dpi display. To fully compare the colors you should use a big font that with lines that are several pixels wide. I'm closing this, but will open when someone can give a clear non-subjective reason why we are rendering wrong. NOTE: some macOS systems render the colors wrong compared to terminals due to lack of srgb support |
I have this issue as well. I have used neovim-qt before but I wanted to get rid of qt5 so I have been using neovim on |
A recent Skia update now made this configurable, so here you go: As you can see in the screenshots there, everything is a compromise, different terminal emulators render things differently and so does Neovide. But even before that change, Neovide had more accurate colors and worked better on all backgrounds than most. |
Now that I've investigated specific cases more, I'll agree. But I am bummed because overall the things are better but the font fuzziness becomes a real problem when the font is set to a small value. I can barely differentiate between
Anyway, I wish I knew how the font stuff worked so I could prepare a solution proposal for this but I have no idea. |
@tghosgor Please read the comment before yours, there is a PR opened by the creator of Neovide that adds a couple of configurations that can help you solve your problem, I actually cloned the branch of the PR and was able to emulate the font rendering from Alacritty. |
@tghosgor, I wonder if you have your monitor setup wrong, because all of your screenshots are very clear to me, with Neovide being the clearest. But in any case, I think you should get it close to foot and alacritty by setting For the deformation of the font, you can try setting the hinting to none |
I've tried the gamma and contrast trick without noticing any change at all: vim.g.neovide_text_gamma = 0.8
vim.g.neovide_text_contrast = 0.2 I'm sorry but while the rendering differences might seem small, the extra thickness rendered by Neovide makes the text less readable; it's a shame because this issue has been preventing me from using Neovide for about 2 years now. Neovide may technically do it better or worse but the rendering is very different from all the other tools I've used (terminals, other Neovim GUIs, other GUI editors, web browsers) and the result is worse from an user experience POV, it's very unfortunate that this doesn't match the maintainer taste or experience. I'm going to give up on Neovide until this gets fixed, if ever. |
@Terseus There should be a wide range of adjustability, so it would be very surprising if nothing suits you. It's also strange that you see thicker fonts in Neovide compared to web browsers, it has always been very similar for all Comparisions I have done with the same font and same colors (yes the background and font color matters very much). In fact we have got reports that we render the text too thin: Both Wezterm and Kitty also renders a slightly thicker font on a dark background by default, at least on my system, check the comparisons taken here (you need to download the images and view them as the actual pixel size) |
@fredizzimo Sorry, my bad, I was in Neovide 0.12.2, updating to 0.13.1 made
I understand and respects your opinion, still Neovide renders the text less readable for me; as I stated before, maybe it's technically worse but Alacritty's font rendering creates a more pleasant experience, and when coding for +8h/day every small improvement matters.
I'm indeed using a dark background, if I switch to a light background the effect is not that pronounced, the font looks thinner even though there isn't really any change in how the font is rendered; it's hard to explain. Maybe the problem lies in antialiasing? Edit: And yes, the same font (Deja Vu Sans Mono) it's rendered in Alacritty like in my browser, however in Neovide it's thicker and less taller. I've reproduced the same problems with Fira Code and Source Code Pro. |
Describe the bug
Neovide makes fonts look bold when they are actually regular or light.
To Reproduce
Steps to reproduce the behavior:
Use a regular or light font in a terminal emulator and Neovide and see the difference.
Expected behavior
That the font I use looks the same weight as it does in the terminal emulator.
Screenshots
Terminal emulator:
Neovide:
Desktop (please complete the following information):
Please run
neovide --log
and paste the contents of the.log
file here:https://0bin.net/paste/9jSydr9u#-wgXMfCZAPBxXYI7XC6EZ7I1GFYbS2mXW4HFb+Em1RY
The text was updated successfully, but these errors were encountered: