I want to make use of the pairwise kerning of this answer: https://tex.stackexchange.com/a/370469/75284 using fonts.handlers.otf.addfeature
to adjust the kerning of character pairs with the hyphen -
. With the hyphen entered directly this works fine, but I'd also like to use the babel shorthands "=
and "~
and have them adjust their kerning as well. How could this be done?
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\directlua{fonts.handlers.otf.addfeature
{
name = "ktest",
type = "kern",
data = {["-"] = { ["V"] = -300 }}}
}
\setmainfont[RawFeature=+ktest]{Times New Roman}
\begin{document}\obeylines
Test-Versuch
Test"=Versuch
Test"~Versuch
\end{document}
Any other solution for kerning pairs with lualatex
and the babel shorthands would also be welcome.
"=
will expand to roughly\penalty10000-\hskip0pt
. The\hskip
is an explicit glue and any kerning accross it is discarded. – Henri Menke Apr 19 '18 at 11:49"~
shorthand is approximately\textormath{\leavevmode\hbox{-}}{-}
, i.e.\hbox{-}
in text mode. There is no kerning between boxes and glyphs for the simple reason that TeX cannot look inside boxes (unless you unhbox it but that would negate the effect"~
is trying to achieve). – Henri Menke Apr 19 '18 at 11:52"=
and"~
be possibly redefined to allow kerning? – lblb Apr 19 '18 at 12:19"=
and"~
are trying to achieve. I'll have a look how ConTeXt does it. – Henri Menke Apr 19 '18 at 21:09