可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
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.
回答2:
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:
- Having the right PANOSE tag (whatever that is) of "Monospaced" instead of "Even Width"
All the characters have to have the same width. I was able to fix this by doing the following:
- Select all elements
- Element -> Validation -> Find Problems
- Select Random -> Bitmap/outline advance mismatch
- Select BB -> Check Advance: 600
- 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.