The problem is that Unifont claims to be fixed-width, but contains double-width characters (e.g. the combined double tilde, U+0360).
Depending on what toolkit Gvim was built with, TTF fonts may not be accepted, only bitmaps. Hence this answer.
Solution for the bitmap (PCF) font
Grab a copy of the font to a directory where you have permissions
and open it in Fontforge.
Select all elements with Ctrl+A (they will be highlighted). Go to
- Toolbar > Metrics > Set Width
- Set width to: 8 {Half the number initially set}
- Click OK and wait, it will take some minutes
After the operation is complete,
- Toolbar > Element > Other Info > BDF info
- In the FONT field, change "Unifont" to "Unifix" (or other name you like)
- Scroll down and click New > FONT ASCENT (a number is auto-set, leave it alone)
- Scroll down and click New > FONT DESCENT (a number is auto-set, leave it alone)
- Click OK
Now save the BDF font in the File > Generate Fonts menu (Ctrl+Shift+G). Choose the name
you like, but otherwise use the default settings.
Setting up the font for X11 in Linux
I will assume you named the font unifix.bdf
in the previous step.
Exit Fontforge, get back to the terminal and issue
bdftopcf unifix.bdf > unifix.pcf
gzip unifix.pcf
At this point the two PCF and BDF files that were left behind can be deleted. Now choose one route.
With root permissions,
mv unifix.pcf.gz /usr/share/fonts/X11/misc
mkfontdir /usr/share/fonts/X11/misc
xset fp rehash
If you don't have root permissions or prefer not to fuss with system-wide directories,
in the home directory,
mkdir .fonts
mv unifix.pcf.gz .fonts
mkfontdir .fonts
xset +fp $HOME/.fonts/
xset fp rehash
The two Xset commands will need to be repeated after each reboot.
Now the font should be listed is xfontsel
and xlsfonts
and you can finally use it in Gvim with
:set gfn=-*-unifix-*
.