Skip to content
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

warning on neovim-qt #7

Open
retzzz opened this issue Mar 10, 2020 · 1 comment
Open

warning on neovim-qt #7

retzzz opened this issue Mar 10, 2020 · 1 comment

Comments

@retzzz
Copy link

retzzz commented Mar 10, 2020

When I use this plugin on neovim-qt, there is a warning sometimes:

Warning: Font "monaco" reports bad fixed pitch metrics

I googled it and find solution in below page.
https://jdhao.github.io/2019/01/17/nvim_qt_settings_on_windows/
The solution is to use GuiFont+bang in ginit.vim: :GuiFont! fontname
Because this plugin should be sourced before gui enable, so my solution is to update the last statement of function function! s:SwitchFont() like below

    let g:favorite_gui_font = guifont
    if !has('nvim')
        execute 'set guifont=' . guifont
    endif

And then add below line in ginit.vim

execute ':GuiFont! '.g:favorite_gui_font

But this is verbose. Is there any better solution?

@retzzz
Copy link
Author

retzzz commented Oct 30, 2021

The latest version still cannot be used on Neovim,

I updated function randomtheme.vim

function! s:SetGuiFont(guifont)
    let splitted = split(a:guifont, ':h')
    if len(splitted) != 2
        return
    endif
    let font = splitted[0]
    let size = splitted[1]
    if has('x11')
        let g:favorite_gui_font = font . '\ ' . size
    else
        let g:favorite_gui_font = font . ':h' . size
    endif

    if has('gui_running')
        " for ubuntu vim-gonme
        if has('x11')
            let commandStr = 'set guifont=' . font . '\ ' . size
            execute commandStr
        else
            let commandStr = 'set guifont=' . font . ':h' . size
            execute commandStr
        endif
    elseif has('nvim') && exists('g:GuiLoaded')
        echo g:favorite_gui_font
        execute ':GuiFont! ' . g:favorite_gui_font
    endif
endfunction

And add below line in ginit.vim

execute ':GuiFont! ' . g:favorite_gui_font

Neovim and Gvim can share same configuration on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant