Usage Of Typographic Ligature In Coding

Usage Of Typographic Ligature In Coding

In writing and typography, a ligature occurs where two or more graphemes or letters are joined as a single glyph. In this article, I’d like to introduce several fonts that supports ligatures you can use in various coding tools and text editors.

The concept of Typographic ligature is defined like this1:

In writing and typography, a ligature occurs where two or more graphemes or letters are joined as a single glyph. An example is the character æ as used in English, in which the letters a and e are joined. The common ampersand (&) developed from a ligature in which the handwritten Latin letters e and t (spelling et, from the Latin for “and”) were combined.

The benefit of ligatures is the improvement of the readability of the symbols. Here is a comparison of the fonts that supports ligatures2 versus the ordinary monospaced3 one:

all_ligatures

As the diagram shown above, the ligatures greatly improved the conciseness and readability of the symbols. There are many monospaced fonts that supports ligatures that we can use in our daily coding work. Here are some popular ones: FiraCode, Hasklig4 and PragmataPro5.

Here is a screenshot of using FiraCode in Atom6:

atom

As the screenshot shown above, we can see how the symbols like ==, !=, >= are displayed with ligatures enabled.

Not only Atom, but many coding tools and text editors are supporting ligatures nowadays, such as IntelliJ7 and Emacs. You can check your editors to see if it supports ligatures or not. Here is a screenshot that shows how to enable font ligatures in IntelliJ:

2017-03-08-intellij-ligature.png

Finally, I’d like to recommend an interesting article related with ligatures8 for reading.

References

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues