ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* 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

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).