|
|
Highlight v3.44
|
|
|
|
|
|
Using fonts with ligatures support adds extra beauty to your syntax highlighted code.
|
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
**Table of Contents**
|
|
|
|
|
|
<!-- MarkdownTOC autolink="true" bracket="round" autoanchor="false" lowercase="only_ascii" uri_encoding="true" levels="1,2,3" -->
|
|
|
|
|
|
- [About Font Ligatures](#about-font-ligatures)
|
|
|
- [Using Ligatures With Highlight](#using-ligatures-with-highlight)
|
|
|
- [Font Supporting Ligatures](#font-supporting-ligatures)
|
|
|
|
|
|
<!-- /MarkdownTOC -->
|
|
|
|
|
|
-----
|
|
|
|
|
|
# About Font Ligatures
|
|
|
|
|
|
Some source code fonts support ligatures, allowing to represent some common Ascii characters combinations with a special glyph instead — e.g. the comparison operator `>=` being substituted by `⩾`, the inequality comparator `!=` by `≠`, and the Ascii rightward arrow `->` by the `→` glyph.
|
|
|
|
|
|
Needless to say, ligatures add beauty to source code as Ascii combinations are shown with the proper symbols they intend to represent (mathemical, logical, or otherwise).
|
|
|
|
|
|
# Using Ligatures With Highlight
|
|
|
|
|
|
Here's an animated screenshot showing an Elixir code example being highlighted in Highlight GUI, using both a font that supports ligatures ([Fira Code]) and one that doesn't (Inconsolata):
|
|
|
|
|
|
![Ligatures example in Highlight GUI][screenshot Ligatures]
|
|
|
|
|
|
|
|
|
All that was required to enable ligatures in the GUI was to select a font that supports them (in the above example, [Fira Code]). Since the font settings in Highlight GUI are carried over to the converted HTML document, ligatures will also be available in the output document.
|
|
|
|
|
|
|
|
|
# Font Supporting Ligatures
|
|
|
|
|
|
Here's a list of free and open source monospaced code fonts that support ligatures:
|
|
|
|
|
|
- [Fira Code]
|
|
|
- [Hasklig]
|
|
|
- [Monoid]
|
|
|
- [Fixedsys Excelsior]
|
|
|
- [Iosevka]
|
|
|
- [DejaVu Sans Code]
|
|
|
|
|
|
Bare in mind that not all fonts support the same ligatures sets, and that some fonts might work better with some languages instead of others (for example, [Hasklig] was designed with Haskell in mind).
|
|
|
|
|
|
One of the typical ligatures combinations you should watch out for are `<=` and `=>`, which some fonts will treat as comparison operators (`⩽` and `⩾`) while others will treat them as arrows (`⇐` and `⇒`). So much so, that some fonts are avaible in two different versions for these ligatures (e.g. [Fixedsys Excelsior]).
|
|
|
|
|
|
So, you should always test your source code against various ligatures fonts before publishing your highlighted code, to ensure that you pick the font which works best with that language.
|
|
|
|
|
|
|
|
|
<!-----------------------------------------------------------------------------
|
|
|
REFERENCE LINKS
|
|
|
------------------------------------------------------------------------------>
|
|
|
|
|
|
[screenshot Ligatures]: Ligatures-Example-Elixir.gif "Screenshot of Elixir code in Highlight GUI with and without ligatures"
|
|
|
|
|
|
<!-- fonts links -->
|
|
|
|
|
|
[Fira Code]: https://github.com/tonsky/FiraCode
|
|
|
[Hasklig]: https://github.com/i-tu/Hasklig
|
|
|
[Monoid]: https://github.com/larsenwork/monoid
|
|
|
[Fixedsys Excelsior]: https://github.com/kika/fixedsys
|
|
|
[Iosevka]: https://github.com/be5invis/Iosevka
|
|
|
[DejaVu Sans Code]: https://github.com/SSNikolaevich/DejaVuSansCode
|
|
|
|
|
|
<!-- EOF --> |