[luatex] How to query fonts.handlers
Henri Menke
henrimenke at gmail.com
Wed Feb 6 01:10:04 CET 2019
I have a working ConTeXt solution now, but I can't get the same thing to
work in plain LuaTeX.
\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(table.keys(tfmdata.shared.rawdata.lookupcache)) do
kern = kern + fonts.handlers.otf.getkern(tfmdata,t,e,kind)
end
context(kern / tfmdata.parameters.factor) % 500
}
\stoptext
On 6/02/19 12:12 PM, Ulrike Fischer wrote:
> Am Wed, 6 Feb 2019 10:41:44 +1300 schrieb Henri Menke:
>
>> Is there a way to query the lookups?
>
> You are the lua guy ;-). But looking in the fontloader, I think the
> generic function to query the lookups is
>
> local function getgsub(tfmdata,k,kind,value)
>
> and this is then used by getkern.
>
> There is also a otf.collectlookups.
>
More information about the luatex
mailing list