[Tex/LaTex] non-invasive kerning/spacing modification: what options are there

big-listfontskerningspacingtypography

Once in a while, you may want to (1) adjust or create a kerning pair (or, better yet, kerning class) in a font, or (2) adjust a particular glyph's sidebearings.

examples of scenario (1) would include a font that's lacking a certain kerning pair/class, such as when more ›exotic‹ variants of a glyph were overlooked by the designer: W + a is kerned, but W + á isn't. Or: adjusting punctuation spacing for a certain linguistic context, such as the famously loose puncutation spacing common in French. Scenario (2) would apply, for example, when a particular glyph is too close to (or two far away from) all its possible neighbors, whatever these may be. Such as the slash in an otherwise well-made font I recently licensed.

Obviously, you may edit the font file itself, but this may not be desirable for several reasons, and it may not be permitted by the font's EULA either. I'd like to arrive at a little survey that addresses questions like:
* what »non-invasive« methods are available for these purposes?
* what engines are they compatible with?
* what are pros and cons?

The two options that I can think of I've already posted as answers. Feel free to edit, as there might be more to be said about them.

Best Answer

OpenType feature files

We can create an OpenType feature file and use pos command for quite complex spacing and positioning modifications (including vertical ones). Kerning adjustments can be done traditionally (i.e. in pairs), or, more conveniently, using classes in which a number of variants of a glyph (a, ä, â...) get treated the same. The most basic example is probably something like this:

\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{filecontents}

\begin{filecontents*}{test.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;
feature test {
    pos T -200 a;
} test;
\end{filecontents*}

\setmainfont[FeatureFile=test.fea]{TeX Gyre Schola}

\begin{document}
Ta\par
\addfontfeatures{RawFeature=+test}
Ta
\end{document} 

Can be used for all the scenarios above; rather straightforward but pretty versatile syntax.

Cons: engines. LuaLaTeX only (IIRC). Maybe some other cons (to be expanded)