Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get GNU Unifont or Free Mono working on gvim windows?

I am trying to get support for runic characters in gvim on Windows 7. I have the fonts Free Mono and GNU Unifont (which both support this range) installed in my Fonts directory, but they do not appear in the font menu, and gvim gives me an invalid font message for the following lines:

set guifont=unifont:h12:cANSI
set guifont=GNU_Unifont:h12:cANSI
set guifont=Free_Mono:h12:cANSI
set guifont=Free_Monospaced:h12:cANSI
set guifont=FreeMono:h12:cANSI

etc...

How do I get this to work? I noticed the fonts both are part of font family, "Medium", while Ubuntu Mono, which works, is tagged as "Regular". Does this make any difference? I have not had much luck in general with changing fonts on gvim, even monospace fonts.

like image 371
xdhmoore Avatar asked Apr 24 '12 02:04

xdhmoore


People also ask

How do I add fonts to Gvim?

To set the default font used by GVim, add a command of the form set guifont= to your gvimrc . If you want to add it to vimrc file, then enclose this command in a if has("gui_running") block.


1 Answers

You made me curious about why this wasn't working, so I installed fontforge to snoop around inside the font. It turns out you were right about the font itself having the issue: The PANOSE proportion code is "Even Width" (4), not "Monospaced" (9). Since vim filters out non-monospaced fonts, this explains why they don't show up in the dialog.

In case you're interested, I got Windows fontforge via a standalone cygwin/X build prepared by this Japanese fellow, via this page with a discussion in English. Once you have it installed, open the font and look in Element->Font Info->OS/2->Panose.

I tried changing the setting and saving the file, but 1) the saved font file was 10 times larger than the original and it took a couple minutes to save the file, so something probably went wrong, and then 2) Windows refused to load it, complaining it isn't a valid font file. I've reached the end of my curiosity, but maybe you can make it work.

like image 114
David Pope Avatar answered Nov 01 '22 06:11

David Pope