[luatex] How to query fonts.handlers
Henri Menke
henrimenke at gmail.com
Wed Feb 6 21:12:57 CET 2019
Yes, but the other code also works in ConTeXt. The usage of table.keys
is actually not necessary and just masked the fact that lookupcache in
plain LuaTeX is nil.
\startluacode
fonts.handlers.otf.addfeature {
name = "ktest",
type = "kern",
data = {
["t"] = { ["e"] = 500 },
}
}
\stopluacode
\definefontfeature[ktest][ktest=yes]
\definefont[1][Serif*ktest]
\starttext
\1 test \ctxlua{
local fnt = font.current()
local tfmdata = fonts.hashes.identifiers[fnt]
local t = string.byte("t")
local e = string.byte("e")
local kern = 0
for kind in pairs(tfmdata.shared.rawdata.lookupcache) do
kern = kern + fonts.handlers.otf.getkern(tfmdata,t,e,kind)
end
context(kern / tfmdata.parameters.factor) % 500
}
\stoptext
On 7/02/19 12:03 AM, Ulrike Fischer wrote:
> Am Wed, 6 Feb 2019 22:01:24 +1300 schrieb Henri Menke:
>
>> for kind in pairs(tfmdata.shared.rawdata.lookupcache) do
>
> Your context code used
>
> for _,kind in pairs(table.keys(tfmdata.shared.rawdata.lookupcache))
> do
>
More information about the luatex
mailing list