[luatex] How to access user-defined kerning

Henri Menke henrimenke at gmail.com
Fri Apr 20 05:52:44 CEST 2018

Dear list,

I'm trying to determine the kerning between two letters (here A and V).  For the
sake of this example I'm inserting negative kerning of -400/1000 em.  However,
when I examine the kern in the kerning callback this massive enhancement of the
negative kern doesn't show up but I only see the kerning from the font itself.

How can I access the user-defined kerns?  MWE is below.

Cheers, Henri


\input luaotfload.sty

local function show_kerns(head)
   for item in node.traverse(head) do
      if item.id == node.id("glyph") and item.char == 65 then
         % Get current char and font
         local nut = node.direct.todirect(item)
         local char = node.direct.getchar(nut)
         local font = node.direct.getfont(nut)
         % Get next char and font
         local next = node.next(item)
         local nextnut = node.direct.todirect(next)
         local nextchar = node.direct.getchar(nextnut)
         local nextfont = node.direct.getfont(nextnut)
         % Determine the kern
         local data = fonts.hashes.identifiers[font]
         local kern = fonts.handlers.otf.getkern(data,char,nextchar)

   name = "ktest",
   type = "kern",
   data = { ["A"] = { ["V"] =  -400 } } % make them overlap for the example

\font\test="Latin Modern Roman:+ktest"\test


More information about the luatex mailing list