[XeTeX] Proposed new \special{}s

Jonathan Kew jonathan_kew at sil.org
Tue May 4 20:57:48 CEST 2004


I'm getting close to releasing version 0.6, though it may be a few days 
yet as I'm in a conference much of this week. But before I do, I'd like 
to invite comments on a couple of proposed new \special{} commands for 
xdv2pdf, intended to support things like \rotatebox or \reflectbox 
(which could be implemented at the TeX macro level).

I have in mind--well, in working code, actually--the following:

\special{x:gsave}
\special{x:grestore}

Save and restore the graphics state in the driver (PostScript's gsave 
and grestore, in effect). Can be nested.

\special{x:scale X Y}

Apply a scaling (X and Y are decimals) about the current point.

\special{x:rotate D}

Rotate by D degrees about the current point.

Given these, it is straightforward to define

\def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
   	\special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}

which can be used to write \reflect{backwards}, and

\def\rotate#1#2{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
   \dimen0=\ht0 \advance\dimen0 by -\dp0
   \raise0.5\dimen0\hbox{\special{x:gsave}\special{x:rotate #2}}}%
   \box0 \special{x:grestore}}}

which lets me \rotate{spin a box}{20} about its center.

Ross, or others, would these be sufficient to support some more of the 
LaTeX stuff? Would some other approach be easier to work with?

Jonathan



More information about the XeTeX mailing list