Thursday, September 3

Hack an Editor: Fonts for Programming

We’ve recently noticed two different fonts aimed at programmers, each with a different approach to editor customization. The first, Fira Code, transparently converts common programming digraphs into single characters. For example, <- becomes an arrow and != (or <>) becomes a proper not equal sign. The other font, Hack (can’t argue with the name), aims to make commonly confused characters distinct. For example, the zero glyph has a very distinct appearance from the letter O.

It is pretty easy to understand how Hack works, but Fira seems a mystery at first. Your C++ compiler expects <- not an arrow, right? Fonts support ligatures–sequences of two symbols that run together (like æ). Clever use of these ligatures means that the compiler still sees -> but the screen displays an arrow.

Once you install the font, you still need to tell your editor to use the font, but that’s a setting in just about every IDE (even if you have to edit a configuration file somewhere). We have mixed feelings about Fira Code. It has a high cool factor, but it also feels like you are hiding the actual code and that doesn’t seem like a good thing.

If you want to roll your own, there are plenty of ways to create fonts. Naturally, you can even do it with a Web application (see video below). Of course, if you do we want to hear about it.

Thanks [k5rud] for pointing out Hack.


Filed under: Software Development, software hacks

No comments:

Post a Comment