Ligatures in coding fonts

In the same way I enjoy trying out a new text editor every now and then, I do the same with my code colour scheme and font – a change just freshens things up a bit.

For a long time, I’ve used Mozilla’s Fira Mono and have been very happy with it – I have no trouble distinguishing similar characters (0s and Os, 1s and ls), it renders nicely on macOS and is comfortable to read.

But my head was turned by a fork of Fira Mono called Fira Code; it’s pretty much exactly the same but with one killer feature: ligatures. Coding ligatures are the ‘correct’ way of writing operators, for example:

  • != (not equal to) becomes
  • >= (greater than or equal to) becomes
  • => (the JavaScript arrow function) becomes

Using != as an example, you still type two characters, ! and = but Fira Code makes them look like a ; the only difference is that the new not equal sign spans two characters, taking up the same amount of space as the characters you typed. Press backspace once and it leaves you with a !. Nifty.

There are loads of operator ligatures as well as other nice touches like the classic Fl/fl ligatures and nicely joined-up Markdown header ### markers. The Fira Code repo has an easy-to-look-at comparison of all the ligatures it uses alongside Fira Mono.

But I couldn’t get used to it! And I realised I didn’t want to get used to it. I like customisation, but I have my limits, and ligatures feel like they go too far:

  • I’ve been writing ligature-less operators for the longest time so I’d’ve had to effectively re-learn them
  • I’d then be locked in a world where I could only use coding fonts with operator ligatures, which would limit my options
  • Using ligatures for code examples on my website, presentation or video would mean most people would have to work harder to translate my fancy operators back into the ones they use every day

There are plenty of alternatives to Fira Code and as Nikita Prokopov, who made the Fira Code fork, says:

Ideally, all programming languages should be designed with full-fledged Unicode symbols for operators

If they were, I wouldn’t have a problem using them as they’d be universally expected and understood, but until operator ligatures are the norm I’m happy with my boring old unjoined-up operators.

Posted in Development

Follow along

If you enjoyed this post and want to know when the next one is published, head to Twitter and hit ‘Follow’.

Twitter @tempertemper

Or read more articles