[Dev-luatex] [***SPAM***] Re: [***SPAM***] Traversing node list structures

Graham Douglas graham.douglas at readytext.co.uk
Sun Nov 28 21:00:33 CET 2010

Hans Hagen wrote:
> On 28-11-2010 7:40, Graham Douglas wrote:
>> Thanks Hans.
>> Sure, I've been doing this to generate the GraphViz
>> diagrams etc plus hooking into various callbacks etc.
>> What I don't yet quite understand is the correct navigation or
>> link path to follow through the node structures and the best way to
>> access or calculate glue (set) values for things like skip between words.
> that is just a multiplication factor; for the precise dealing of it you 
> might want to look into the backend code (take the dvi related code at 
> that is rather simple and discussed in the tex the program book as well; 
> it might look more complex due to hz and protruding)

 > in general you loop recursively, i.e. in a typeset box you need to
 > follow the list in hlist/vlist nodes; in backend related operations 
you also might need to go into the leader part of a rule


Thanks Hans. For sure there is a lot of recursion
here, but I just need to work out the order
of traversal, when you recurse and once you
get back to the top of each recursion
where you go next, to do more recursion etc.

What I was also wondering is whether the final set value of the glue
is directly available, as was determined by LuaTeX. For example, page 89
of the beta 0.65 manual Taco gives an interesting example

node.dimensions(<number> glue_set, <number> glue_sign,
<number> glue_order, <node> n, <node> t, <string> dir)

This calling method takes glue settings into account and is especially 
useful for finding the actual width
of a sublist of nodes that are already boxed

So I was curious to know if it is possible to get access to the
glue set values as you traverse the list. Simplistically, as you
traverse the list:

see glpyhs (width, height, depth)
--> emit PostScript to place glyph
see interword skip (actual amount)
--> emit PostScript to move by skip (or shift or kern)
see glyphs

So, all I want to do is traverse the node list
and emit PostScript code to place glyphs and
do skips/kerns/shifts etc to create a copy
of the typeset text as would be placed in the
final LuaTeX PDF

Really just a toy exercise (no real application)
through which I can gain understanding. For sure the other node types
etc would need handling but I'm just interested
(for now) in emitting PostScript to generate an
exact copy of the typeset \vbox {} etc, as
a way to understand the world of nodes etc.

The final PostScript would just be made into a PDF
for visual comparison.

Many thanks and apologies if my explanations are
unclear or confused (both likely!)

Best wishes


More information about the dev-luatex mailing list