I find that oldstyle (or text) figures are much easier to read in any context outside of simple assignment. Are there any low-ambiguity fonts, monospaced or proportional, that have text figures and other programming-friendly features, such as marked zeroes; aligned braces, operations, and other symbols; and bold and italic forms with identical width to regular?
Note. Old-style figures are numerals which are drawn with variable ascent and descent. Typically, for example, a “0” will be slightly larger than a lowercase “o”; the “6” and “9” will have have circles that are sized and placed similar to a “0”, with flags extending up and down from that.
In general, if one is trying to examine numbers as numbers (e.g. parse “8675309” as “eight six seven five three oh ni-y-ine”), the “lining” forms with unified ascent and descent are easier to read. On the other hand, multi-digit numbers written with old-style numerals have different shapes. If one is comparing columns of figures, a number like “1265” will look very different from “1285”, since the former will have a flag on the “6” that sticks up far above any feature of the latter.
Tabular figures are figures spaced with equal width; they may be lining or oldstyle. So all monospaced fonts have tabular figures, but most proportional fonts do not.
7
In most IDEs, you may choose whatever font you like. If you find an oldstyle font more readable, pick it.
Note that all (nearly all?) oldstyle fonts are proportional, while proportional fonts have some issues when using them in programming context.
Aside that, let’s test and compare some oldstyle fonts to the fonts usually used in IDEs. I have only Windows environment for tests; if anyone could add illustrations for fonts used in MacOS or Linux, feel free to edit the answer.
There are multiple oldstyle fonts installed by default in Windows/Microsoft Office:
In order to avoid duplicates and shorten the answer, I take only three oldstyle fonts: Georgia, Corbel and Gabriola and three classical fonts: Courier New, Lucida Console and Consolas.
Courier New
Simple to use, but hard to make the difference between the digit “0” and the capital “O”. The text is too light, which would make it difficult to read on a black background with light text.
Lucida Console
Same problem with digit “0” and capital “O”, but compared to Courier New, the text is easy to read even on black background.
Consolas
The recent Consolas font was specifically created to use in IDEs and other source code-related contexts and to replace the former Courier New. It totally removes the ambiguity between the letter “O” and the digit “0” by using slashed zero character.
It remains very readable for both large and small sizes and for both light text on dark background and dark text on light background contexts. If you use ClearType, Consolas is an excellent choice.
Georgia
This is a nice font, but was rather designed for print. On an LCD screen, small text has some glitches with whitespace which feels not very uniform (as you can see on the screenshot).
The largest issue is that there is nearly no way to make the difference between the small letter “o” and the digit “0”. Seriously, is it CoordinatesOfo
or CoordinatesOf0
? This sole issue is a deal breaker for an IDE.
Corbel
The font is very readable, even with a small size text. Due to oldstyle, numbers are very easy to read too.
On the other hand, this font suffers the same issue that Garamond: no clear difference between the small letter “o” and the digit “0”. This sole issue is a deal breaker for an IDE.
Gabriola
As you can see, the font is impossible to use, unless you set a very large size in your IDE. This font is for happy new year cards, not for programming.
In conclusion, most oldstyle fonts suffer from the similarity between the small letter “o” and the digit “0”, and in many cases, there is no way at all to make the difference between the two. See for example Gabriola or High Tower Text: those two characters seem identical.
Solutions
If you’re in love with oldstyle figures, there are two other solutions.
1. OpenType oldstyle
Actually, OpenType has an oldstyle feature for some non-oldstyle fonts. For example, Consolas font has this feature. I can’t find neither how you can turn this feature on in Visual Studio, nor even how to do it in Microsoft Word 2007, but you may deep more in this direction if oldstyle is something you really need, but can’t afford losing the strong points of monospace fonts.
Microsoft Word 2010 seems to support old-style option for OpenType fonts, but I don’t have Office 2010 to actually test it.
Visual Studio 2010 may also be able to support it through an addin which changes the WPF options of the editor, since the oldstyle option exists in XAML and Visual Studio 2010 and later uses WPF.
2. Syntax highlight
Another solution is to use a real oldstyle font, but with syntax highlighting for digits:
Personally, I don’t know any IDE which would support that. Visual Studio, for example, let you personalize the color of numbers (for example “123D” in var a = 123D;
), but not digits (for example ‘5’ in this.label5.Text = "Hello";
). But there is probably a way to write an addin for an IDE to change the syntax highlighting.
1
I used to be a big fan of the proggy fonts, they are fixed width, very clear and distinguish 0/O 1/I very well.
But with the better fonts (eg consolas) in VS2010 and now that truetype finally works properly I don’t use them as much.
2