On Thu, Sep 19, 2019 at 8:29 PM Hans Hagen <j.ha...@xs4all.nl> wrote:

> On 9/17/2019 2:56 PM, luigi scarso wrote:
> >
> >
> > On Tue, Sep 17, 2019 at 2:52 PM Marcel Fabian Krüger <t...@2krueger.de
> > <mailto: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);
> >   }
>         if (type(n) == glyph_node) {
>                lua_pushboolean(L,font(n) == f);
>                return 1;
>
> in the luatex version two times return 1 needs to be added (sorry, it
> went unnoticed because in lm hese returns are there)
>
> Hans
>

Committed revision 7191

-- 
luigi
_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to