[luatex] How to insert mathkerns?

Henri Menke henrimenke at gmail.com
Sat Sep 15 07:50:04 CEST 2018


Dear list,

I'm trying to add mathkerns to a font on the fly.  I adapted the code
from ConTeXt in good-mth.lua but nothing happens.  How can I make this
work?  MWE below.
N.B. I'm using 1.09.0 svn6938 with Ulrike's fontloader 2018-09-01

Cheers, Henri

---

\input luaotfload.sty
\directlua{
function kern_right_fence(tfmdata)
    if tfmdata.mathparameters then
        local characters = tfmdata.characters
        if characters[0x1D44E] then % we have at least an italic a
            print("PATCHING FONT " .. tfmdata.psname)
            characters[0x1D453].mathkerns = {
                force = true,
                bottomright = { { kern = 1000 } },
            }
        end
    end
end
%
luatexbase.add_to_callback("luaotfload.patch_font",
                           kern_right_fence,
                           "kern right fence")
}

\font\lmmath="Latin Modern Math:script=math;" at 10pt
\textfont0=\lmmath

\Umathcodenum`e="1D452
\Umathcodenum`f="1D453
\Umathcodenum`g="1D454

$efg$

\bye




More information about the luatex mailing list