Microtype – Activating Microtype-Protrusion for Superscript Old Style Numbers with LuaLaTeX

microtypeoldstylenumsprotrusion

I’ve been playing around with microtype’s protusion-capabilities and LuaLaTeX, but faced a problem regarding old-style superscript numbers. The regular numbers protrude. This code

\documentclass{scrbook}

\usepackage{fontspec}
\usepackage[protrusion=true,final]{microtype}
\usepackage{libertinus}
\usepackage{blindtext}


\SetProtrusion{encoding={*}}
    {1={ ,1000},2={ ,1000},3={ ,500},4={ ,500},5={ ,500},
     6={ ,1000},7={ ,1000},8={ ,1000},9={ ,500},0={ ,500}}

\begin{document}
\setcounter{footnote}{100}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdiet mi,
nec ante. Donec, ullamcorper, felis non sodales commodo, lectus velit ultrices
augue, a dignissim nib lectus placerat pede.\footnote{\blindtext} Vivamus nunc nunc, molestie
\end{document}

yields this:

enter image description here

(value 1000 is set for the sake of clarity; it’s a bit too large). However, if I change the option to old-style numbers

\usepackage[osf]{libertinus}

they don’t protrude anymore. (They do with pdfLaTeX, though.)

enter image description here

Is it possible to change that?

Best Answer

microtype in combination with LuaTeX (and XeTeX) is able to reference font-specific glyph-names with the prefix »/«. The case described in the documentation is the ligature »fl« which can be addressed with »/f_l«

In the case of oldstyle-number for »1«, this is done by

\SetProtrusion{encoding={TU},family=LibertinusSerif}{/one.taboldstyle={,1000}}

This yields:

enter image description here

The font-specific glyph-names can be retrieved e.g. by searching the font-file with FontForge:

enter image description here

The solution was provided by Robert in a comment.

Related Question