I want to use a font which contains glyphs for some common ligatures (fi, fl, ff, ffi, ffl) and actually needs them to avoid ugly collisions. However, for some reason they are not accessible via any OpenType feature or similar, but only through the respective Unicode characters. I do not want to tweak the font itself since I want my document to be compilable by others without supplying my tweaked font.

What I am now looking for is a way to emulate a normal ligature feature from within TeX (more precisely, XeLaTeX). For example, whenever the source contains fi, I want it to be rendered using the ligature glyph. I do not want to use the Unicode character for this ligature () in the source, nor do I want to use a custom command (such as \newcommand{\fi}{fi}). Given, that regular TeX does something similar when rendering -- as “–”, I expect this to be possible.

I thought about using XeTeX’s inter-char tokens for this (see, e.g., the second half of this answer), but I could not get beyond inserting something in between the two characters. I am also aware of this question, whose answer is specific to LuaTeX, however.

  • TeX is not at all having any command to render -- as a dash, there is no macro expansion involved! The ligature -- is simply hard-coded in all TeX fonts. It works in Lua/XeLaTeX because the font engine has been told to do so, through Ligatures=TeX. It should be possible to somehow add a ligature, but I don't know how, sorry. – yo' Sep 12 '15 at 10:12
  • 2
    Search for "teckit". – Ulrike Fischer Sep 12 '15 at 10:17
  • 2
    I was just going to say the manual says this, but Ulrike beat me to it: Some font features may be applied for any font. These are mapping=<font map> Uses the specified font mapping for this font. This uses the TECKit engine to transform unicode characters in the last-minute processing stage of the source. For example, mapping=tex-text will enable the classical mappings from ugly ascii ``---'' to proper typographical glyphs "--", and so on. – David Carlisle Sep 12 '15 at 10:20
  • @DavidCarlisle: That did the trick – thank you. Am I correct in understanding that this solution requires the respective map to be compiled for each operating system separately? Also, do you want to turn this into an answer or shall I? – Wrzlprmft Sep 12 '15 at 14:24
  • @Wrzlprmft you better do the answer, I couldn't actually figure out from the manual exactly what you have to do, it just seemed to be saying it was possible:-) I doubt the "compilation" is OS dependent it will be compiling to some binary structure (like tex format files) but I've never done it... – David Carlisle Sep 12 '15 at 15:03

Browse other questions tagged or ask your own question.