Skip to main content
Updated link to the Carolingian minuscule.
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59

To illustrate, let’s examine a freely available Carolingian minusculea freely available Carolingian minuscule. With liga, it produces results one could use to ease students into a paleography course:

To illustrate, let’s examine a freely available Carolingian minuscule. With liga, it produces results one could use to ease students into a paleography course:

To illustrate, let’s examine a freely available Carolingian minuscule. With liga, it produces results one could use to ease students into a paleography course:

added second method of dealing with ‘stubborn fonts’
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59

If a font’s liga feature contains many ligatures, it’s easier to keep liga on, break up only the problematic ligatures, and then restore them in rlig. For example, this produces the same output as above:

\documentclass{article}
\usepackage{fontspec}
\directlua{
  fonts.handlers.otf.addfeature{
    name = "nolg",
    type = "multiple",
    data = {
      ['fi'] = { "f", "i" },
      ['fl'] = { "f", "l" },
    },
  }
  fonts.handlers.otf.addfeature{
    name = "rlig",
    type = "ligature",
    data = {
      ['ffi'] = { "f", "f", "i" },
      ['ffl'] = { "f", "f", "l" },
      ['fb'] = { "f", "b" },
      ['ff'] = { "f", "f" },
      ['fh'] = { "f", "h" },
      ['fi'] = { "f", "i" },
      ['fj'] = { "f", "j" },
      ['fk'] = { "f", "k" },
      ['fl'] = { "f", "l" },
    },
  }
  fonts.handlers.otf.addfeature{
    name = "ilig",
    type = "ligature",
    data = {
      ['Th'] = { "T", "h" },
      ['Th.swsh'] = { "T.swsh", "h" },
    },
  }
}
\setmainfont{Newstyle}[
  Script=Default,
  Numbers=OldStyle,
  ItalicFeatures={RawFeature=+ilig},
  RawFeature=+nolg]
\begin{document}
The five baffled officials flew off.

\textit{The five baffled officials flew off.}

\textit{\addfontfeatures{Style=Swash}The five baffled officials flew off.}
\end{document}

If a font’s liga feature contains many ligatures, it’s easier to keep liga on, break up only the problematic ligatures, and then restore them in rlig. For example, this produces the same output as above:

\documentclass{article}
\usepackage{fontspec}
\directlua{
  fonts.handlers.otf.addfeature{
    name = "nolg",
    type = "multiple",
    data = {
      ['fi'] = { "f", "i" },
      ['fl'] = { "f", "l" },
    },
  }
  fonts.handlers.otf.addfeature{
    name = "rlig",
    type = "ligature",
    data = {
      ['ffi'] = { "f", "f", "i" },
      ['ffl'] = { "f", "f", "l" },
      ['fb'] = { "f", "b" },
      ['ff'] = { "f", "f" },
      ['fh'] = { "f", "h" },
      ['fi'] = { "f", "i" },
      ['fj'] = { "f", "j" },
      ['fk'] = { "f", "k" },
      ['fl'] = { "f", "l" },
    },
  }
  fonts.handlers.otf.addfeature{
    name = "ilig",
    type = "ligature",
    data = {
      ['Th'] = { "T", "h" },
      ['Th.swsh'] = { "T.swsh", "h" },
    },
  }
}
\setmainfont{Newstyle}[
  Script=Default,
  Numbers=OldStyle,
  ItalicFeatures={RawFeature=+ilig},
  RawFeature=+nolg]
\begin{document}
The five baffled officials flew off.

\textit{The five baffled officials flew off.}

\textit{\addfontfeatures{Style=Swash}The five baffled officials flew off.}
\end{document}
updated link to FPL Neu
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59

In ['f_i'] = { "f", "i" }, ['f_i'] is the glyph name of the ligature, and { "f", "i" } are the letters to be ligatured. So if your font calls the ligature “fi”‘fi’ rather than “f_i”‘f_i’, you should write ['fi'] = { "f", "i" }. Also note that, in some fonts, ['f_f_b'] = { "f", "f", "b" } doesn’t work, but ['f_f_b'] = { "ff", "b" } does.

Crimson isn’t of much use to illustrate removal of ligatures, so here’s FPL Neu (www.alice-dsl.net/ralfstubner/fplneu-otf.htmlgithub.com/rstub/fplneu) without its “fk”‘fk’ ligature:

Some fonts put more in their liga feature than one could wish. For example, LTC Kaatskill Pro, a lovely Goudy design, makes œ a standard rather than a discretionary ligature, with the result that not only words like “œdema”‘œdema’ but even “does”‘does’ and “poem”‘poem’ are affected. Using type = "multiple", as for “fk”‘fk’ above, would fix “does”‘does’ but interfere with “œdema‘œdema, so we need another approach.

Besides the harmless “ff‘ff,” “fi’ ‘fi,” “fl’ ‘fl,” “ft’ ‘ft, and “ll‘ll, liga adds an “oe”‘oe’ ligature and e caudata for “ae”;‘ae’; it also replaces “i”‘i’ and “j”‘j’ with their dotless versions, and substitutes “ſ”‘ſ’ for “s‘s,” “u”’ ‘u’ for “v‘v, and “V”‘V’ for “U‘U. We can remove those ligatures and substitutions by turning off liga, and add back the harmless ligatures by defining them as rlig, a feature which is on by default:

