Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling font ligatures CSS (letter combining)

Modern browsers automatically combine some letters, most commonly 'f' and 'i' to one single character called a ligature. This often optimizes legibility (i.e. easier to read), however sometimes this might not be what a designer wants.

Personally, I had this issue only in Chrome (Version 53.0.2785.101), I, although I cannot be sure, I believe this issue persists in all other versions of Chrome.

Chrome Sample text in Chrome f and i is combined multiple times

Edge Sample text in Edge

IE11 Sample text in IE

In this case I was looking for a way to turn it off.

like image 974
AwesomeGuy Avatar asked Sep 15 '16 06:09

AwesomeGuy


People also ask

How do you remove ligatures?

Open the Character panel by going to Window > Type > Character. Open the panel menu and select Ligatures to activate or deactivate them.

Should I use font ligatures?

Ligatures in programming fonts are likely to either misrepresent the meaning of the code, or cause miscues among readers. So in the end, even if they're cute, the risk of error isn't worth it.

What is font-variant ligatures?

The font-variant-ligatures CSS property controls which ligatures and contextual forms are used in textual content of the elements it applies to. This leads to more harmonized forms in the resulting text.

What are discretionary ligatures?

A discretionary ligature is more decorative in nature than a standard ligature and should be used at your discretion, as the name indicates. Some discretionary ligatures combine frequently occurring letter pairs (like “Th”) into a single graceful design.


2 Answers

As it turns out, it's definitely possible, it just required some digging. As mentioned on MDN, you can turn off common ligatures:

font-feature-settings: "liga" 0;

This, however, is done by using an obscure css property. Instead, you should use font-variant-ligatures, like so:

font-variant-ligatures: none;

These two properties does the exact same thing, however, the latter one is recommended one.

MDN:

Note: Whenever possible, Web authors should use the font-variant shorthand property or an associated longhand property, font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position.

This property is a low-level feature designed to handle special cases where no other way to enable or access an OpenType font feature exists.

In particular, this CSS property shouldn't be used to enable small caps.

like image 143
AwesomeGuy Avatar answered Sep 28 '22 14:09

AwesomeGuy


I encountered a similar problem and was directed here by Google. I never want ligatures on any webpage. (When I print a webpage to PDF and use the text-to-speech engine on my PDF reader, it skips speaking the ligatures.) Here is one solution that works for me:

Open the webpage on Chrome/linux (may work on other desktop OSes too). Install the StyleBot extension of Google Chrome. Then, in its options, click "styles" and then "edit global stylesheet". Enter the following (based on the answer of @AwesomeGuy).

body {
font-variant-ligatures: none;
font-feature-settings: "liga" 0;
}

Click "enable global stylesheet". Voila, Chrome never seems to render ligatures again (it renders the characters separately). Also, when I ask Chrome to print web pages to PDFs, characters are rendered separately.

like image 24
Abhishek Anand Avatar answered Sep 28 '22 14:09

Abhishek Anand