* luatex examples - Traversing TeX nodes @ 2009-06-01 9:48 Piotr Kopszak 2009-06-01 20:59 ` Hans Hagen 0 siblings, 1 reply; 3+ messages in thread From: Piotr Kopszak @ 2009-06-01 9:48 UTC (permalink / raw) To: mailing list for ConTeXt users Hello, I am trying to compile luatex examples from http://luatex.bluwiki.com . How could I make it work with ConTeXt? The following fails. ----------------------------------------------------------------------------------------------------------------------------------- \directlua0{ local glyph = node.id('glyph') local hlist = node.id('hlist') local vlist = node.id('vlist') function gothru(h,prof) for t in node.traverse(h) do texio.write_nl(string.rep("...",prof) .. 'NODE type=' .. node.type(t.id) .. ' subtype=' .. t.subtype ) if t.id == hlist or t.id == vlist then texio.write(' w=' .. t.width .. ' h=' .. t.height .. ' d=' .. t.depth .. ' s=' .. t.shift ) gothru(t.list,prof+1) end if t.id == glyph then texio.write(' font=' .. t.font .. ' char=' .. t.char .. ' width=' font.fonts[t.font].characters[t.char]['width']) end end end callback.register('pre_linebreak_filter', function(h) gothru(h,0) return true end ) } \starttext bla bla bla bla \stoptext ------------------------------------------------------------------------------------------------------- best Piotr -- http://okle.pl ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: luatex examples - Traversing TeX nodes 2009-06-01 9:48 luatex examples - Traversing TeX nodes Piotr Kopszak @ 2009-06-01 20:59 ` Hans Hagen 2009-06-01 21:52 ` Piotr Kopszak 0 siblings, 1 reply; 3+ messages in thread From: Hans Hagen @ 2009-06-01 20:59 UTC (permalink / raw) To: mailing list for ConTeXt users Piotr Kopszak wrote: > Hello, > > I am trying to compile luatex examples from http://luatex.bluwiki.com i have no time to look into it now but be aware of the fact that if you set a callback like this you're likely to overload one that context itself sets and that can result in problems elsewhere there are user hooks but i need to describe them (as one should be very careful in doing thinsg that interfere) a safe way to play with node is is \setbox0=\vbox{....} and the look at tex.box[0].list ----------------------------------------------------------------- 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 ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: luatex examples - Traversing TeX nodes 2009-06-01 20:59 ` Hans Hagen @ 2009-06-01 21:52 ` Piotr Kopszak 0 siblings, 0 replies; 3+ messages in thread From: Piotr Kopszak @ 2009-06-01 21:52 UTC (permalink / raw) To: mailing list for ConTeXt users Great thanks for your hint. Ever onward! Piotr 2009/6/1 Hans Hagen <pragma@wxs.nl>: > Piotr Kopszak wrote: >> >> Hello, >> >> I am trying to compile luatex examples from http://luatex.bluwiki.com > > i have no time to look into it now but be aware of the fact that if you set > a callback like this you're likely to overload one that context itself sets > and that can result in problems elsewhere > > there are user hooks but i need to describe them (as one should be very > careful in doing thinsg that interfere) > > a safe way to play with node is is > > \setbox0=\vbox{....} > > and the look at tex.box[0].list > > > > > ----------------------------------------------------------------- > 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 > ----------------------------------------------------------------- > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > -- http://okle.pl ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-01 21:52 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-06-01 9:48 luatex examples - Traversing TeX nodes Piotr Kopszak 2009-06-01 20:59 ` Hans Hagen 2009-06-01 21:52 ` Piotr Kopszak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).