[Dev-luatex] possible bug: tokenlist_to_luastring

Hans Hagen pragma at wxs.nl
Fri Oct 5 09:27:14 CEST 2007


James Quirk wrote:

> \directlua 0 {
>    local t  = node.new('whatsit',15)
>    t.width  = mywidth
>    t.height = myheight   
>    t.depth  = mydepth
>    t.objnum = myobjnum
>    t.data   = mydata
>    tex.setbox(0,t)
> }
> \box0
> 
> Is this an oversight, or have you simply not had the chance to plumb 
> this facility in yet. I recognize that you must be snowed under with work,
> but it occurred to me that the above would be much quicker for
> defining a /Widget annotation than to have to use the token interface.
> As an experiment, I added the necessary read and write code to lnodelib.c 
> and tested how long it would take to create 10,000 annotations.
> The node route was an order of magnitude quicker than the token route.
> It would also be useful to have a routine in the pdf library
> that would be able to reserve a pdfobj so one could write:
> 
> \directlua 0 {
>    local t  = node.new('whatsit',15)
>    t.width  = mywidth
>    t.height = myheight
>    t.depth  = mydepth
>    t.objnum = pdf.reserveobjnum()
>    t.data   = mydata
>    tex.setbox(0,t)
> }
> 
> Anyhow, please don't think that I'm not appreciate of your
> efforts. Because the deeper I delve into LuaTeX, the more
> I'm excited by the possibilites it offers.

So far we've focussed on the input part, fonts, node list building, 
currently hyphenation, soon math ... the backend issues (to which this 
is related) are on the agenda. Eventually the whole pdf machinery will 
be opened up so there may be additional interfaces to the whatsit one

(concerning speed: we do lots of experiments with performance and 
although currently luatex overall is slower than pdftex, one can indeed 
gain some back by using lua code instead of tex code and directly 
accessing the node list; also, the token interface is less efficient 
(more data involved, lots of small tables and therefore garbage 
collection) than manipulating nodes (first versions used tables, now we 
have userdata)

Hans



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


More information about the dev-luatex mailing list