Skip to main content
2 of 3
added 594 characters in body
Henri Menke
  • 110.9k
  • 18
  • 250
  • 397

How to adjust font features in LuaTeX?

As of version 2.7 of luaotfload the support for font feature files (.fea) has been dropped.

On the ConTeXt mailing list Hans showed how to make font substitution work through Lua. More examples are available in the latest ConTeXt distribution (001, 002, 003, 004, 005)

In the past I have been using font feature files to adjust the kerning of fonts on-the-fly. From Hans' example it is not clear to me how to adjust kerning in the new syntax. The below example does not work as intended.

\documentclass{article}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature {
    name = "kern",
    {
        type = "pair",
        data = {
            [0x0041] = { [0x0056] = { false, { -200, 0, 0, 0 } } },
        }
    }
}
}
\setmainfont{Latin Modern Roman}
\begin{document}
AV
\end{document}

Can we have a comprehensive guide on how to adjust font features with LuaTeX with the fonts.handlers technique?


Related questions:

(These involve hooking into the luaotfload.patch_font callback)

Henri Menke
  • 110.9k
  • 18
  • 250
  • 397