[Dev-luatex] The hpack_filter callback

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Tue Apr 29 10:11:35 CEST 2008


in the following PlainTeX example, I try to access all \hboxes
created by TeX by using the hpack_filter callback:


	callback.register('hpack_filter', function(head, group, size,
		print(group, size / 65536, ptype)
		return true

% From Wikipedia:
Beneath a Steel Sky is a British 1994 science fiction point and click
adventure game in the cyberpunk genre. It featured comedy elements and
was developed by Revolution Software and published by Virgin
Interactive Entertainment. It was initially released for DOS and
Amiga. Underworld was its working title.

The game was the second to use Revolution Software's Virtual Theatre
engine, the first being Lure of the Temptress.

The game's backgrounds and introduction sequence were designed by Dave
Gibbons. The introduction sequence was also included as a separate
promotional comic book in some releases of the game.

The game is considered to be among the true classics in the early era
of graphic adventure games for the early 1990s. This, in part, is
related to the mature science fiction theme that was chosen for this
game as compared to other games of the same era where fantasy themes
(a la King's Quest) had been dominant. Some critics have attributed
this difference to the different visions of the adventure game genre
between American and European developers.


This results in:

This is LuaTeX, Version snapshot-0.25.2-2008041019 (Web2C 7.5.6)
adjusted_hbox	469.75498962402	exactly

adjusted_hbox	469.75498962402	exactly
 [1] )
Output written on HPackFilter.dvi (1 page, 2152 bytes).
Transcript written on HPackFilter.log.


Why does the filter not get called more often, namely once for every
line in the output file?

Background: I want to calculate the width of the last line of a
paragraph so I can adjust spacing following this paragraph
accordingly (a bit like display math does it). I tried the
buildpage_filter but did not know how to calculate the width of
the last \hbox in the list without the \parfillskip glue at the

Which leads me to another question: When having a \hbox node list,
how to I determine the horizontal (when typesetting horizontally)
resp. vertical (when typesetting vertically) position of a node
relative to the left/top edge of the \hbox? I would think that
after line breaking, each node should know this position, but
how do I access it?


More information about the dev-luatex mailing list