tim-harding / neophyte

A WebGPU rendered Neovim GUI
MIT License
141 stars 2 forks source link

Oversized metrics for some fonts #15

Open agraven opened 8 months ago

agraven commented 8 months ago

When trying to launch neophyte i get a blank window and the following output in stdout

WARN [sctk_adwaita::buttons] Ignoring unknown button type:
INFO [neophyte::neovim] Calling method nvim_ui_attach
INFO [neophyte::neovim::stdout_thread] RPC response to 0: Nil
INFO [wgpu_hal::vulkan::instance] Debug utils not enabled: debug_utils_user_data not passed to Instance::from_raw
INFO [wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "Intel(R) Graphics (ADL GT2)", vendor: 32902, device: 18086, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.2.1-1ubuntu3.1", backend: Vulkan }
INFO [neophyte::event_handler] Got resize: PhysicalSize { width: 800, height: 600 }
INFO [neophyte::neovim] Calling method nvim_ui_try_resize_grid
ERROR [neophyte::event_handler] Unknown event: chdir
ERROR [neophyte::event_handler] Unknown event: chdir
ERROR [neophyte::event_handler] Unknown event: chdir
INFO [neophyte::neovim::stdout_thread] RPC response to 1: Nil

For some reason the issue is not triggered when passing --clean to the neovim instance. When running :source ~/.config/nvim/init.lua after launching with --clean, the window freezes for several seconds, outputting the error log repeatedly, but eventually recovers.

I have yet to make a minimal config which will trigger this issue

I'm using nightly neovim, version 202402192105 on Ubuntu 23.10

agraven commented 8 months ago

On closer investigation it seems that the logged error and the freezing are unrelated, and that the freezing is actually caused by the font I have configured. I'll investigate further.

tim-harding commented 8 months ago

Thank you for the report. May I ask what the font is that's giving you trouble? I'd be curious to dig in more on this issue.

agraven commented 8 months ago

The font is Iosevka term slab in the form of a ttc file downloaded from the Iosevka releases page and processed with the nerd font patching tool. The file is too large to attach directly to the comment, I'll see if I can send it some other way. It's possible that the source of the issue is just that the font collection is too large,

An additional note, when the font does load, the metrics are incorrect, and cells are far too wide, see the below screenshot.

image

tim-harding commented 8 months ago

The metrics issue has come up before: https://github.com/tim-harding/neophyte/issues/10#issuecomment-1891083020 Maybe because the font is patched it is reporting a larger max-width property than what the base font uses. I'll look into that. For my own config I have Nerd Font Symbols as a fallback rather than using a patched font.

agraven commented 8 months ago

I see, thanks for the insight. I usually refrain from getting the nerd symbols from fallback because I tend to run into issues with said symbols being smaller than they're supposed to when doing so. I'll try to see if fallback works as intended in this case.

agraven commented 8 months ago

It seems to still get the metrics wrong for an unpatched font. I've attached it below, as well as an additional screenshot for good measure with vim.o.guifont = 'Iosevka Term Slab:h10' as the font setting. I confirmed with fc-list that no other fonts are matched by the font name.

image

iosevka.zip

tim-harding commented 8 months ago

I am able to reproduce the issue. Looks like Neovide has an example of addressing this by using the metrics from 'M' specifically, so I'll have a shot at incorporating that idea soon.