GNU Info

Info Node: (groff)Gtroff Internals

(groff)Gtroff Internals


Next: Debugging Prev: Miscellaneous Up: gtroff Reference
Enter node , (file) or (file)node

`gtroff' Internals
==================

   `gtroff' processes input in three steps.  One or more input
characters are converted to an "input token".  Then, one or more input
tokens are converted to an "output node".  Finally, output nodes are
converted to the intermediate output language understood by all output
devices.

   For example, the input string `fi\[:u]' is converted in a character
token `f', a character token `i', and a special token `:u'
(representing u umlaut).  Later on, the character tokens `f' and `i'
are merged to a single output node representing the ligature glyph
`fi'; the same happens with `:u'.  All output glyph nodes are
`processed' which means that they are invariably associated with a
given font, font size, advance width, etc.  During the formatting
process, `gtroff' itself adds various nodes to control the data flow.

   Macros, diversions, and strings collect elements in two chained
lists: a list of input tokens which have been passed unprocessed, and a
list of output nodes.  Consider the following the diversion.


     .di xxx
     a
     \!b
     c
     .br
     .di

It contains these elements.

node list            token list   element number
line start node      --           1
glyph node `a'       --           2
word space node      --           3
--                   `b'          4
--                   `\n'         5
glyph node `c'       --           6
vertical size node   --           7
vertical size node   --           8
--                   `\n'         9

Elements 1, 7, and 8 are inserted by `gtroff'; the latter two (which
are always present) specify the vertical extent of the last line,
possibly modified by `\v'.  The `br' request finishes the current
partial line, inserting a newline input token which is subsequently
converted to a space when the diversion is reread.  Note that the word
space node has a fixed width which isn't stretchable anymore.  To
convert horizontal space nodes back to input tokens, use the `unformat'
request.

   Macros only contain elements in the token list (and the node list is
empty); diversions and strings can contain elements in both lists.


automatically generated by info2www version 1.2.2.9