Sunday, January 25, 2009

Best Programmer Font To Use

programmer_fonts.pngTeaching helps to keep you sharp. You never know what sort of problems students may give you that cause you to question, "Why so?"

One of the problems in class was that some of my students decided to change their fonts to whatever they fancied, anything from Arial bold in 20pts, to Comic Sans! I told them programmers used a monospaced font to correctly gauge indentation and formatting.

I asked them to change it back to Courier New, the only monospaced font I knew. However, that set me researching. What is the best programmer font to use?

It has to be monospaced and easy on the eye. But which?

In all, here's my winner after testing the various fonts:

Consolas which is a ClearType font shipped with Microsoft Windows Vista is actually the best. It's a new font specifically built to help programmers. It's also shipped with Visual Studio 2005 onwards. If you don't have it, download it here.

First, it has nice rounded curves and not hard edges. Compare Consolas's periods, commas and semi-colons. They are rounded and not drawn with straight lines like the other fonts. Secondly, the zero character has a slash, which helps us to distinguish it from capital-O. Finally, it is the most compact of the fonts, saving horizontal space.

The runner-up for me was LIberation Mono. Which is a GPL licensed TrueType font used in Linux.

Consolas font used for Java code in the Eclipse IDE:
consolas_font_code_sample.png

No comments: