On 17 September 2019 14:56:20 CEST, luigi scarso <luigi.sca...@gmail.com> wrote: >On Tue, Sep 17, 2019 at 2:52 PM Marcel Fabian Krüger <t...@2krueger.de> >wrote: > >> 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 >> >> > >hm, probably a missed else, ie > >} else { > /* todo: other node types */ > lua_pushboolean(L,0); > }
That wouldn't quite work because the uses_font_disc code only returns if the result is true, so pushboolean would also be needed in the disc case. _______________________________________________ dev-luatex mailing list dev-luatex@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-luatex