There are two types of programmers in the world: those who care about programming font, and those who don’t concern themselves with typography. As a code producing entity, why would you even need to care about such things as fonts? Fonts are what designers agonize about – and they are probably more qualified to do it than we are. Especially those of us who are back-end hackers, producing most of our code in Vim or Emacs. Why should we care?
Well, it is a matter of convenience. The font your text editor uses to render your code has great impact on it’s readability. Understanding source code, unlike poetry or prose, hinges on exactness and clarity. Code can be cryptic, and tends to use symbols, numbers and letters in strange non-word combinations. Your eyes have to be able to recognize characters at a glance, without a pause.
Have you ever found yourself squinting at your screen and wondering whether a character is a “zero” or an upper case “O”? If yes, then you are using the wrong font for programming. This post is for you.
A good programming font requires a number of features. The most important feature is of course crisp clarity of the characters and monospaced layout. Funky serifs, or too aggressive kearning can lead to readability issues down the road. Fonts that look great on pages of a book won’t usually be good for programming.
Here is a list of things I would like to see in a “perfect” font:
- Dashed zeros – I need a big honking crossbar through my zeros. Fuck the tiny dots in the middle. I want a big dash.
- No base serifs on one’s. The font should have very sloping upper serif, and nothing on the bottom.
- Rounded lower case L’s – I don’t want to see any serifs on top, and the bottom should loop for clarity
- Big fucking top and bottom serifs on upper-case I so there is no way you could confuse it with vertical pipe
- Comma’s that look nothing like periods. There is nothing worse than missing the crucial difference between 1,001 and 1.001 or foo(bar.baz) and foo(bar,baz). I want the commas to have distinct shapes.
- Distinct quotes and backticks. Backticks should be very loopy so they are instantly recognizable.
Recently I polled people on Twitter, and in /code forum asking them what was their favorite programming font. I got bunch of good suggestions, and this post is an overview of all of these.
Consolas
If you are a windows user, you are in luck. Despite a popular belief, there are some decent folks toiling away at Microsoft, and some of them have designed a really nice font that is damn near perfect for programming. Chances are you already have it installed on your system. If not, you can grab it from here.
Consolas looks great on the page. The zeros have the crossbars as they should, the colons are nicely rounded. The lower case “j” is nicely looped making it quite distinct from a lower case i and the lower case “g” is of the stacked variety (which has nothing to do with readability, but I personally like it). The ones and l’s are still not as distinct as I would like. The sloping upper serif on “1” looks flat on smaller font sizes. But all in all it is a great font.
It’s main flaw? It’s windows only.
Monaco
Speaking of system exclusive fonts, Apple has something even better than Consolas – a font called Monaco.
It has all of the good features I mentioned liking in Consolas – a crossbar through the zero, nicely rounded semicolons, good spacing on quotations, looping j and etc… It also does a much better job at distinguishing l’s and one’s. Note how the serrifs on the letter “l” follow a zigzag pattern – upper serif only on the left, lower serif only on the right. Compare it to the sloping upper serif and flat base on 1. The two are still fairly close, but much easier to distinguish at smaller sizes.
Personally, I really like the look of the font. It is more rounded, and has that sort of whimsical, soft feel to it. It looks very pretty and stylish. Alas, that font is Mac only.
Droid Sans Mono
Quite a few people told me they like Droid Sans Mono, so lets check it out:
This is a font that does the L’s correctly. Note that the 1 has no base serif, removing almost all confusion in this area. Sadly, the upper case I is almost indistinguishable from the L. Also, there is no crossbar on the zero, introducing confusion elsewhere. In addition, the commas are a bit to straight for my taste. At smaller sizes they can be easily mistaken for periods. Not my favorite font, but a lot of people swear by it.
Terminus
If you want a decent, open source font, Terminus is a viable choice:
One of the fatal flaws of Terminus is that it is a bitmap font. It does not scale well, so it only works at sizes less than 12-14. Any higher and you start to see ugly pixelation. The 1’s and l’s and I’s are handled rather poorly looking painfully similar. Commas and periods are tiny, and too samey. I’m also not a big fan of the blocky appearance of the font – though that’s just a matter of aesthetics.
Pro Font
Pro Font is a bitmap font, but it does a lot of things exactly right:
The number one, has a very large bottom base serif, whereas l has a tiny one. The large top and bottom serifs on upper case I make it distinct from both of these. Zeros are properly crossed as well. The best feature of this font are the commas and semicolons. Check out the huge dot of the comma versus the visibly smaller period. This is something that would probably drive a designer nuts, but as a programmer this is exactly what I want.
Anonymous Pro
Anonymous Pro is actually quite similar to Pro Font, though in many ways it is prettier.
I really like the numbers in this font. The aggressive serifs give it character and personality, whereas most other monospaced fonts tend to be rather bland. In that it reminds me of Monaco which also has great aesthetic look, but Anonymous Pro is sharper and more edgy.
The one is very distinct due to the large top serif. The lowercase L and I are a bit to close for comfort. I do like the pointy, sloping commas that jag out quite a bit.
Inconsolata
Inconsolata is one of my favorite fonts on this list, but it is nowhere near close to being perfect:
The one’s are quite distinct with the lack of the bottom bar, but I’s and l’s are still very, very close. Commas are definitely too small. The font does look nice though. It is close to Consolas (I think by design) and aims to create similar aesthetic feel, while being a little better at distinguishing certain fonts.
Monfour
Monfour is a bizarre monstrosity. It is a monospaced font with the whimsy and subversive carelessness of comic sans. It is too loopy and radical for most people, but it does have some interesting qualities, which is why I included it here:
Note the rounded L’s that cannot be possibly mistaken for an upper case I, a vertical pipe or number one. The dotted zeros are not as distinct as ones with a cross bar, but they are there suggesting that this could be used as a programming font. The commas are small, but quite distinct from the tiny periods. All in all, it is not a bad font, especially if you feel like doing something different and you don’t mind the tilted e’s.
Conclusion
Unsurprisingly, there is no winner here. No font on this list has met all of my requirements. Many come close, but miss some very crucial details. Before I started this list, I was torn between Consolas, Inconsolata and Monaco all of which have their own pros and cons. Now I added Anonymous Pro to the list of fonts I’m on the fence about.
How about you? What is your favorite? Does a perfect font that would meet all my needs even exist? Let me know in the comments.
My favorite is Bitstream Vera Sans Mono — I think it’s the default terminal font in Gnome, but I liked it so much that I downloaded it to use for PuTTY on my Winodws box. It looks great at pretty small sizes (I use it at 8) which means I can cram lots of code on the screen at once. Nice article on it here.
Also, you can get the Bitstream fonts here, and see a preview here
Like road here, I almost always just use Bitstream Vera Sans Mono. It’s available on every Linux system I’ve used, looks just fine, and I’ve never confused a pipe for a l or had any other issue recognition issue with it. Some of the fonts you list might be nicer in some ways, but I’d have to get used to them and they might not be as available.
I’ve also used terminus in places where XFT or similar technology wasn’t available. It’s actually not bad.
Also, wrt monospacing, apparently more and more coders are switching to variable spaced fonts for coding. Apparently you’re using python, you can get used to columns not always lining up. I’ve tried it and didn’t care for it, but, YMMV.
I see my suggestion of Comic Sans 36 pt did not make the list.
I really like Nitti (link) for my coding. iTerm is still set to Consolas, and I might switch Sublime back at some point, but the font looks so damn good it’s hard to pass up.
Today I changed the font from Inconsolata to Menlo. It’s a nice font with “true” italics and bold glyphs, so the comments are clearly distinguishable from the code itself in Vim.
I tried pretty much all the programming fonts I could find. I strongly dislike anti-aliased fonts (or, as I call them, “blurry fonts”) for screen use, so my preference goes to high quality bitmapped fonts.
Call me old fashioned, but my favorite programming font (and terminal font in general) remains Fixedsys from old versions of Windows. I like its wide strokes, massive punctuation (a la ProFont) and general familiarity. There is a free, Unicode-aware version called Fixedsys Excelsior and that’s what I use currently.
If you cannot use Fixedsys Excelsior, Terminus 12 Bold makes a usable substitute.
I prefer to use “Proggy Clean (Slashed Zero) (link). I find it to be very easy to read as a console font and for all of my development in vim.
With snowleopard Apple switch the standard-system-monospaced-terminal font from monaco to menlo.
:-(
But monaco is still there :-)
I usually default Consolas on Windows and I like Droid on Linux… but they both have a flaw in a danish context (and so have many others, like Terminus): The crossed 0 looks too much like the danish capital Ø (
& Oslash;
), so I usually end up using the Bitstream font which has a dotted 0…FYI: the danish alphabet looks like this (caps):
ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ
Our Norse fellows might have the same issue!
@ road:
Nice. I like that one.@ astine:
Yeah, but var-width coding is weird. I like when things line up.
@ Garrick:
LOL, yeah, I dropped it from the list. It did make me laugh though.
@ Joshua Kehn:
Nitri is actually kinda nice. Kinda like Monfour – it has a funky feeling to it.
@ Pollux Gluten:
You know, most of the time don’t notice blurriness. Maybe it’s just me though.
@ David:
Interesting… Proggy was on mu list for this post, and then I ended up skipping it for some reason. :P
@ STop:
Interesting. Do you guys always put the special chars at the end? Or is that just for convenience?
The Polish alphabet goes like this:
AĄBCĆDEĘFGHIJKLŁMNŃOÓPRSŚTUWYZŹŻ
Luke wrote:
Well, we don’t see them as “special” characters :)
This is the official order – don’t really know why. Convenience might be the reason. Actually, the modern danish alphabet is relatively new (late fourties). Before that, it has been (not necessarily at the same time):
AA = Å (still used in [place] names), Ä or [AE] = Æ, and Ö or [OE] = Ø.
Letters like C, Q, W, X and Z are mostly used in loanwords. Northmen and Swedes mostly bannished them altogether. Scandinavian languages usually prefer S, K, V and EKS instead (e.g. Ekspert = Expert).
I meant KS = X.
By the way, I like the look of the polish alphabet. Somehow reminiscent of runic scripts…
@ STop:
Interesting. We Poles do the same. X, Q and V are not traditional parts of the alphabet, though they are becoming included more often these days because of western brand names.
What we usually do with generic loan words is we Polonize them:
– If there is a V in it, we swap it to W
– If it has X we change it to KS
– If it has Q in it we change it to KU
– If it has a C we switch it to K
– If it has a CH we swap it to CZ
– If it has SH we change it to SZ
– If it’s a noun we run it through our case system
– Etc..
If it’s a brand, or a propper name we just tend to run it through out case system leaving the spelling intact but we do use the cases: Microsoft, Microsoftu, Microsofcie, Microsoftem, Xerox, Xeroxem, Xeroxu, Xeroxsie, etc..
did you try ENVY CODE R? http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-r eleased
Consolas is not windows only. You can install on linux as well.
I use Tamsyn font.
I’ve used just Dejavu Sans mono..but I found new coding font- and It’s Ecocoding…I found this font from the website, myfonts. :)
This is not free:( but its really gooooooood!!
you cans see a prwview HERE I think Ecocoding can meet all your needs..just try it. :)
With the clear type technology on Windows I have to agree on Consolas, as much as I don’t like proprietary stuff. But at work I use one HD monitor and a non-HD monitor (turned portrait) and so I stick with Liberation Mono sized at 11. Consolas just doesn’t seem to work as well on that monitor.