[tex-live] update to pdftex.def to tale advantage of the transformation primitives

Vladimir Volovich vvv at vsu.ru
Tue Jan 2 01:38:23 CET 2007


Hi!

since the new pdftex has improvements related to transformations:

  - Transformation matrices can now be manipulated more cleanly:
    Currently matrix changes are done and hidden inside \pdfliteral nodes;
    pdfTeX doesn't parse its contents and does not know the new settings of
    the transform matrix. Thus the new primitives to save pdfTeX from
    parsing \pdfliteral contents and to notify pdfTeX about matrix changes
    to use them in calculating link and anchor positions.
    - \pdfsetmatrix{<a> <b> <c> <d>}
      is the equivalent to \pdfliteral{<a> <b> <c> <d> 0 0 cm}
    - \pdfsave is the equivalent to \pdfliteral{q}
    - \pdfrestore is the equivalent to \pdfliteral{Q}

it would be nice to make pdftex.def aware of these new features.

advantage: the links in rotated text will finally properly work, which
is a long-awaited feature.

here is a proposed patch to pdftex.def (untested):

===============================================
--- /tmp/pdftex.def.orig
+++ /tmp/pdftex.def
@@ -871,23 +871,25 @@
 % slightly hacky, but set width of box 0 to 0pt otherwise
 % the CTM gets restored in the wrong place.
 
+% provide definitions of transformation-related commands for older pdftex versions
+\@ifundefined{pdfsave}{\def\pdfsave{\pdfliteral{ q}}}{}
+\@ifundefined{pdfrestore}{\def\pdfrestore{\pdfliteral{ Q}}}{}
+\@ifundefined{pdfsetmatrix}{\def\pdfsetmatrix#1{\pdfliteral{#1 0 0 cm}}}{}
+
 % Patrick Daly found an error here with doubled minus signs when \Grot at sin is
 % negative. Fixed.
 \def\Grot at start{%
-  \pdfliteral{ q
-     \Grot at cos\space\Grot at sin\space\if-\Grot at sin\else-\Grot at sin\fi\space\Grot at cos\space
-     0 0 cm%
-  }%
+  \pdfsave
+  \pdfsetmatrix{\Grot at cos\space\Grot at sin\space\if-\Grot at sin\else-\Grot at sin\fi\space\Grot at cos}%
   \wd\z@\z@
 }
 
-\def\Grot at end{\pdfliteral{ Q}}
+\def\Grot at end{\pdfrestore}
 
 % Scaling is OK, as graphics package does it right here.
 \def\Gscale at start{%
-  \pdfliteral{ q
-    \Gscale at x\space0 0 \Gscale at y\space 0 0 cm%
-  }%
+  \pdfsave
+  \pdfsetmatrix{\Gscale at x\space0 0 \Gscale at y}%
 }
 
 \let\Gscale at end\Grot at end
===============================================

Best,
v.



More information about the tex-live mailing list