[Tex/LaTex] Suppress certain ligatures generally

fontsligaturesluatex

Whether or not certain ligatures should be used (if available in a font) is a least in theory depending on the language used. For example traditional German texts would not have an "ffl" ligature but would have "ft" and also "ch" and "ck".

pdfTeX supports disabling selected ligutures but you will always disable the full set beginning with a certain character, so it is not possible to drop "ffl" but keep "fi", say. (I haven't checked what pdfTeX actually does, this is my understanding from the microtype manual).

From reading through the LuaTeX manual I can see that there should be (in theory) much finer control possible, but I don't see concepts to hook into the ligature mechanism to easily provide a language-based abstraction. In my opinion a mechanism should apply at (or close to) the typesetting stage and not at during input preparation, i.e., the answer to "Can one suppress ligatures for certain words?" addresses this too early in the game.

So my questions are:

  • Has something for this already be programmed?
  • If not, how complicated would it be, given the current functionality in LuaTeX, or are there some useful interfaces for this still missing?

Unfortunately this doesn't address how to specify that for certain languages you may want to have "ligature-kerns" i.e., some extra kerning used only in a particular language to bring some character pairs closer together than in other languages.

Best Answer

In addition to the question Can one (more or less) automatically suppress ligatures for certain words? (and the associated answers) that you already mention in your posting, you may also want to check out the content of the follow-up questions: Any suggestions/requests for features for a new package that allows disabling ligatures for (pre)selected words? and How to suppress the operation of a luatex-defined macro on a string if the string is part of macro or a label. Shameless self-citation alert!

In the latter question in particular, I provided the rudiments of lua code to suppress the use of certain (or all) ligatures for certain words. This code could easily be made language-specific by linking it, say, to the use of a language option set in babel.

Unfortunately, my initial plans to create a stand-alone package that implements this approach have gotten stymied after I discovered that the code is too powerful: the ligature substitution (suppression, if you will) algorithm cannot be instructed not to operate on TeX macros; e.g., should there be a macro named \auflaufen, one apparently cannot instruct luatex not to replace the string "auflaufen" with "auf{\hspace{0pt}}laufen}, leading to unpredictably chaotic consequences. Similarly, the ligature suppression algorithm can't be instructed not to operate on the arguments of certain macros such as \label and \ref (and, by extension, \vref, \cref etc.). For these reasons I've given up for now on making this a standalone package, as its applicability would always be "experimental" at best. Hopefully, more lua programming tools and hooks will be made available so that it'll become possible to set up the needed exceptions (e.g., don't operate on the names of TeX macros, and don't operate on the arguments of \label, \ref, etc) to make the approach I've developed usable for a general public.