Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
2  
A nice article on oldstyle/lining/tabular/proportional figure styles: fontfeed.com/archives/figuring-it-out-osf-lf-and-tf-explained The comment thread mentions that tabular and oldstyle are an unusual combination, so you may be forced to use a proportional font, which has additional consequences. –  Stuart Marks Aug 18 '12 at 16:35
    
what are "oldstyle figures" and what makes these specifically programming friendly? What could be "programming-friendly features" in fonts at all? besides obvious fixed width I can not imagine anything programming-specific at all –  gnat Aug 18 '12 at 18:03
1  
@gnat: 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. –  supercat Aug 18 '12 at 18:58
    
@gnat: In general, if one is trying to examine numbers as strings of digits (e.g. parse "8675309" as "eight six seven five three oh ni-y-ine"), the "tabular" forms with unified ascent and descent are easier to read. On the other hand, multi-digit numbers written with old-style numerals have much more variation in their overall 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. –  supercat Aug 18 '12 at 19:02
2  
@gnat: I suspect that old-style numerals are probably better than tabular-style when comparing for equality, but the tabular style are better when performing arithmetic or when comparing magnitude. The old-style numbers are sometimes called "lowercase numbers", and there's a bit of an analogy both in terms of shape and usage. If one wants to read a sequence of letters sequentially "as letters", it's generally easier to read uppercase letters (which have consistent ascent and descent) that way than do so with lowercase. Of course, lowercase letters are generally easier to read "as words". –  supercat Aug 19 '12 at 16:43

2 Answers 2

up vote 18 down vote accepted

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

enter image description here

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

enter image description here

Same problem with digit "0" and capital "O", but compared to Courier New, the text is easy to read even on black background.

Consolas

enter image description here

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

enter image description here

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

enter image description here

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

enter image description here

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.

enter image description here

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:

enter image description here

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.

share|improve this answer
1  
+1 for sheer effort if nothing else. –  World Engineer Aug 19 '12 at 13:15
    
Ooh! Slashed zeros! Can't remember when I last saw one of those! –  timday Aug 19 '12 at 23:05
    
I think I'm going to insist that Fortran is printed in Fraktur - I think it deserves it! en.wikipedia.org/wiki/Fraktur_(typeface) –  Martin Beckett Aug 21 '12 at 18:06
    
MyFonts has an option to search by OpenType features, including oldstyle figures and slashed zero. –  Nicholas Aug 23 '12 at 16:01

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.

share|improve this answer
1  
Interesting, SO (or Opera) puts a slash through 0 in the edit box but not int he post! –  Martin Beckett Aug 18 '12 at 16:04
    
textarea uses Consolas in Windows Vista and later, i.e. the font which has slashed zero character. Once posted, the font used for questions or answers is Tahoma which doesn't have slashed zero (or Consolas for code blocks). –  MainMa Aug 19 '12 at 8:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.