[luatex] reverse node lists

Arno Trautmann Arno.Trautmann at gmx.de
Tue Nov 1 18:07:59 CET 2011

Heiko Oberdiek wrote:
> On Tue, Nov 01, 2011 at 12:04:28PM +0100, Patrick Gundlach wrote:
>> Am 01.11.2011 um 10:03 schrieb Arno Trautmann:
>>> p.s.: as I'm already writing about silly manipulations, I have two more ?useless? questions:
>>> ? I want to rotate a page after it has been completed. Could anyone give me a hint where to start for this? (callbacks, how to rotate a box? ?)
>>> ? I'd like to rotate single glyphs by an arbitrary angle. Is this possible with Lua code, after line breaking? Or would I have to create a new font for that?
>> You can insert a whatsit/pdf_literal node before and after the glyph/box
>> you want to rotate. IIRC the "cm" operator (use with q...Q) does exactly
>> what you want.

Where can I look up how to use that operator? By trial and error I was 
able to “transform” a L to an inverse Γ by mirroring in both directions 
and shifting, but the shifts are arbitrary numbers to me. I did:

"q -1 0 0 -1 6 6 cm"

and added this in a pdf_literal before a glyph and a "Q" after the 
glyph. However, the following glyph then overwrote that glyph, i.e. the 
position after the transformation was wrong. I guess that is what Heiko 
suggests by saying:

> I would prefer pdf_save+pdf_setmatrix ... pdf_restore.

As I have no idea what exactly those do (the documentation is not too 
verbose at that point …), I tried to insert them before and after the 
glyph. But as soon as I insert a pdf_setmatrix node, the rest of the 
input is ignored, no matter what .data I define. So: how are they used?

> Using
> pdf_setmatrix gives LuaTeX the chance to calculate correct
> values for destinations and annotations. A rotation using
> \rotatebox{...} with pdftex.def gives an example.

There's no \rotatebox in pdftex.def, neither a \Grot at box@kv or anything. 
But I guess that's not what you meant?

> (In especially
> the rotation is done without moving TeX's position to avoid
> that TeX's position management gets out of sync with the
> PDF position after the rotation.

And that is what happens with Patrick's solution, right?

Thank you all,


More information about the luatex mailing list