Dylan's Advent of Cool Nerd Things Day 10: Fira Code
Posted by Dylan Beattie on 10 December 2020 • permalinkToday’s Cool Nerdvent Thing isn’t a tool, or a utility, or a website, or a hidden Windows feature… it’s a font. But not just any font – this font is Fira Code, and it is absolutely the best font ever created for computer programming.
Modern computer font systems like TrueType and OpenType support a feature called ligatures. Ligatures date all the way back to the days of mechanical typesetting and movable type, when printers (as in, people who run printing presses, as opposed to, say, HP Laserjets) would pick a specific glyph to represent common pairs of characters:
You can get lots of fonts that include ligatures for common letter sequences like those above, but Fira Code takes things to a whole new level by using ligatures to replace common programming character sequences with symbols. It’s not the only programming font that uses ligatures – there’s a great article on Better Web Type about monospaced fonts with coding ligatures – but it’s one of the best, and it’s definitely my personal favourite.
Here’s a snippet of F# code using the regular Consolas typeface, and the same code shown in Fira Code:
This is exactly the same source code – it’s a regular ASCII text file; the only thing that’s changed is the font. At a glance, the ligatures might look like an eye-catching gimmick, but I find them really, really useful for working on code that has lots of gnarly operators - if you’ve ever had a JavaScript bug caused by double-equals (==
’) vs triple-equals (===
), you’ll appreciate how visually distinct Fira Code makes these two character sequences.
Underneath the ligatures, though, there’s a really solid, readable monospaced font, available in various weights for different kinds of editors and displays. Fira Code is released under the SIL Open Font License 1.1, and it’s available as a TrueType TTF file that’ll work on most operating systems, most text editors and programming tools, and it’s available in Open Font WOFF format for use on your website as well.
Fira Code is created by Niki Tonsky, and it’s available at https://github.com/tonsky/FiraCode.