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 (fi
) 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.
--
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, throughLigatures=TeX
. It should be possible to somehow add a ligature, but I don't know how, sorry. – yo' Sep 12 '15 at 10:12