For example, Goudy’s Newstyle defines “fi”‘fi’ and “fl”‘fl’ in its liga feature, and slightly different “fi”‘fi’ and “fl”‘fl’ glyphs in its dlig feature. There are also glyphs for “ct‘ct,” “fb’ ‘fb,” “ff’ ‘ff,” “ffi’ ‘ffi,” “fj’ ‘fj,” “ffl’ ‘ffl,” “fk’ ‘fk,” “st’ ‘st, and (in the italic) “Th‘Th, but no feature is defined to ease their use. Adding the two-character ligatures to liga works, but adding the “ffi”‘ffi’ and “ffl”‘ffl’ ligatures doesn’t, apparently because the “fi”‘fi’ and “fl”‘fl’ ligatures are already in the lookup. But all is well if we turn off liga and define the ligatures we want as rlig:

In ['f_i'] = { "f", "i" }, ['f_i'] is the glyph name of the ligature, and { "f", "i" } are the letters to be ligatured. So if your font calls the ligature “fi” rather than “f_i”, you should write ['fi'] = { "f", "i" }. Also note that, in some fonts, ['f_f_b'] = { "f", "f", "b" } doesn’t work, but ['f_f_b'] = { "ff", "b" } does.

Crimson isn’t of much use to illustrate removal of ligatures, so here’s FPL Neu (www.alice-dsl.net/ralfstubner/fplneu-otf.html) without its “fk” ligature:

Some fonts put more in their liga feature than one could wish. For example, LTC Kaatskill Pro, a lovely Goudy design, makes œ a standard rather than a discretionary ligature, with the result that not only words like “œdema” but even “does” and “poem” are affected. Using type = "multiple", as for “fk” above, would fix “does” but interfere with “œdema, so we need another approach.

Besides the harmless “ff,” “fi,” “fl,” “ft, and “ll, liga adds an “oe” ligature and e caudata for “ae”; it also replaces “i” and “j” with their dotless versions, and substitutes “ſ” for “s,” “u” for “v, and “V” for “U. We can remove those ligatures and substitutions by turning off liga, and add back the harmless ligatures by defining them as rlig, a feature which is on by default:

For example, Goudy’s Newstyle defines “fi” and “fl” in its liga feature, and slightly different “fi” and “fl” glyphs in its dlig feature. There are also glyphs for “ct,” “fb,” “ff,” “ffi,” “fj,” “ffl,” “fk,” “st, and (in the italic) “Th, but no feature is defined to ease their use. Adding the two-character ligatures to liga works, but adding the “ffi” and “ffl” ligatures doesn’t, apparently because the “fi” and “fl” ligatures are already in the lookup. But all is well if we turn off liga and define the ligatures we want as rlig:

In ['f_i'] = { "f", "i" }, ['f_i'] is the glyph name of the ligature, and { "f", "i" } are the letters to be ligatured. So if your font calls the ligature ‘fi’ rather than ‘f_i’, you should write ['fi'] = { "f", "i" }. Also note that, in some fonts, ['f_f_b'] = { "f", "f", "b" } doesn’t work, but ['f_f_b'] = { "ff", "b" } does.

Crimson isn’t of much use to illustrate removal of ligatures, so here’s FPL Neu (github.com/rstub/fplneu) without its ‘fk’ ligature:

Some fonts put more in their liga feature than one could wish. For example, LTC Kaatskill Pro, a lovely Goudy design, makes œ a standard rather than a discretionary ligature, with the result that not only words like ‘œdema’ but even ‘does’ and ‘poem’ are affected. Using type = "multiple", as for ‘fk’ above, would fix ‘does’ but interfere with ‘œdema, so we need another approach.

Besides the harmless ‘ff,’ ‘fi,’ ‘fl,’ ‘ft, and ‘ll, liga adds an ‘oe’ ligature and e caudata for ‘ae’; it also replaces ‘i’ and ‘j’ with their dotless versions, and substitutes ‘ſ’ for ‘s,’ ‘u’ for ‘v, and ‘V’ for ‘U. We can remove those ligatures and substitutions by turning off liga, and add back the harmless ligatures by defining them as rlig, a feature which is on by default:

For example, Goudy’s Newstyle defines ‘fi’ and ‘fl’ in its liga feature, and slightly different ‘fi’ and ‘fl’ glyphs in its dlig feature. There are also glyphs for ‘ct,’ ‘fb,’ ‘ff,’ ‘ffi,’ ‘fj,’ ‘ffl,’ ‘fk,’ ‘st, and (in the italic) ‘Th, but no feature is defined to ease their use. Adding the two-character ligatures to liga works, but adding the ‘ffi’ and ‘ffl’ ligatures doesn’t, apparently because the ‘fi’ and ‘fl’ ligatures are already in the lookup. But all is well if we turn off liga and define the ligatures we want as rlig:

added link to GitHub
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added how to fix wrongly ordered lookups
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added contextual alternates and made cosmetic fixes
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added section on selecting among ligatures
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
Bounty Ended with 100 reputation awarded by Henri Menke
updated for February 2017 version of luaotfload as Ulrike explained
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added solution for old-style numbers
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
Added the case of ff b.
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added removal of ligatures
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added sups
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
type = "alternate" rather than type = "substitution" — though the result is the same
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
added salt
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
noted that ligatures may have different glyph names in different fonts
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading
Source Link
Thérèse
  • 12.8k
  • 3
  • 37
  • 59
Loading