The LuaLaTeX code below uses fonts.handlers.otf.getkern to query kerning between T and e.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyretermes-regular.otf} % OK
% \setmainfont{Alegreya-Regular.otf} % Error
\begin{document}
Test
\directlua{
local fnt = font.current()
local tfmdata = fonts.hashes.identifiers[fnt]
local T = string.byte("T")
local e = string.byte("e")
print('KERN=' .. tostring(fonts.handlers.otf.getkern(tfmdata,T,e,"kern")))
}
\end{document}
It works fine with TeX Gyre Termes and the result KERN=-55705.6 is printed, but switching to Alegreya (OFL, available here) produces the error luaotfload/fontloader-2023-12-28.lua:19928: 'for' limit must be a number.
The same error appears with certain other fonts, e.g. Minion 3 (non-free), so it seems not to be a problem with the Alegraya font specifically.
Ignoring the error, the document compiles and T and e in ‘Test’ are correctly kerned.
getkern calls font.handlers.otf.getgsub. Calling font.handlers.otf.getgsub(tfmdata,T,"kern") directly gives the same error with Alegreya, but trying other lookups (e.g. "c2sc") in place of "kern" shows no error. I think nofsteps is not being set for the kern lookup, but I do not know why or where.
The LuaLaTeX code below uses
fonts.handlers.otf.getkernto query kerning betweenTande.It works fine with TeX Gyre Termes and the result
KERN=-55705.6is printed, but switching to Alegreya (OFL, available here) produces the errorluaotfload/fontloader-2023-12-28.lua:19928: 'for' limit must be a number.The same error appears with certain other fonts, e.g. Minion 3 (non-free), so it seems not to be a problem with the Alegraya font specifically.
Ignoring the error, the document compiles and
Tandein ‘Test’ are correctly kerned.getkerncallsfont.handlers.otf.getgsub. Callingfont.handlers.otf.getgsub(tfmdata,T,"kern")directly gives the same error with Alegreya, but trying other lookups (e.g."c2sc") in place of"kern"shows no error. I thinknofstepsis not being set for thekernlookup, but I do not know why or where.