The 10x20 is the (alias for) font I use with xterm -- and I like it. Both for shell-commands and vi/vim.

Yet, when I use the :set guifont=10x20, I get "w i d e l y" spaced characters for some reason. Here is a snapshot of gvim and vim inside xterm with the same text open:

shots of gvim and xterm windows with the same text using same 10x20 font

I only have this problem running gvim remotely -- on a RedHat (or CentOS) machine -- while displaying on my local X-server. A local gvim (on my FreeBSD desktop) does not have this problem -- the text looks the same in gvim as it does in xterm with the same font.

What's wrong? Can anyone suggest a work-around? Something to put into ~/.fonts.conf on the remote (RedHat) system, perhaps?

Update: the version of gvim on CentOS-7.9 currently is:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 15 2020 16:43:49)
Included patches: 1-207, 209-629
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/uuid -I/usr/include/pixman-1 -I/usr/include/libdrm     -O2 -g -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D__linux__ -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE  -Wl,-z,relro  -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11 -lSM -lICE  -lm -lnsl  -lselinux  -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc       

The version on my FreeBSD desktop, where things "just work" (perhaps, simply because gvim runs locally) is:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug  7 2020 09:23:20)
Включені латки: 1-1382
Скомпілював  ...
Гігантська версія з GUI GTK3.  Включені (+) або не включені (-) компоненти:
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      +mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              -perl              +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               -ruby              +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             -sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       +xpm
+eval              -mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            +xterm_save
   системний vimrc: "/opt/etc/vim/vimrc"
     vimrc користувача: "$HOME/.vimrc"
 другий vimrc користувача: "~/.vim/vimrc"
      exrc користувача: "$HOME/.exrc"
  системний gvimrc: "/opt/etc/vim/gvimrc"
    gvimrc користувача: "$HOME/.gvimrc"
другий gvimrc користувача: "~/.vim/gvimrc"
       файл defaults: "$VIMRUNTIME/defaults.vim"
    системне меню: "$VIMRUNTIME/menu.vim"
  заміна для $VIM: "/opt/etc/vim"
 заміна для $VIMRUNTIME: "/opt/share/vim/vim82"
Скомпільовано: cc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/opt/include/gtk-3.0 -I/opt/include/pango-1.0 -I/opt/include/glib-2.0 -I/opt/lib/glib-2.0/include -I/opt/include -I/opt/include/fribidi -I/opt/include/cairo -I/opt/include/pixman-1 -I/opt/include/freetype2 -I/opt/include/libpng16 -I/opt/include/libdrm -I/opt/include/harfbuzz -I/opt/include/gdk-pixbuf-2.0 -I/opt/include/gio-unix-2.0/ -I/opt/include/atk-1.0 -I/opt/include/at-spi2-atk/2.0 -I/opt/include/dbus-1.0 -I/opt/lib/dbus-1.0/include -I/opt/include/at-spi-2.0 -D_THREAD_SAFE -pthread -DLIBICONV_PLUG -I/opt/include  -O2 -pipe -march=sandybridge  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/opt/include  
Скомпоновано: cc -L/opt/lib -L/opt/lib -fstack-protector-strong  -L/opt/lib -Wl,--as-needed -o vim     -L/opt/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lpthread -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl  -lSM -lICE -lXpm  -lXt -lX11  -lXdmcp -lSM -lICE    -lm -lelf  -pthread -lncurses  -lintl    -L/opt/lib -llua-5.2      -L/opt/lib/python3.6/config-3.6 -lpython3.6 -lintl -ldl -L/opt/lib -lintl -lutil -lm  -L/opt/lib -ltcl86 -lz -lpthread -lm         
  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Mar 30 at 0:26
  • 1
    Vim and font handling is... Special. Different operating systems and different vim variants (meaning vim and vim GUIs) some times have different font handling. I'm not gonna pretend to understand why. Something is probably misbehaving as a consequence, but I'm not sure what -- I haven't experimented much with font aliases, so I can't say much about it. The output you're getting in gVim is what happens when the font isn't found. As an arbitrary example, set the font to one you know. Then :set guifont=lookatthisuglyfont (literally; no need to install anything or replace the font name)
    – Zoe
    Mar 31 at 10:03
  • You can use any arbitrary name though. As long as the font doesn't exist on your system, it'll result in that weird-looking font. Probably a fallback font or something. The short story here is that gvim doesn't find your guifont. Why is something I can't answer (hence why I'm leaving a comment instead) - maybe it doesn't like aliases?
    – Zoe
    Mar 31 at 10:05
  • @Zoe, the weird spacing persists even when I pick a font explicitly from gvim's GUI (launched by typing :set guifont=*)...
    – Mikhail T.
    Apr 1 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.