neovide: Text not rendered at native resolution on HiDPI monitor (Mac)

See screenshot, with correctly rendered text on the left and neovide on the right. neovide’s text is noticeably “pixel-y” compared to the HiDPI text on the left.

Screen Shot 2021-01-27 at 10 38 23 AM

This is with blank Vim configuration, using neovide pulled from master and built today using the sdl2-sys downgrade to 0.34.2 per this. Happy to follow up with any additional details that might be useful but off the bat I don’t know what those might be. Here’s some basic-type details for starters.

MacOS 11.1

❯ neovide -v
Neovide version: 0.6.0
❯ nvim -v
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/config -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/include
Compiled by brew@Catalina

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.4/share/nvim"

Run :checkhealth for more info

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 21 (6 by maintainers)

Most upvoted comments

This is an issue on Linux as well image

Hi guys,

I solved this on my local machine, but I am not sure this is a proper fix as I’ve never worked with Vulkan or SDL before.

Here’s how to reproduce my fix:

  1. Clone neovim and skulpin and override the skulpin repository using my local repo as explained here: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html

  2. My sdl2-sys crate has been downgraded to 0.34.2 as shown here. (not in my fork linked below).

  3. There is a discrepancy between the sdl return value for drawable_size() on my retina display and my additional monitor. I updated skulpin as so. https://github.com/Handfish/skulpin/commit/d472a9f144f43b2b73bec62cbe143cf8de45aaed - I don’t believe this is a totally proper pull-request - I think this might break other software / this software on other OS.

  4. There is also an issue with dragging the editor from my retina display to my monitor, so I made some changes to neovide. https://github.com/Handfish/neovide/commit/be37f2c6efd45f877cfac61f7d070fda0c0bb3ca

This has made the editor text look sharp on both monitors and fixed the rendering issues when dragging the editor from one to another.

EDIT:

Additional changes need to be made for cursor position on the Retina display. The logical position is scaled to the top left quadrant of the window. https://github.com/Kethku/neovide/blob/main/src/window/sdl2/mod.rs#L167 .to_logical(sdl_window_wrapper.scale_factor()) can be replaced with .to_logical(1.0) for proper mouse coordinates

FWIW, I just built on the opengl branch on my Mac, and the resolution issue is fixed. But the cursor and editor behavior are very strange: every time I move the cursor it jumps way down off the bottom of the window and to the right, and some editor actions such as text input don’t appear until I hit escape. But perhaps these issues are orthogonal to the rendering issue here so wanted to let you know that the opengl branch fixes that part.

MacOS 11.2.3 had the same problem too.

截屏2021-04-13 下午8 46 30