Nodes

There are several types of nodes: node.disc, node.glue, node.glyph, node.hlist, node.image, node.kern, node.lang, node.penalty, node.rule, node.startstop and node.vlist.

You can create a new node with node.new(). The expected argument is a string, one of disc, glue, glyph, hlist, image, kern, lang, penalty, rule, startstop or vlist.

Package functions

Name Parameters Description
node.new() string Create (and return ) a new node.
node.insert_after() node (head), node (cur), node (new) Insert the new node after cur in a list starting with head. The head is returned.
node.insert_before() node (head), node (cur), node (new) Insert the new node before cur in a list starting with head. The (perhaps new) head is returned.
node.copy_list() node (head) Create a deep copy of a list starting at head.

Disc node

Field R/W Parameters Description
pre w node The node before the disc
post w node The node after the disc
replace w node The replacement
penalty w int The penalty for breaking at this point

Glue node

Field R/W Parameters Description
subtype w string The subtype of the glue
width w scaled point The natural width of the glue
stretch w scaled point The stretchability of the glue
shrink w scaled point The shrinkability of the glue
stretchorder w int The order of infinity of stretching
shrinkorder w int The order of infinity of shrinking

Glyph node

Field R/W Parameters Description
font w font object The font of the glyph
codepoint w int The codepoint of the glyph
components w string The components of the glyph
width w scaled point The width of the glyph
height w scaled point The height of the glyph
depth w scaled point The depth of the glyph
yoffset w scaled point The vertical offset of the glyph
hyphenate w bool Set the hyphenation flag for the glyph

Hlist node

Field R/W Parameters Description
width w scaled point The width of the hlist
height w scaled point The height of the hlist
depth w scaled point The depth of the hlist
badness w int The badness of the hlist
glueset w float The ratio of the glue. Positive means stretching, negative shrinking.
gluesign w int 0 = normal, 1 = stretching, 2 = shrinking
glueorder w int The level of infinity
shift w scaled point The displacement perpendicular to the progressing direction. Not used.
valign w int The vertical alignment of the hlist
list w node The list itself

Image node

Field R/W Parameters Description
width w scaled point Set the resulting width of the image
height w scaled point Set the resulting height of the image
image w image object The image object
page w int The page number of the image
used w bool Set to true if the image is written to the page

Kern node

Field R/W Parameters Description
kern w scaled point The width of the kern

Lang node

Field R/W Parameters Description
lang w Lang The language of the node

Penalty node

Field R/W Parameters Description
penalty w int Set the penalty when breaking at this point
width w scaled point Set the width of the penalty

Rule node

Field R/W Parameters Description
width w scaled point The width of the rule
height w scaled point The height of the rule
depth w scaled point The depth of the rule
pre w string The pdf instructions before the rule
post w string The pdf instructions after the rule
hide w bool Set to true if the rule is hidden

StartStop node

Field R/W Parameters Description
action w ActionType The action type
startnode w StartStop The start node
position w PDFDataOutput The position of the node
shipout_callback w StartStopFunc The shipout callback
value w any The value of the node

Vlist node

Field R/W Parameters Description
width w scaled point The width of the vlist
height w scaled point The height of the vlist
depth w scaled point The depth of the vlist
glueset w float The ratio of the glue. Positive means stretching, negative shrinking.
gluesign w int 0 = normal, 1 = stretching, 2 = shrinking
shift_x w scaled point The displacement perpendicular to the progressing direction.
list w node The list itself