Tarin Gamberini

A software engineer and a passionate java programmer

Choose Your Font Or It Will Choose You

Last week a colleague of mine sat at my console to teach me how to solve a problem he had had using a (not so intuitive) client interface. He was amused by the character’s look in my IDE and he found funny I have chosen DejaVu Sans Mono font to write programs.

I think every programmer should have thought about which font to use, about once in his(her) professional life, both to be more productive and to reduce reading errors, and to relief eyes straining too.

Emotional bias

If you have never thought about which font to use for programming it is likely you are using the default one provided by your favorite plain-text editor or IDE. This is what I mean by:

if you don't choose your font then it will choose you

So consider how you feel when you think about your favorite editor, and think that such feeling might be even better if you made a deliberate choice about the font you will use in the future. Don’t let your emotions about your favorite editor make you think that choosing a font were a thing of little importance. In the end you might still prefer the default font, but in that case you will have chosen it.

The first time I realized windows based operating systems were slowing down my productivity I started using the terminal window. I initially set green font over black background because that makes me feel like an old school hacker :-) But it has not passed too much since I have left this pleasing feeling because I have realized that text syntax coloring would have let me became even more productive.

So take few moments to choose your font or it will choose you.

Designed for programming

Some fonts are well readable, which make them preferable for writers. Others are readable and specifically designed for programming, so they let you distinguish very well similar characters like some rounded:

the number zero   0
uppercased o      O
lowercased O      o

some sharped:

the number one    1
lowercased L      l
uppercased i      I
pipe              |
exclamation mark  !

or some like:

single quote      '
back tick         `
two single quote  ''
double quote      "

or like:

question mark     ?
the number seven  7

Moreover some letter are clearly different when represented uppercased and lowercased like a A, but other letters are very similar so they should be, again, well distinguishable:

c C   k K   m M   o O   s S   u U   v V   w W   x X   w W  z Z

Usually programs are written using mono-spaced fonts, because this allows you to indent text in a way which better convey code’s structure. To mark block structure parenthesis of any kinds are used and you should choose the font which let you gracefully align parenthesis with characters:

() [] {} <>

Scalability

A font is represented by a file which contains a set of glyphs: numbers, characters, symbols. Such file stores data mainly in three formats:

  • Bitmap fonts consist of a matrix of dots or pixels representing the image of each glyph in each face and size
  • Outline fonts (also called vector fonts) use Bézier curves, drawing instructions and mathematical formulae to describe each glyph
  • Stroke fonts use a series of specified lines and additional information to define the profile

Outline and Stroke ones scale very well to any size, but they require some additional computation to be rendered. On the other hand bitmap fonts are rendered very fast, but might not scale always very well.

In modern computer and operating systems computation is no more a problem, so outline fonts are widely spread and adopted. Moreover techniques like anti-aliasing have made mono-space fonts look great at almost any size, but you might perceive problem at low scaling.

Some font families are designed for being used on the small screens of mobile handsets, other are optimized for modern displays for use in applications and the web.

So when choosing your font think where you will use it:

  • editor window to write texts and programs
  • editor window with split vertically (you might prefer narrower faces)
  • terminal window to see logs (you might prefer small size, or bitmap for a quick scrolling)
  • on a desktop environment
  • on a mobile environment

Other minor stuff

There are some other things you might be interested exploring in order to find your favorite font.

Bold or italic faces

Some plain-text editor are able to recognize the format of the file you are writing, improving the readability by applying syntax coloring and styling. In fact characters may appear in bold or italic face.

Experiment writing a simple markdown file and look at how characters are rendered as you change the font.

Spacing

Horizontal spacing between consecutive characters and vertical spacinx between consecutive rows affects readability too. So try out various fonts and choose the one you prefer.

Operating System

Popular fonts are not available for all operating systems. So if you worked across different operating systems you should choose a font available in such operating systems, or you should find a way to install the font in the operating system where it is missing.

Unicode support

Not all fonts have the same symbols. Some fonts support Unicode very well, others only for few symbols. To get an idea of the font Unicode coverage take a look at:

(Please as programmer you should use UTF-8 everywhere).

Licence

A font is a kind of software. So, as frequently happens with software, a licence go with it. A font licence may regulates how the font can be used (rendered on a screen or on a printer), modified (source code is needed), included as part of a larger software (embedded into a PDF), etc…

The font licence usually is not a problem when a programmer is only interested in reading characters on a screen or on a printed paper. Conversely font licence is more important if you work as graphic designer.

Anyway getting a glimpse at the type of licence (proprietary, free licence, open-source, creative commons, etc…), without delve into legal issues, makes us more aware of the software we are using.

Choose your font

Now it’s time for you to find your favourite font!

Explore the Internet for font examples: much has been (and will be) written about the best font for programming.

Post a comment

A comment is submitted by an ordinary e-mail. Your e-mail address will not be published or broadcast.

This blog is moderated, therefore some comments might not be published. Comments are usually approved by the moderator in one/three days.