[NTG-context] How to query fonts.handlers

Henri Menke henrimenke at gmail.com
Tue Feb 5 21:27:21 CET 2019


Dear list,

I am trying to access extra kerning that I have defined using
fonts.handlers.otf.addfeature.  Even though I query the kerning from
within a paragraph where the kerning is evidently applied I can't seem
to get the value stored earlier, see the comment in the MWE.  What am I
doing wrong?

Cheers, Henri

---

\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 = fonts.handlers.otf.getkern(tfmdata,t,e)
     context(kern) % 0 instead of 500. Why?
}

\stoptext

---

P.S.: I have posted the same question on the LuaTeX list, but with a
different MWE.

-------- Forwarded Message --------
Subject: How to query fonts.handlers
Date: Mon, 4 Feb 2019 15:00:12 +1300
From: Henri Menke <henrimenke at gmail.com>
To: LuaTeX discussion. <luatex at tug.org>

Dear list,

I am trying to access extra kerning that I have defined using
fonts.handlers.otf.addfeature.  Even though I query the kerning from
within a paragraph where the kerning is evidently applied I can't seem
to get the value stored earlier, see the comment in the MWE.  What am I
doing wrong?

Cheers, Henri

---

\input luaotfload.sty

\directlua{
     fonts.handlers.otf.addfeature {
         name = "ktest",
         type = "kern",
         data = {
             ["t"] = { ["e"] = 500 },
         }
     }
}

\font\1="lmroman10-regular.otf:+ktest" at 10pt
\1

test%
\directlua{
     local fnt = font.current()
     local tfmdata = fonts.hashes.identifiers[fnt]
     local t = string.byte("t")
     local e = string.byte("e")
     local kern = fonts.handlers.otf.getkern(tfmdata,t,e)
     tex.sprint(kern) % 0 instead of 500. Why?
}

\bye




More information about the ntg-context mailing list