Hi, With luatex-beta-0.11.2 when I run: \directlua 0 { local t = node.new('whatsit',8) t.mode = 1 t.data = "1 0 0 rgb" print (t.data) } \bye I get the output: \BAD.1 0 0 rgb After investigating the matter, it seems that the routine tokenlist_to_luastring is trying to output the reference count set up by the routine tokenlist_from_lua. Hence the appearance of \BAD. Is this a bug? Or am I missing something? If it's the latter then I apologise. Thanks in advance, James
James Quirk wrote:
Hi,
With luatex-beta-0.11.2 when I run:
\directlua 0 { local t = node.new('whatsit',8) t.mode = 1 t.data = "1 0 0 rgb" print (t.data) } \bye
I get the output:
\BAD.1 0 0 rgb
After investigating the matter, it seems that the routine tokenlist_to_luastring is trying to output the reference count set up by the routine tokenlist_from_lua. Hence the appearance of \BAD. Is this a bug? Or am I missing something? If it's the latter then I apologise.
I believe that is a bug. I'll check it out tomorrow. Best wishes, Taco
James Quirk wrote:
Hi,
With luatex-beta-0.11.2 when I run:
\directlua 0 { local t = node.new('whatsit',8) t.mode = 1 t.data = "1 0 0 rgb" print (t.data) } \bye
I get the output:
\BAD.1 0 0 rgb
After investigating the matter, it seems that the routine tokenlist_to_luastring is trying to output the reference count set up by the routine tokenlist_from_lua. Hence the appearance of \BAD. Is this a bug? Or am I missing something? If it's the latter then I apologise.
I believe that is a bug. I'll check it out tomorrow. If it helps you track down the problem, my band-aid to
On Thu, 4 Oct 2007, Taco Hoekwater wrote: the above was to change line 444 of luatoken.c from: s = tokenlist_to_cstring(p,1,&l); to: s = tokenlist_to_cstring(link(p),1,&l); I've checked to see what the knock-on affects are and it seems to be safe, but I'm not really in a position to judge. On a related note, I noticed that is not possible to read or write the data field in a pdf_annot whatsit. For instance, I was trying to define an annotation using: \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. Best Regards, James
Best wishes, Taco
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 -----------------------------------------------------------------
James Quirk wrote:
On a related note, I noticed that is not possible to read or write the data field in a pdf_annot whatsit. For instance, I was trying to define an annotation using:
\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
patch is in trunk
participants (3)
-
Hans Hagen
-
James Quirk
-
Taco Hoekwater