You can get some serious eye strain looking at code all day long. Ever put any thought into the font you’re staring at? No one said you had to use the IDE’s default font offering… So why not pick something more pleasing? Here are some features to consider when picking a good programming font.

Spacing

First and foremost, say it with me: “Monospaced is a Must!” With a monospaced font all the characters take up an equal amount of space, so everything lines up nicely because of the fixed width per character. Traditionally, monospaced fonts have been a little dull, but take a look at Example #0 above. That’s Comic Sans, the laughing-stock of fonts and a great example how horrible code looks without a monospaced font. *shudder*

Just picking a monospaced font isn’t enough, though. A monospaced font with bad kerning is even worse than a normal, proportional font. Basically, kerning is the spacing between characters. Check out Example #5. That’s a monospaced font, but look at the terrible spacing of some letters. You just met the monospaced version of Dotum, and you’d never know its proportional brother is actually a great looking font.

Tip: Find a monospaced font that looks great even with a page full of dense code.

Punctuation

Most programming languages make heavy use of punctuation characters, so you need to be sure these will look good and flow well. Not to pick on Dotum again, but check out that horrible semi-colon – it’s so petite, yet the Titanic would fit in the space between the dot and tail. Compare that to Example #3, which looks like an anime cartoon character is winking at me (cute). And Example #1 may be a legitimate candidate to win a beauty pageant. Yes, I’m calling a semi-colon sexy.

Tip: Good punctuation is just as important as good letters and numerals.

Identification

When reading, most of the time you’re not going to mix up the letter “O” for the number zero. Similarly, you’re probably not going to misread a lowercase “L” as an “I” in uppercase. The context is just easier to discern in written language. But in programming languages, it’s less obvious. Check out Example #4, Lucida Console. It doesn’t use a slashed zero, and look how similar it is to the letter “O.” Mix-ups like that can cause head-scratching errors, especially if you’re working with pasted in code from another source.

Tip: Put the usual suspects in a line-up and make sure you can ID impostor characters!

Styling

Many modern IDEs make use of styles like bold, italic, and underline to aid you while you’re working. So, your font should to look good with those and other styles applied.

Sometimes, things look fine at first glance but then get a little crazy. Check out the freaky italicized “i” in Example #1. That’s Consolas, which is really a wonderful font otherwise. But why in the world do letters like “i” and “l” and “j” change to ridiculous strange versions in italics?! I will never know, but I don’t trust it.

Tip: Make sure your font works with common styles and formatting.

Flair

Example #3 is Courier New. You’d be hard pressed to find a problem with it. It’s like the great grandfather of fonts, an old standby that knows that to do right and does a consistent job of it. But it’s sooooo dreadfully old-fashioned, recognizable and, well, just plain boring. It’s missing a sense of fun, happiness… a certain joie de vivre. And I think I can see dust on it?

Tip: After you’ve got function, don’t forget about form.

Choice

Picking a font, above anything else, is a personal decision. Pick the one that speaks to you! If you haven’t guessed it, I’m partial to the only one I haven’t made fun of, Example #2. Reader, meet Inconsolata. It has a subtle bend in the “t”, “v”, “w”, “y”… The tasteful thickness of it. Oh my god, it even has a watermark! Kidding, not possible. But it does have all the characteristics of a great programming font, and a personality to boot. It’s a good thing I feel like I could stare at that sucker all day long… Because some days I feel like that’s exactly what I’m doing.

Tip: You shouldn’t just enjoy writing your code, you should enjoy seeing it too!

 

Like this post? Share it!