On 5/26/2020 11:29 AM, Joseph wrote:
Dear list,
With following MWE :
%%%
\startluacode
\stopluacode
\appendtoks\ctxlua{userdata.font_switch(\fontid\font)}\to \everyfontswitch
\setupbodyfont[mainfont, 9pt]
\starttext
Foo.
\stoptext
%%%
I get following error (commenting out the \appendtoks line makes the error to disappear) :
I get nothing because you rmwe is really minimal in the sense that font_switch is not defined. Anyway, what you need to do it this: \number\fontid\font which will work in mkiv and lmtx or \the\fontid\font which also works in lmtx. I changed a couple of these 'internal quantities' to behave like number tokens which has some advantages (for instance, such a token doesn't need to have a space or \relax as sentinel in situations where a lookahead can spoil your game). There is a whole bunch of these quantities and some were numbers and some serialized numbers and i just made that consistent across the repertoire. It's anyway good practice to put something \number in front when you wonder of what you get is a number. Just consider it progress. (there's also \setfontid so maybe you don't need the lua code at all) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------