Skip to main content

Ligatures in coding fonts

Posted in Development

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.

Accessibility in your inbox

I send an accessibility-centric newsletter on the last day of every month, containing:

  • A roundup of the articles I’ve posted
  • A hot pick from my archives
  • Some interesting posts from around the web

I don’t collect any data on when, where or if people open the emails I send them. Your email will only be used to send you newsletters and will never be passed on. You can unsubscribe at any time.

More posts

Here are a couple more posts for you to enjoy. If that’s not enough, have a look at the full list.

  1. Alt text for CSS generated content

    There’s an interesting feature in Safari 17.4 that allows content added with CSS to have ‘alt’ text. I’m not sure how I feel about this.

  2. The accessibility conversations you want to be having

    In most companies, accessibility conversations centre around WCAG compliance, but that’s just the start. Thinking beyond that is where you want to be!