# [pdftex] why it is boxtype dependent?

pawcoo jackos1 at poczta.onet.pl
Sat Aug 14 22:35:54 CEST 2004

Hello everybody,

please consider the following code. It is not a real macro, just an
example that shows some pdfTeX feature that I don't understand.

\pdfcompresslevel=0

\setbox0\hbox to1in{Aqq\hfil}
\setbox1\vbox{\copy0}

\def\upsidedown#1{%
\pdfliteral{q 1 0 0 -1 0 0 cm}% vertical flip
\dimen0=\ht#1                 % \ht becomes \dp and vice versa
\ht#1=\dp#1
\dp#1=\dimen0
\box#1
\pdfliteral{Q 1 0 0 1 72 0 cm}% restore current space
}

[\upsidedown0][\upsidedown1]

\end

Does anybody know why the result of the \upsidedown macro depends on the
TYPE OF BOX provided as an argument? It produces different output for
hboxes (register 0) and vboxes (register 1). Of course, the final box is
the same but the transformation caused by cm operator is different. It
happens ONLY if we change natural dimensions of transformed box. It is
NOT a problem to change the macro to make it working fine with both
types, but I just would like to understand why it is so.

Thanks for any hints.

Pawel