How to 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 Free Mono and GNU Unifont fonts (which 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 make this work? I noticed that fonts are part of the "Medium" font family, and Ubuntu Mono, which works, is marked as "Normal." Does it really matter? I had no luck with changing fonts to gvim, even monospaced fonts.

+5
source share
3 answers

I was interested to know why this does not work, so I installed fontforge to look inside the font. It turns out that you were right about the font itself, which has a problem: the PANOSE proportion code is "Even Width" (4), not "Monospaced", (9). Since vim filters non-monospaced fonts, this explains why they do not appear in the dialog box.

If you're interested, I got Windows fontforge through a separate cygwin / X build prepared by this Japanese colleague through this English discussion page. Once you have installed it, open the font and look at Element-> Font Info-> OS / 2-> Panose.

I tried changing the settings and saving the file, but 1) the saved font file was 10 times larger than the original, and it took a couple of minutes to save the file, so something probably went wrong, and then 2) Windows refused to Download it, complaining that it is not a valid font file. I have reached the end of my curiosity, but perhaps you can make it work.

+4
source

For Win32, GTK, Motif, Mac OS, and Photon:

 :set guifont=* 

a font prompt will appear in which you can select the desired font.

Type :set guifont? to get the setting and put it in your .vimrc . When you put it in a .vimrc file, you will have to avoid spaces if there are spaces. For example, if: set guifont? outputs of "Gnu Unifont 10", it must be installed in .vimrc as:

 set guifont=Gnu\ Unifont\ 10 
+4
source

I recently had the same issue and fixed it with fontforge . Here is the workflow for creating the unifontmono.ttf work font:

  • run fontforge and open the font unifont.ttf . On Debian, this is set to

/usr/share/fonts/truetype/unifont/unifont.ttf

  • go to Element Font Info...
    • under PS Names change Fontname , Family Name and Name for Humans , for example, to UnifontMono .
    • under OS/2Panose change Proportion to Monospaced .
  • Click Save . From the pop-up menu, select Change .
  • FileGenerate Fonts... Select TrueType in the left requester, select No Bitmap Fonts , disable Validate Before Saving .
  • Save

This should save a TTF file that can be installed under Windows.

To use a font with gvim on Windows:

  • install the font by double-clicking it and select Install .
  • run gvim as administrator:

    • goto Edit Startup Settings .
    • add the following line:

set guifont = UnifontMono: h12: cANSI

  1. restart gvim , now it should use the converted font.
+2
source

Source: https://habr.com/ru/post/914288/


All Articles