0

I use 'DejaVu Sans Mono' as gui font both on Windows (7 and 10) and Linux. However, on Windows some characters are not displayed correctly (while many other Unicode characters are displayed normally).

E.g. Ux20d7 combining character (right arrow above - mathematical vector symbol) is displayed OK on Linux (as a right arrow above the previously typed character), but on Windows 7 the character is displayed inside of the empty box (without any arrow), on Windows 10 the empty box is displayed next to the character. The encoding in all three cases is set as utf-8.

Version info (Windows 7):

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 10 2013 14:38:33)
MS-Windows 32-bit GUI version with OLE support
Compiled by mool@tororo
Big version with GUI.  Features included (+) or not (-):
+arabic             +ex_extra           +mouseshape         +syntax
+autocmd            +extra_search       +multi_byte_ime/dyn +tag_binary
+balloon_eval       +farsi              +multi_lang         +tag_old_static
+browse             +file_in_path       -mzscheme           -tag_any_white
++builtin_terms     +find_in_path       +netbeans_intg      +tcl/dyn
+byte_offset        +float              +ole                -tgetent
+cindent            +folding            +path_extra         -termresponse
+clientserver       -footer             +perl/dyn           +textobjects
+clipboard          +gettext/dyn        +persistent_undo    +title
+cmdline_compl      -hangul_input       -postscript         +toolbar
+cmdline_hist       +iconv/dyn          +printer            +user_commands
+cmdline_info       +insert_expand      -profile            +vertsplit
+comments           +jumplist           +python/dyn         +virtualedit
+conceal            +keymap             +python3/dyn        +visual
+cryptv             +langmap            +quickfix           +visualextra
+cscope             +libcall            +reltime            +viminfo
+cursorbind         +linebreak          +rightleft          +vreplace
+cursorshape        +lispindent         +ruby/dyn           +wildignore
+dialog_con_gui     +listcmds           +scrollbind         +wildmenu
+diff               +localmap           +signs              +windows
+digraphs           -lua                +smartindent        +writebackup
-dnd                +menu               -sniff              -xfontset
-ebcdic             +mksession          +startuptime        -xim
+emacs_tags         +modify_fname       +statusline         -xterm_save
+eval               +mouse              -sun_workshop       +xpm_w32
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32   -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG   -DFEAT_XPM_W32   -DWINVER=0x0400 -D_WIN32_WINNT=0x0400  /Fo.\ObjGOLYHTRi386/ /Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl85.dll\" -DDYNAMIC_TCL_VER=\"8.5\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python32.dll\" -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl514.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=19 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby192.dll\" -DFEAT_BIG /Fd.\ObjGOLYHTRi386/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:i386 /nodefaultlib gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib  user32.lib      /nodefaultlib:python27.lib /nodefaultlib:python32.lib   "E:\tcl\lib\tclstub85.lib" WSock32.lib xpm\x86\lib\libXpm.lib /PDB:gvim.pdb -debug

Version info (Windows 10):

VIM - Vi IMproved 8.1 (2018 May 18, compiled May 18 2018 18:36:07)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1
Compiled by mool@tororo
Huge version with GUI.  Features included (+) or not (-):
+acl                +emacs_tags         +mouse              +tag_binary
+arabic             +eval               +mouseshape         +tag_old_static
+autocmd            +ex_extra           +multi_byte_ime/dyn -tag_any_white
+autoservername     +extra_search       +multi_lang         +tcl/dyn
+balloon_eval       +farsi              +mzscheme/dyn       -termguicolors
-balloon_eval_term  +file_in_path       +netbeans_intg      +terminal
+browse             +find_in_path       +num64              -tgetent
++builtin_terms     +float              +ole                -termresponse
+byte_offset        +folding            +packages           +textobjects
+channel            -footer             +path_extra         +timers
+cindent            +gettext/dyn        +perl/dyn           +title
+clientserver       -hangul_input       +persistent_undo    +toolbar
+clipboard          +iconv/dyn          -postscript         +user_commands
+cmdline_compl      +insert_expand      +printer            +vertsplit
+cmdline_hist       +job                +profile            +virtualedit
+cmdline_info       +jumplist           +python/dyn         +visual
+comments           +keymap             +python3/dyn        +visualextra
+conceal            +lambda             +quickfix           +viminfo
+cryptv             +langmap            +reltime            +vreplace
+cscope             +libcall            +rightleft          -vtp
+cursorbind         +linebreak          +ruby/dyn           +wildignore
+cursorshape        +lispindent         +scrollbind         +wildmenu
+dialog_con_gui     +listcmds           +signs              +windows
+diff               +localmap           +smartindent        +writebackup
+digraphs           +lua/dyn            +startuptime        -xfontset
+directx            +menu               +statusline         -xim
-dnd                +mksession          -sun_workshop       +xpm_w32
-ebcdic             +modify_fname       +syntax             -xterm_save
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /arch:IA32 /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86t.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -DFEAT_MZSCHEME -I "E:\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_a36fs8.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_a36fs8.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=24 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby240.dll\" -DFEAT_HUGE /Fd.\ObjGXOULYHTRZi386/ /Zi
Linking: link  /nologo /subsystem:windows,5.01 /opt:ref /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:i386 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:i386  libcmt.lib oleaut32.lib user32.lib  /nodefaultlib:lua53.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python36.lib   "E:\ActiveTcl\lib\tclstub86.lib" WSock32.lib xpm\x86\lib-vc14\libXpm.lib /PDB:gvim.pdb -debug

Is there a way to correct this situation so that the same font was displayed identically on Windows and Linux.

  • Are you sure the font you're using have the unicode you're trying to show? Linux uses fontconfig which falls back to other fonts if the currently active font doesn't contain the unicode. I can't say Windows have the same feature. I suggest you try some patched nerd fonts. Goggle "nerd fonts patched" and try some of them out. I think that should fix the problem, but if not, well, we'll have to look into elsewhere. – klaus Apr 23 at 15:12
  • @klaus I didn't know such a detail about fontconfig and this really explains why one and the same font behaves differently in Vim. Also thanks for the link to nerd font. This would be the answer. – Al Berger Apr 23 at 15:29
  • So, it worked, did it? – klaus Apr 23 at 15:40
  • I tried several nerd fonts (DejaVu, Liberation, Roboto - all mono), but Vim doesn't see them (Notepad does). Don't know why. Tried fonts both marked as Windows Compatible and not marked ones. – Al Berger Apr 23 at 16:21
  • I looked into Fonts folder and see that nerd fonts don't have "Designed for" property and "Category" property, Maybe this is the reason. – Al Berger Apr 23 at 16:33
1

Prerequisites are:

  • Use Vim built with multi-byte support
  • set encoding=utf-8
  • set guifont=<font that includes the combining chars of interest>

You can test by putting the cursor after a character while in Insert mode and typing ⎈ Ctrl+V then U20D7 (for example). Vim will draw the combining character above the preceding character. (Note though that it doesn't always look pretty, in my experience.)

See also :h mbyte-combining.

Since it sounds like your first hurdle is finding a font with the correct character set I can at least name one that I have that does have them. It's from the set of fonts patched for use with the Powerline tool set: DejaVu Sans Mono for Powerline. I'm sure some of the other Powerline fonts are similarly equipped. Go to the parent directory of that link to see them all.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.