Hi,
the node(.direct).uses_font helpers currently always return false for
glyph nodes:
In the implementation
static int lua_nodelib_direct_uses_font(lua_State * L)
{
halfword n = lua_tointeger(L,1);
halfword f = lua_tointeger(L,2);
halfword p;
if (type(n) == glyph_node) {
lua_pushboolean(L,font(n) == f);
} else if (type(n) == disc_node) {
uses_font_disc(pre_break,p,n);
uses_font_disc(post_break,p,n);
uses_font_disc(no_break,p,n);
}
/* todo: other node types */
lua_pushboolean(L,0);
return 1;
}
the actual result is first calculated, but then the last pushboolean
pushes a `false` on top of the stack and return this false.
It could e.g. be fixed by adding a `return 1;` at the end of the first
if block. `disc` nodes are not affected because uses_font_disc is a
macro containing `return`.
A minimal example in plain LuaTeX:
\directlua{
local g = node.new'glyph'
g.font = font.current()
if not node.uses_font(g, font.current()) then
error'This should not happen'
end
node.free(g)
}
\bye
-- Marcel