29 July 2015

Do You Code? You Should Try This Font

Coders look for different things in a typeface than normal people do. While most of us choose a font for the character it imparts to our words (Baskerville for authority, Comic Sans for playfulness, and so on), programmers want a font that is clean, uniform, highly readable, and precise, just like good code. Monoid is a new font designed by Andreas Larsen that aims to do all the above, and more. An open-source font aimed at coders, Monoid has been designed, first and foremost, to be highly readable even when you're scanning through ten thousand of lines of C++, looking for that one bug-causing typo.


The guiding design principals of Monoid, according to Larsen, was that his code be legible, compact, and pretty. Like most coding fonts, Monoid is a monospaced font, meaning that all the characters take up the exact same width onscreen. This can help coders scan for syntax errors. Despite this, though, Monoid is fairly tightly spaced, largely because Larsen wanted to make sure that as much code as possible could fit on the screen when rendered in Monoid.


But where Monoid really shines compared to other coding fonts is in the distinguishability of its glyphs. In any typeface, there are going to be letters that look like each other: a lowercase 'i' and a lowercase 'l' for example, or the difference between an O and a zero. In Monoid, Larsen took great care to design characters so that they are easy to tell apart, even with glyphs you wouldn't think look a lot alike, like an R and a B. In English and other languages, the chances of you mistaking those letters for one another are nil, because the rest of the word provides clear context, but when scanning code, a programmer could easily mistake one for the other... let alone a zero, an O, a Greek theta, and a Nordic Ø. Larsen takes care in these and other glyphs to make each one unique, using differently sized curves, ascenders and descenders, and other details as subtle cues to make each character unique.


Of course, with a font like this, theory's all well and good, but the proof is in the programming: how many actual bugs will it help programmers avoid? Luckily, Larsen has made Monoid available as an open-source typeface, meaning that it can be refined over time by the coders who are using it. You can find the official Monoid community page here if you want to get involved; otherwise read about Larsen's design process on Medium here and here.