5 open source fonts ideal for programming

Programming fonts have certain features that you won't find in regular typefaces; here are five fonts to consider.
1042 readers like this.
5 trends in open source documentation

Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0

What is the best programming font? First, you need to consider that not all fonts are created equally. When choosing a font for casual reading, the reader expects the letters to smoothly flow into one another, giving an easy and enjoyable experience. A single character for a standard font is akin to puzzle piece designed to carefully mesh with every other part of the overall typeface.

When writing code, however, your font requirements are typically more functional in nature. This is why most programmers prefer to use monospaced fonts with fixed-width letters, when given the option. Selecting a font that has distinguishable numbers and punctuation, is aesthetically pleasing, and has a copyright license that meets your needs is also important.

There are certain features that make a font optimal for programming. First, a detailed definition of what makes a monospaced font is in order. Consider the letter "w" as it compares to the letter "i" for a moment. When you are dealing with a font, it is important to think about the whitespace around the letter, as well as the letter itself. In the world of physical books and newspapers, where efficient use of space is often critical, it makes sense to assign less width to the thin "i" than the wide "w."

There are certain features that make a font optimal for programming.
Inside a terminal, however, you are blessed with no such restrictions, and it can be very useful for every character to share an identical amount of space. The main functional benefit is that you can effectively "guesstimate" how long your code is by casually glancing at a block of text. Secondary benefits include the ability to align characters and punctuation easily, highlighting is much more visually obvious, and optical character recognition on printed sheets is more effective for monospaced fonts than proportional fonts.

In this article we will explore five excellent open source font options that are ideal for programming and writing code.

1. Firacode: The best overall programming font

FiraCode example

opensource.com

The first font on our list is FiraCode, a programming font that truly goes above and beyond the call of duty. FiraCode is an extension of Fira, the open source font family commissioned by Mozilla. What makes FiraCode different is that it modifies the common symbol combinations or ligatures used in code to be extraordinarily readable. This font family comes in several styles, notably including a Retina option. You can find examples for how it applies to many programming languages on its GitHub page.

FiraCode compared to Fira Mono

opensource.com

2. Inconsolata: Elegant and created by a brilliant designer

Inconsolata example

opensource.com

Inconsolata is one of the most beautiful monospaced fonts. It has been around since 2006 as an open source and freely available option. The creator, Raph Levien designed Inconsolata with one basic statement in mind: "monospaced fonts do not have to suck." Two things that stand out about Inconsolata are its extremely clear differences between 0 and O and its well-defined punctuation.

3. DejaVu Sans Mono: Standard issue with many Linux distros and huge glyph coverage

DejaVu Sans Mono example

opensource.com

Inspired by the copyrighted and closed Vera font family used in GNOME, DejaVu Sans Mono is an extremely popular programming font that comes bundled with nearly every modern Linux distribution. DejaVu comes packed with a whopping 3,310 glyphs under the Book Variant, compared to a standard font, which normally rests easy at around 100 glyphs. You'll have no shortage of characters to work with, it has enormous coverage over Unicode, and it is actively growing all of the time.

4. Source Code Pro: Elegant and readable, created by a small, talented team at Adobe

Source Code Pro example

opensource.com

Designed by Paul Hunt and Teo Tuominen, Source Code Pro was produced by Adobe to be one of its first open source fonts. Source Code Pro is notable in that it is extremely readable and has excellent differentiation between potentially confusing characters and punctuation. Source Code Pro is also a font family and comes in seven different styles: Extralight, Light, Regular, Medium, Semibold, Bold, and Black, with italic variants of each.

Differentiating potentially confusable characters

opensource.com

Metacharacters with special meaning in computer languages

opensource.com

5. Noto Mono: Enormous language coverage, created by a large team at Google

Noto Mono example

opensource.com

The last font on our list is Noto Mono, the monospaced version of the expansive Noto font family by Google. While not specifically designed for programming, Noto Mono is available in 209 languages (including emoji!) and is actively supported and updated. The project is enormous and is an extension of Google's stated mission to organize the world's information. If you want to learn more about it, check out this excellent video about the font.

Choosing the right font

Whichever typeface you select, you will most likely spend hours each day immersed within it, so make sure it resonates with you on an aesthetic and philosophical level. Choosing the right open source font is an important part of making sure that you have the best possible environment for productivity. Any of these fonts is a fantastic choice, and each option has a powerful feature set that lets it stand out from the rest.

Andrew Lekashman Profile Picture
My name is Andrew Lekashman I serve as the business head for Input Club, a product development lab that invents Open Source keyboard technology. Our newest product, the WhiteFox is available for pre-order at https://kono.store

11 Comments

I love Source Code Pro and have been using it for some time. I find that the letters and numbers are really easy to see and distinguish. I use Source Code Pro exclusively in my GNOME Terminal program.

I've lately gone back to VGA fonts for programming. I grew up programming computers at the "console" before GUIs, so the VGA "throwback" is really comfortable for me. I even modified my Gedit theme to look like an old-school DOS editor. I set the font size so I get about 80 columns if the editor takes up one half of my screen. That seems the right size for me; not too big, not too small.

VGA fonts:
https://int10h.org/oldschool-pc-fonts/fontlist/

Gedit theme:
http://opensource-usability.blogspot.com/2017/04/a-throwback-theme-for-…

What a great topic. I'm going to start using some of these fonts right now. Thanks for putting this together.

Just from your examples, I would say that either DejaVu Sans and Source Code Pro are about equally readable. Firacode has funky-looking ampersand and @. Inconsolata shows the problem of differentiating a lower case L from a number one. Noto Mono shows the lower case L problem and also trouble between letter O and number zero. These are big problems with fonts because you often don't have the usual language context to help decide this characters.

I agree, but I like DejaVu Sans better than SourceCode Pro beacuse this one's too wide for my tastes, it makes lines seem impossibly long.
Hack (mentioned below) is a nice alternative.

And FiraCode replacing ===, !=, etc with glyphs? Yikes!
I seriously hope it won't start a trend...

In reply to by Greg P

I've used Source Code Pro, but then switched to Hack which I've used fairly exclusively since.

https://github.com/source-foundry/Hack

Great article! Thanks, I did not know it.

I like r_ansi I think it is truetype, I use it on windows for Putty and notepad

Great article! your article is very informatic and unique. Thank you for sharing this article.

Another one is IBM Plex: https://ibm.github.io/type/

The complete family includes the monospace version available in different weights.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.