Making variable width fonts for code

Wendell's picture

A few programmers prefer variable width fonts for code, and they are harshly criticized by others for it. Reading the forums, I find that all discussion is about the use of existing fonts, not about how one might make a proportional font that is good for coding. So, I made a series of fonts to explore ideas along this line. You can see and download them at http://code.google.com/p/i3project/wiki/Fonts. They are released to the public domain (via the Unlicense) and I encourage others to use them as a starting point for their own experiments.

I think I can give some general guidelines on making a variable width programmer's font:

- Il1 and Oo0 must be clearly distinguished
- The advance width of "space" should be no less than "n".
- @#$%& need to be roughly the same size and color.
- ~*-+=<> need to be vertically aligned and roughly equal width.
- Punctuation must be bolder, more differentiated, and have more spacing.
- Letters should have no fancy flourishes and caps stay above the baseline.

The greatest complaint about variable width fonts and working with people who use them is that formatting gets messed up. This is because users of monospace fonts do vertical alignment with spaces. Most users of proportional fonts use tabs for alignment. I found that with wider spaces in a variable width font, you can avoid tabs and code layout will look almost the same with either monospaced or proportional fonts. However, this holds only if vertical alignment is restricted to the left indendation.

The project has been a mixed success. I'm very happy with Trim, but not at all with Cruft. I put the most effort into Cruft, trying to make a serif font look good with code, but to me it's a failure. Maybe it needs a fresh perspective. Anyway, because of this, I propose a final rule:

- Lines should have little or no variation in thickness.

Syndicate content Syndicate content