Skip to content

Qt warning "The specified font family 'monospace' was not found on this system" with Neovim 0.12+ default guifont #630

@shiena

Description

@shiena

Environment

  • goneovim: nightly-10-g4c89b49
  • Neovim: 0.12.1
  • OS: Windows 11

Problem

On startup, goneovim prints the following Qt warning to stderr:

The specified font family 'monospace' was not found on this system.

Image

Root cause

Neovim 0.12 introduced platform-specific default values for 'guifont' via neovim/neovim#37175 and the follow-up
neovim/neovim#37930. The new default ends with monospace as a last-resort fallback:

guifont=Cascadia Code,Cascadia Mono,Consolas,Courier New,monospace

The trailing monospace is a Linux fontconfig generic family name and does not exist on Windows or macOS. When
goneovim receives the option_set event for guifont during ui_attach, it appears to call
QFont::setFamily("monospace") for that fallback entry, which Qt cannot resolve and emits the warning.

Why user-side workarounds don't help

  • Setting guifont explicitly in init.vim (even at the very top of $MYVIMRC) does not suppress the warning,
    because Neovim emits option_set with the default value during ui_attach, before init.vim is evaluated.
  • Setting FontFamily in settings.toml does not help either — the warning originates from the guifont fallback
    parsing, not from FontFamily.
  • The only reliable workaround is wrapping nvim with --cmd "set guifont=..." and launching goneovim with
    --nvim=, which is awkward for end users.

Related issue in another Neovim GUI

Neovide hit an equivalent class of problem caused by the same Neovim 0.12 default change — tracked in
neovide/neovide#2328 ("Neovide throws error on startup if a font is missing as of
0.12"). The discussion there about validating the comma-separated fallback list may be a useful reference when
designing a fix on goneovim's side.

Suggested fix

When parsing guifont, skip entries that are not installed on the system (e.g. check via
QFontDatabase::families()) before calling QFont::setFamily. Alternatively, filter out fontconfig-only generic
names (monospace, sans-serif, serif) on non-Linux platforms.

Reproduction

  1. Install Neovim 0.12+ on Windows (or macOS).
  2. Launch goneovim without overriding guifont via --cmd.
  3. Observe the Qt warning on stderr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions