Wikia

Vim Tips Wiki

Using Computer Modern TT as a gvim font under Windows

Talk1
1,610pages on
this wiki
Revision as of 08:34, September 28, 2008 by JohnBot (Talk | contribs)

Tip 158 Printable Monobook Previous Next

created November 8, 2001 · complexity intermediate · author Vince Negri · version 5.7


If you really like the Computer Modern typewriter font (as seen in most TeX distributions) you can use it as the font in gvim! (looks excellent with font smoothing turned on)

First, get hold of the free Blue Sky Type 1 PS versions of the CM fonts from your local CTAN mirror. Unpack to a suitable directory.

Next locate the cmtt8.pfb file and open it (in Vim, naturally) - find the line saying

dup 32 /visiblespace put

and change it to

dup 32 /space put

that is, inserting enough spaces to keep the file size exactly the same (IMPORTANT!).

Save the file in Mac format (:set fileformat=mac).

Now install the cmtt8.pfm file - in Win9x/NT4, you'll need Adobe Type Manager (free download), but in Win2k, you can just drop the .pfm file into the Fonts folder.

Now in your _gvimrc:

set guifont=CMTT8:h11:cSYMBOL

(use whatever height you like instead of h11)

and enjoy! It's the first scalable font I can bear to edit code in.

Comments

I couldn't get the font to install on my win2k box. What exactly should the name of the file be? Should I change the cmtt8.pfb to cmtt8.pfm? I tried making the modifications as per the instructions, and when I tried copying it to my fonts directory, windows told me that it was an invalid font. I kept the right number of spaces, and I set fineformat=mac, but it didn't work. Maybe somebody could post a version of the font that works OK?


If you have downloaded the full bluesky package, you will have *both* .pfb and .pfm files. Do not rename the .pfb file to .pfm! The .pfm file will appear with a red 'a' as its icon in Win2k.

(Thinking I should have marked this tip as advanced, as messing with Type 1 fonts even in Win2k is fairly non-intuitive....)


One of the nicest mono spaced fonts that I have found has come from Microsoft.

They have a nice selection of screen legible fonts located at http://www.microsoft.com/typography.

The monospaced font is called Andale Mono and can be downloaded as a self installing executable (ugh.) under Windows.

Take a look if you need a good font.


Agreed. Andale Mono is what I use. It's a fine computer type font. In fact, I've set up my CMD prompt to use it and the IE Browser to use it for the monospaced fonts. Looks better than Courier new.


Nice tip! Computer modern is a beautiful font - my source code is much more elegant now ;-)

One note - doing 'set ff=mac' and saving my edits to the .pfb file did not work (for me, using Win98, Adobe Type Manager, and Vim 6.0). Leaving the file format alone did work.


Advertisement | Your ad here

Around Wikia's network

Random Wiki