Introduction
Almost all Visual Studio developers are already in love with the Consolas font. Consolas is an awesome, top ranked font to write code. But sadly, Consolas doesn't have any ligature support for us.
What is ligature in a language? Typographic ligature occurs when two or more letters are joined as a single letter. For example AE > Æ, OE > Œ etc. So how we can carry ligature in our code in Visual Studio? There are plenty of fonts to write code with ligature support, like- Fira Code, HasKlig, Monoid and etc. But I found Fira Code the most interesting.
In this article, we'll write code in our favorite Visual Studio with programming ligatures, using Fira Code.
Programming ligatures
If truth be told, ligatures are just font rendering features. When ligature is used in our code, the code remains same and ASCII compatible. In programming language, the conditional operators are common examples of ligature. Below, I've attached a picture of ligatures supported by Fira Code from it's GitHub repo.
Using the code
To write the code, we'll use Visual Studio 2017. First of all, we have to install Fira Code font, go to
this link to download Fira Code. After downloading Fira Code, unzip the file and find the FiraCode-Regular.ttf under ttf folder; then right click to install it.
Now, open Visual Studio's Options menu and under "Fonts and Colors", you'll find the Fira Code to select as Visual Studio font. Just select Fira Code and restart Visual Studio.
Now, we're ready to use ligature in our code in Visual Studio. Below, I've attached a quick snap of my code, find the differences!
Benefits of ligatures
In ligature, not only are multiple letters rendered correctly but other confusing elements such as spacing are too. Programming ligatures can help us read and understand our code faster.