[Dev-luatex] used_font always return false

Hans Hagen j.hagen at xs4all.nl
Thu Sep 19 20:29:35 CEST 2019


On 9/17/2019 2:56 PM, luigi scarso wrote:
> 
> 
> On Tue, Sep 17, 2019 at 2:52 PM Marcel Fabian Krüger <tex at 2krueger.de 
> <mailto:tex at 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

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list