How do I get GNU Unifont or Free Mono working on gvim windows?
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.
For Win32, GTK, Motif, Mac OS and Photon:
:set guifont=*
will bring up a font requester, where you can pick the font you want.
Type :set guifont?
to get the setting, and put it into your .vimrc
. When you put it into the .vimrc file, you will have to escape spaces if there are spaces. For example, if ':set guifont?' outputs 'Gnu Unifont 10', it needs to set in .vimrc as:
set guifont=Gnu\ Unifont\ 10
I recently had the same problem and fixed it with fontforge
. Here is the workflow to generate a working unifontmono.ttf
font:
- start
fontforge
and open theunifont.ttf
font. On Debian this is installed at
/usr/share/fonts/truetype/unifont/unifont.ttf
- go to
Element
->Font Info...
- under
PS Names
changeFontname
,Family Name
andName for Humans
, for example intoUnifontMono
. - under
OS/2
->Panose
changeProportion
toMonospaced
.
- under
- click
Save
. In the popup selectChange
. File
->Generate Fonts...
. SelectTrueType
in the left requester, selectNo Bitmap Fonts
, disableValidate Before Saving
.Save
This should save a TTF file that you can install under Windows.
To use the font with gvim
on Windows:
- install the font by double-clicking it and choose
Install
. start
gvim
as Administrator:- goto
Edit
->Startup Settings
. - add the following line:
- goto
set guifont=UnifontMono:h12:cANSI
- restart
gvim
, it should now use the converted font.