asfallows
asfallows

Reputation: 6108

What makes a font invalid for use in gVim?

I'm using gVim on Windows 7 and I recently added some fonts to C:\Windows\Fonts. In gVim, I can :set guifont=Font_Name some of them and it gets set as expected, but for several others I get E596 Invalid font(s): Font_Name.

Obviously the fonts which do not make the cut either have or lack some property which gVim requires of fonts it loads. Does anyone know what those are, and what, if anything, one might do to modify an existing font so that it meets those criteria?

In particular, the following fonts fail:

I will not be surprised to learn that these fonts are incomplete or missing something that Vim requires. I just have no idea what to check for.

Upvotes: 7

Views: 4033

Answers (2)

xdhmoore
xdhmoore

Reputation: 9876

Here is a similar question I asked, weirdly enough, in the same week.

In my case it boiled down to 2 things that I was able to tweak using FontForge:

  1. Having the right PANOSE tag (whatever that is) of "Monospaced" instead of "Even Width"
  2. All the characters have to have the same width. I was able to fix this by doing the following:

    1. Select all elements
    2. Element -> Validation -> Find Problems
    3. Select Random -> Bitmap/outline advance mismatch
    4. Select BB -> Check Advance: 600
    5. Select OK

In my case, it brought up one by one a list of all the elements that had 0 width and gave me the option to fix them to have 600 width.

Changing these seemed to work for me, but I may have committed some sort of fontrocity.

Upvotes: 1

romainl
romainl

Reputation: 196476

Did you read :h guifont?

I've already made wild guesses in another very similar question but I couldn't find it ATM. In short, GVim on Windows is very picky about its fonts: it wants a monospaced font but something in the fonts you have tried is not to its liking.

In this case, "Cronos Display" is obviously not monospaced so there's no way it could work. I don't know about "Monospace" but I'm surprised "Liberation Mono" doesn't work.

You could open the fonts in a font editor to seee if they are really monospaced.

Upvotes: 7

Related Questions