[latex3-commits] [l3svn] branch master updated: Revise driver code

noreply at latex-project.org noreply at latex-project.org
Fri May 13 21:08:43 CEST 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  53ad7aa   Revise driver code
53ad7aa is described below

commit 53ad7aa08d3f4e943631603bddf94e349a785fe8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri May 13 20:08:30 2016 +0100

    Revise driver code
    
    The structure here is new: essentially split into separate parts rather
    than trying to DocStrip everything in one go. This makes the logic
    for each driver easier to follow, and reflects experience with LaTeX2e.
    
    The dvisvgm driver is now fully-functional and can do clipping.
    
    Some revisions are included to the other drivers, notably a better
    approach to colour for (x)dvipdfmx and avoidance of one definition
    in dips.
---
 l3kernel/l3candidates.dtx                          |   43 +-
 l3kernel/l3drivers.dtx                             |  950 +++++++++++++-------
 l3kernel/testfiles/d3dvipdfmx.tlg                  |    4 +-
 l3kernel/testfiles/d3dvips.luatex.tlg              |    8 +-
 l3kernel/testfiles/d3dvips.tlg                     |    8 +-
 l3kernel/testfiles/d3dvips.xetex.tlg               |    4 +-
 .../{d3dvips.luatex.tlg => d3dvisvgm.luatex.tlg}   |  324 ++++---
 l3kernel/testfiles/d3dvisvgm.tlg                   |  260 +++---
 l3kernel/testfiles/d3dvisvgm.xetex.tlg             |    4 +-
 l3kernel/testfiles/d3pdfmode.ptex.tlg              |    8 +-
 l3kernel/testfiles/d3pdfmode.uptex.tlg             |    8 +-
 l3kernel/testfiles/d3pdfmode.xetex.tlg             |    4 +-
 l3kernel/testfiles/d3xdvipdfmx.ptex.tlg            |    8 +-
 l3kernel/testfiles/d3xdvipdfmx.uptex.tlg           |    8 +-
 l3kernel/testfiles/d3xdvipdfmx.xetex.tlg           |    4 +-
 l3kernel/testfiles/driver.tex                      |    3 -
 l3kernel/testfiles/m3coffins001.ptex.tlg           |   96 +-
 l3kernel/testfiles/m3coffins001.uptex.tlg          |   96 +-
 l3kernel/testfiles/m3coffins001.xetex.tlg          |   96 +-
 l3kernel/testfiles/m3expl001.luatex.tlg            |   14 +-
 l3kernel/testfiles/m3expl001.ptex.tlg              |   14 +-
 l3kernel/testfiles/m3expl001.tlg                   |   14 +-
 l3kernel/testfiles/m3expl001.uptex.tlg             |   14 +-
 l3kernel/testfiles/m3expl001.xetex.tlg             |   14 +-
 24 files changed, 1126 insertions(+), 880 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
old mode 100644
new mode 100755
index 065a252..2306fd9
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -299,36 +299,6 @@
 %   group level.
 % \end{function}
 %
-% \subsection{Internal variables}
-%
-% \begin{variable}{\l__box_angle_fp}
-%   The angle through which a box is rotated by \cs{box_rotate:Nn}, given in
-%   degrees counter-clockwise. This value is required by the underlying
-%   driver code in \pkg{l3driver} to carry out the driver-dependent part
-%   of box rotation.
-% \end{variable}
-%
-% \begin{variable}{\l__box_cos_fp, \l__box_sin_fp}
-%   The sine and cosine of the angle through which a box is rotated by
-%   \cs{box_rotate:Nn}: the values refer to the angle counter-clockwise. These
-%   values are required by the underlying driver code in \pkg{l3driver} to
-%   carry out the driver-dependent part of box rotation.
-% \end{variable}
-%
-% \begin{variable}{\l__box_scale_x_fp, \l__box_scale_y_fp}
-%   The scaling factors by which a box is scaled by \cs{box_scale:Nnn}
-%   or \cs{box_resize:Nnn}. These values are required by the underlying
-%   driver code in \pkg{l3driver} to carry out the driver-dependent part
-%   of box rotation.
-% \end{variable}
-%
-% \begin{variable}{\l__box_internal_box}
-%   Box used for affine transformations, which is used to contain rotated
-%   material when applying \cs{box_rotate:Nn}. This box must be correctly
-%   constructed for the driver-dependent code in \pkg{l3driver} to function
-%   correctly.
-% \end{variable}
-%
 % \section{Additions to \pkg{l3clist}}
 %
 % \begin{function}[added = 2014-08-22]{\clist_log:N, \clist_log:c}
@@ -1316,9 +1286,9 @@
         \tex_kern:D -\l_@@_left_new_dim
         \hbox:n
           {
-            \__driver_box_rotate_begin:
-            \box_use:N \l_@@_internal_box
-            \__driver_box_rotate_end:
+            \__driver_box_use_rotate:Nn
+              \l_@@_internal_box
+              \l_@@_angle_fp
           }
       }
 %    \end{macrocode}
@@ -1626,9 +1596,10 @@
   {
     \hbox_set:Nn \l_@@_internal_box
       {
-        \__driver_box_scale_begin:
-        \hbox_overlap_right:n { \box_use:N #1 }
-        \__driver_box_scale_end:
+        \__driver_box_use_scale:Nnn
+          #1
+          \l_@@_scale_x_fp
+          \l_@@_scale_y_fp
       }
 %    \end{macrocode}
 %   The new height and depth can be applied directly.
diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
old mode 100644
new mode 100755
index 1516bde..dd08dd7
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -81,14 +81,16 @@
 %     conjugation with \pdfTeX{} or \LuaTeX{} in DVI mode.
 %   \item \texttt{dvipdfmx}: The \texttt{dvipdfmx} program, which works in
 %     conjugation with \pdfTeX{} or \LuaTeX{} in DVI mode.
+%   \item \texttt{dvisvgm}:  The \texttt{dvisvgm} program, which works in
+%     conjugation with \pdfTeX{} or \LuaTeX{} in DVI mode to create SVG
+%     output.
 %   \item \texttt{xdvipdfmx}: The driver used by \XeTeX{}.
 % \end{itemize}
 %
 % The code here is all very low-level, and should not in general be used
 % outside of the kernel. It is also important to note that many of the
-% functions here are closely tied to the immediate level \enquote{up}:
-% several variable values must be in the correct locations for the driver
-% code to function.
+% functions here are closely tied to the immediate level \enquote{up},
+% and they must be used in the correct contexts.d
 %
 % \section{Box clipping}
 %
@@ -107,36 +109,34 @@
 %
 % \section{Box rotation and scaling}
 %
-% \begin{function}[added = 2011-09-01, updated = 2013-12-27]
-%  {\__driver_box_rotate_begin:, \__driver_box_rotate_end:}
+% \begin{function}[added = 2016-05-12]{\__driver_box_use_rotate:Nn}
 %   \begin{syntax}
-%     \cs{__driver_box_rotate_begin:}
-%     \cs{box_use:N} \cs{l__box_internal_box}
-%     \cs{__driver_box_rotate_end:}
+%     \cs{__driver_box_use_rotate:Nn} \meta{box} \Arg{angle}
 %   \end{syntax}
-%   Rotates the \meta{box material} anti-clockwise around the current
-%   insertion point. The angle of rotation (in degrees counter-clockwise)
-%   and the sine and cosine of this angle should be stored in
-%   \cs{l__box_angle_fp}, \cs{l__box_sin_fp} and \cs{l__box_cos_fp},
-%   respectively. Typically, the box material inserted between the beginning
-%   and end markers will be stored in \cs{l__box_internal_box}: this fact is
-%   required by some drivers to obtain the correct output.
+%   Inserts the content of the \meta{box} at the current insertion point
+%   rotated by the \meta{angle} (expressed in degrees). The material is
+%   inserted with no apparent height or width, and is rotated such the
+%   the \TeX{} reference point of the box is the center of rotation and
+%   remains the reference point after rotation. It is the responsibly of
+%   the code using this function to adjust the apparent size of the box to
+%   be correct at the \TeX{} side.
+%
+%   This function should only be used within a surrounding horizontal
+%   box construct.
 % \end{function}
 %
-% \begin{function}[added = 2011-09-02, updated = 2013-12-27]
-%   {\__driver_box_scale_begin:, \__driver_box_scale_end:}
+% \begin{function}[added = 2016-05-12]{\__driver_box_use_scale:Nnn}
 %   \begin{syntax}
-%     \cs{__driver_box_scale_begin:}
-%     \meta{box material}
-%     \cs{__driver_box_scale_end:}
+%     \cs{__driver_box_use_scale:Nnn} \meta{box} \Arg{x-scale} \Arg{y-scale}
 %   \end{syntax}
-%   Scales the \meta{box material} (which should be either a \cs{box_use:N}
-%   or \cs{hbox:n} construct). The \meta{box material} is scaled by the values
-%   stored in \cs{l__box_scale_x_fp} and \cs{l__box_scale_y_fp} in the
-%   horizontal and vertical directions, respectively. This function is
-%   also reused when resizing boxes: at a driver level, only scalings are
-%   supported and so the higher-level code must convert the absolute sizes
-%   to scale factors.
+%   Inserts the content of the \meta{box} at the current insertion point
+%   scale by the \meta{x-scale} and \meta{y-scale}. The material is
+%   inserted with no apparent height or width. It is the responsibly of
+%   the code using this function to adjust the apparent size of the box to
+%   be correct at the \TeX{} side.
+%
+%   This function should only be used within a surrounding horizontal
+%   box construct.
 % \end{function}
 %
 % \section{Color support}
@@ -164,6 +164,14 @@
 %<@@=driver>
 %    \end{macrocode}
 %
+% Whilst there is a reasonable amount of code overlap between drivers,
+% it is much clearer to have the blocks more-or-less separated than run
+% in together and DocStripped out in parts. As such, most of the following
+% is set up on a per-driver basis, though there is some common code (again
+% given in blocks not interspersed with other material).
+%
+% All the file identifiers are up-front so that they come out in the right
+% place in the files.
 %    \begin{macrocode}
 %<*package>
 \ProvidesExplFile
@@ -190,116 +198,360 @@
 %</package>
 %    \end{macrocode}
 %
-% \subsection{Settings for direct PDF output}
+% \subsection{\texttt{pdfmode} driver}
 %
-% If the driver loaded is \texttt{pdfmode} then direct PDF output is required.
-% (This may of course alter: it might be that the driver is picked based on the
-% value of \cs{pdftex_pdfoutput:D}.)
 %    \begin{macrocode}
-%<*initex>
 %<*pdfmode>
-\pdftex_pdfoutput:D = 1 \scan_stop:
-%</pdfmode>
-%</initex>
 %    \end{macrocode}
 %
-% Set up the driver for direct PDF output to set the PDF origin equal to
-% \TeX{}'s standard origin. The other settings make use of PDF~$1.5$, which
-% is standard in \TeX{} Live 2011 and should be a reasonable baseline for
-% the future.
+% The direct PDF driver covers both \pdfTeX{} and \LuaTeX{}. The latter
+% renames/restructures the driver primitives but this can be handled
+% at one level of abstraction. As such, we avoid using two separate drivers
+% for this material at the cost of some \texttt{x}-type definitions to get
+% everything expanded up-front.
+%
+% \subsubsection{Basics}
+%
+% \begin{macro}[int]{\@@_literal:n}
+%   This is equivalent to \verb|\special{pdf:}| but the engine can
+%   track it. Without the \texttt{direct} keyword everything is kept in
+%   sync: the transformation matrix is set to the current point automatically.
+%   Note that this is still inside the text (\texttt{BT} \dots \texttt{ET}
+%   block).
 %    \begin{macrocode}
-%<*initex>
-%<*pdfmode>
-\group_begin:
-  \cs_set_proteced:Npx \@@_tmp:w #1 =
-    {
-      \tex_global:D
-      \cs_if_exist:NTF \luatex_pdfvariable:D
-        { \exp_not:N \luatex_pdfvariable:D #1 }
-        { \exp_not:c { pdftex_pdf #1 :D } }
-          =
-    }
-  \@@_tmp:w horigin          = 1 true in \scan_stop:
-  \@@_tmp:w vorigin          = 1 true in \scan_stop:
-  \@@_tmp:w decimaldigits    = 3         \scan_stop:
-  \@@_tmp:w pkresolution     = 600       \scan_stop:
-  \@@_tmp:w minorversion     = 5         \scan_stop:
-  \@@_tmp:w compresslevel    = 9         \scan_stop:
-  \@@_tmp:w objcompresslevel = 2         \scan_stop:
-\group_end:
-%</pdfmode>
-%</initex>
+\cs_new_protected:Npx \@@_literal:n #1
+  {
+    \cs_if_exist:NTF \luatex_pdfextension:D
+      { \luatex_pdfextension:D literal }
+      { \pdftex_pdfliteral:D }
+        {#1}
+  }
 %    \end{macrocode}
+% \end{macro}
 %
-% \subsection{Driver utility functions}
-%
-% \begin{macro}{\@@_state_save:, \@@_state_restore:}
-%   Almost all of the drivers have a stack for saving the graphic state. These
-%   have slightly different interfaces. For both \texttt{dvips} and
-%   \texttt{(x)dvipdfmx} this is done using an appropriate special. Note
-%   that here and later, the \texttt{dvipdfmx} documentation does not cover
-%   the |literal| key word but that this appears to behave in the same way as
-%   \pdfTeX{}'s \tn{pdfliteral} (making life easier all-round). For \pdfTeX{}
-%   in  direct PDF output mode there is a dedicated primitive. \LuaTeX{} is
-%   almost the same but with newer versions there is a compatibly step
+% \begin{macro}[int]{\@@_scope_begin:, \@@_scope_end:}
+%  Higher-level interfaces for saving and restoring the graphic state.
 %    \begin{macrocode}
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_protected_nopar:Npx \@@_state_save:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvips>
-  { \tex_special:D { ps:gsave } }
-%</dvips>
-%<*dvipdfmx|xdvipdfmx>
-  { \tex_special:D { pdf:literal~q } }
-%</dvipdfmx|xdvipdfmx>
-%<*pdfmode>
+\cs_new_protected_nopar:Npx \@@_scope_begin:
   {
     \cs_if_exist:NTF \luatex_pdfextension:D
       { \luatex_pdfextension:D save \scan_stop: }
       { \pdftex_pdfsave:D }
   }
-%</pdfmode>
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_protected_nopar:Npx \@@_state_restore:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvips>
-  { \tex_special:D { ps:grestore } }
-%</dvips>
-%<*dvipdfmx|xdvipdfmx>
-  { \tex_special:D { pdf:literal~Q } }
-%</dvipdfmx|xdvipdfmx>
-%<*pdfmode>
+\cs_new_protected_nopar:Npx \@@_scope_end:
   {
     \cs_if_exist:NTF \luatex_pdfextension:D
       { \luatex_pdfextension:D restore \scan_stop: }
       { \pdftex_pdfrestore:D }
   }
-%</pdfmode>
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[int]{\@@_literal:n}
-%   The driver code needs to pass on a lot of \enquote{raw} information to
-%   the underlying binary. The exact command is driver-dependent but the
-%   concept is general enough to use a single function. However, it is
-%   important to remember this is a convenient shortcut: the arguments will
-%   be driver-specific. Note that these functions set the transformation matrix
-%   to the current position.
-%    \begin{macrocode}
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_protected:Npx \@@_literal:n #1
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
+% \begin{macro}[int]{\@@_matrix:n}
+%   Here the appropriate function is set up to insert an affine matrix
+%   into the PDF. With \pdfTeX{} and \LuaTeX{} in direct PDF output mode there
+%   is a primitive for this, which only needs the rotation/scaling/skew part.
+%    \begin{macrocode}
+\cs_new_protected:Npx \@@_matrix:n #1
+  {
+    \cs_if_exist:NTF \luatex_pdfextension:D
+      { \luatex_pdfextension:D setmatrix }
+      { \pdftex_pdfsetmatrix:D }
+        {#1}
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Color}
+%
+% \begin{variable}{\l_@@_current_color_tl}
+%   The current color in driver-dependent format: pick up the package-mode
+%   data if available.
+%    \begin{macrocode}
+\tl_new:N \l_@@_current_color_tl
+\tl_set:Nn \l_@@_current_color_tl { 0~g~0~G }
+%<*package>
+\AtBeginDocument
+  {
+    \@ifpackageloaded { color }
+      { \tl_set:Nn \l_@@_current_color_tl { \current at color } }
+      { }
+  }
+%</package>
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_color_stack_int}
+%   \pdfTeX{} and \LuaTeX{} have multiple stacks available, and to track
+%   which one is in use a variable is required.
+%    \begin{macrocode}
+\int_new:N \l_@@_color_stack_int
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[int]{\@@_color_ensure_current:}
+% \begin{macro}[aux]{\@@_color_reset:}
+%   There is a dedicated primitive/primitive interface for setting colors.
+%   As with scoping, this approach is not suitable for cached operations.
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npx \@@_color_ensure_current:
+  {
+    \cs_if_exist:NTF \luatex_pdfextension:D
+      { \luatex_pdfextension:D colorstack }
+      { \pdftex_pdfcolorstack:D }
+        \exp_not:N \l_@@_color_stack_int push
+          { \exp_not:N \l_@@_current_color_tl }
+    \group_insert_after:N \exp_not:N \@@_color_reset:
+  }
+\cs_new_protected_nopar:Npx \@@_color_reset:
+  {
+    \cs_if_exist:NTF \luatex_pdfextension:D
+      { \luatex_pdfextension:D colorstack }
+      { \pdftex_pdfcolorstack:D }
+        \exp_not:N \l_@@_color_stack_int pop \scan_stop:
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</pdfmode>
+%    \end{macrocode}
+%
+% \subsection{\texttt{dvipdfmx} driver}
+%
+%    \begin{macrocode}
 %<*dvipdfmx|xdvipdfmx>
+%    \end{macrocode}
+%
+% The \texttt{dvipdfmx} shares code with the PDF mode one (using the common
+% section to this file) but also with \texttt{xdvipdfmx}. The latter is close
+% to identical to \texttt{dvipdfmx} and so all of the code here is extracted
+% for both drivers, with some \texttt{clean up} for \texttt{xdvipdfmx} as
+% required.
+%
+% \subsubsection{Basics}
+%
+% \begin{macro}[int]{\@@_literal:n}
+%   Equivalent to \texttt{pdf:content} but favoured as the link to
+%   the \pdfTeX{} primitive approach is clearer.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_literal:n #1
   { \tex_special:D { pdf:literal~ #1 } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@@_scope_begin:, \@@_scope_end:}
+%   Scoping is done using direct PDF operations here.
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_scope_begin:
+  { \@@_literal:n { q } }
+\cs_new_protected_nopar:Npn \@@_scope_end:
+  { \@@_literal:n { Q } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@@_matrix:n}
+%   With \texttt{(x)dvipdfmx} the matrix has to include a translation
+%   part: that is always zero and so is built in here so that the same
+%   internal interface works for all PDF-related drivers.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_matrix:n #1
+  { \@@_literal:n { #1 \c_space_tl 0~0~cm } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Color}
+%
+% \begin{variable}{\l_@@_current_color_tl}
+%   The current color in driver-dependent format.
+%    \begin{macrocode}
+\tl_new:N \l_@@_current_color_tl
+\tl_set:Nn \l_@@_current_color_tl { [ 0 ] }
+%<*package>
+\AtBeginDocument
+  {
+    \@ifpackageloaded { color }
+      { \tl_set:Nn \l_@@_current_color_tl { \current at color } }
+      { }
+  }
+%</package>
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[int]{\@@_color_ensure_current:}
+% \begin{macro}[aux]{\@@_color_reset:}
+%   Directly set the color using the specials with optimisation support.
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npx \@@_color_ensure_current:
+  {
+    \tex_special:D { pdf:bcolor~\l_@@_current_color_tl }
+    \group_insert_after:N \exp_not:N \@@_color_reset:
+  }
+\cs_new_protected_nopar:Npx \@@_color_reset:
+  { \tex_special:D { pdf:ecolor } }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%    \begin{macrocode}
 %</dvipdfmx|xdvipdfmx>
 %    \end{macrocode}
+%
+% \subsection{\texttt{xdvipdfmx} driver}
+%
+%    \begin{macrocode}
+%<*xdvipdfmx>
+%    \end{macrocode}
+%
+% \subsubsection{Color}
+%
+% \begin{macro}[int]{\@@_color_ensure_current:}
+% \begin{macro}[aux]{\@@_color_reset:}
+%   The \LaTeXe{} driver uses \texttt{dvips}-like specials so there has to
+%   be a change of set up if \pkg{color} is loaded.
+%    \begin{macrocode}
+%<*package>
+\AtBeginDocument
+  {
+    \@ifpackageloaded { color }
+      {
+        \cs_set_protected_nopar:Npn \@@_color_ensure_current:
+          {
+            \tex_special:D { color~push~\l_@@_current_color_tl }
+            \group_insert_after:N \exp_not:N \@@_color_reset:
+          }
+
+        \cs_set_protected_nopar:Npn \@@_color_reset:
+          { \tex_special:D { color~pop } }
+      }
+      { }
+  }
+%</package>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</xdvipdfmx>
+%    \end{macrocode}
+%
+% \subsection{Common code for PDF production}
+%
+% As all of the drivers which understand PDF-targeted specials act in much
+% the same way there is a lot of shared code. Rather than try to DocStrip it
+% interspersed with the above, we collect all of it here.
+%
+%    \begin{macrocode}
+%<*dvipdfmx|pdfmode|xdvipdfmx>
+%    \end{macrocode}
+%
+% \subsubsection{Box operations}
+%
+% \begin{macro}{\@@_box_use_clip:N}
+%   The general method is to save the current location, define a clipping path
+%   equivalent to the bounding box, then insert the content at the current
+%   position and in a zero width box. The \enquote{real} width is then made up
+%   using a horizontal skip before tidying up. There are other approaches that
+%   can be taken (for example using XForm objects), but the logic here shares
+%   as much code as possible and uses the same conversions (and so same
+%   rounding errors) in all cases.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_box_use_clip:N #1
+  {
+    \@@_scope_begin:
+    \@@_literal:n
+      {
+        0~
+        \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~
+        \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~
+        \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~
+        re~W~n
+      }
+    \hbox_overlap_right:n { \box_use:N #1 }
+    \@@_scope_end:
+    \skip_horizontal:n { \box_wd:N #1 }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_box_use_rotate:Nn}
+% \begin{variable}{\l_@@_cos_fp, \l_@@_sin_fp}
+%   Rotations are set using an affine transformation matrix which therefore
+%   requires sine/cosine values not the angle itself. We store the rounded
+%   values to avoid rounding twice. There are also a couple of comparisons to
+%   ensure that |-0| is not written to the output, as this avoids any issues
+%   with problematic display programs.  Note that numbers are compared to~$0$
+%   after rounding.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2
+  {
+    \@@_scope_begin:
+    \box_set_wd:Nn #1 \c_zero_dim
+    \fp_set:Nn \l_@@_cos_fp { round ( cosd ( #2 ) , 5 ) }
+    \fp_compare:nNnT \l_@@_cos_fp = \c_zero_fp
+      { \fp_zero:N \l_@@_cos_fp }
+    \fp_set:Nn \l_@@_sin_fp { round ( sind ( #2 ) , 5 ) }
+    \@@_matrix:n
+      {
+        \fp_use:N \l_@@_cos_fp \c_space_tl
+        \fp_compare:nNnTF \l_@@_sin_fp = \c_zero_fp
+          { 0~0 }
+          {
+            \fp_use:N \l_@@_sin_fp
+            \c_space_tl
+            \fp_eval:n { -\l_@@_sin_fp }
+          }
+        \c_space_tl
+        \fp_use:N \l_@@_cos_fp
+      }
+   \box_use:N #1
+   \@@_scope_end:
+  }
+\fp_new:N \l_@@_cos_fp
+\fp_new:N \l_@@_sin_fp
+% \end{variable}
+% \end{macro}
+%
+% \begin{macro}{\@@_box_use_scale:Nnn}
+%   The same idea as for rotation but without the complexity of signs and
+%   cosines.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3
+  {
+    \@@_scope_begin:
+    \@@_matrix:n
+      {
+        \fp_eval:n { round ( #2 , 5 ) } ~
+        0~0~
+        \fp_eval:n { round ( #3 , 5 ) }
+      }
+    \hbox_overlap_right:n { \box_use:N #1 }
+    \@@_scope_end:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</dvipdfmx|pdfmode|xdvipdfmx>
+%    \end{macrocode}
+%
+% \subsection{\texttt{dvips} driver}
+%
+%    \begin{macrocode}
+%<*dvips>
+%    \end{macrocode}
+%
+% \subsubsection{Basics}
+%
+% \begin{macro}[int]{\@@_literal:n}
 %   In the case of \texttt{dvips} there is no build-in saving of the current
 %   position, and so some additional PostScript is required to set up the
 %   transformation matrix and also to restore it afterwards. Notice the use
 %   of the stack to save the current position \enquote{up front} and to
 %   move back to it at the end of the process.
 %    \begin{macrocode}
-%<*dvips>
+\cs_new_protected:Npx \@@_literal:n #1
   {
     \tex_special:D
       {
@@ -310,285 +562,322 @@
           neg~exch~neg~exch~translate
       }
   }
-%</dvips>
-%<*pdfmode>
-  {
-    \cs_if_exist:NTF \luatex_pdfextension:D
-      { \luatex_pdfextension:D literal }
-      { \pdftex_pdfliteral:D }
-        {#1}
-  }
-%</pdfmode>
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[int]{\@@_transform:n}
-% \begin{macro}[int]{\@@_transform_end:}
-%   The \texttt{dvisvgm} driver needs to generate \textsc{svg} code, which
-%   works somewhat differently from the \textsc{EPS} heritage visible in all
-%   of the other drivers. In particular, it doesn't use a save/restore stack
-%   for the graphics state so instead needs functions to start/end a
-%   transformation. (At some future stage this might be generalised using a
-%   \cs{@@_literal_direct:n} or similar function as the approach here also does
-%   not expect the graphic state to be aligned \enquote{here}.)
+% \begin{macro}{\@@_scope_begin:, \@@_scope_end:}
+%   Scope saving/restoring is done directly with no need to worry about the
+%   transformation matrix.
 %    \begin{macrocode}
-%<*dvisvgm>
-\cs_new_protected:Npn \@@_transform:n #1
-  { \tex_special:D { dvisvgm:raw~<g~transform=" #1 "> } }
-\cs_new_protected_nopar:Npn \@@_transform_end:
-  { \tex_special:D { dvisvgm:raw~</g> } }
-%</dvisvgm>
+\cs_new_protected_nopar:Npn \@@_scope_begin:
+  { \tex_special:D { ps:gsave } }
+\cs_new_protected_nopar:Npn \@@_scope_end:
+  { \tex_special:D { ps:grestore } }
 %    \end{macrocode}
 % \end{macro}
-% \end{macro}
-
+%
+% \subsection{Driver-specific auxiliaries}
 %
 % \begin{macro}[int, EXP]{\@@_absolute_lengths:n}
 %   The \texttt{dvips} driver scales all absolute dimensions based
 %   on the output resolution selected and any \TeX{} magnification. Thus
 %   for any operation involving absolute lengths there is a correction to
-%   make. This is based on |normalscale| from \texttt{special.pro}.
+%   make. This is based on \texttt{normalscale} from \texttt{special.pro}
+%   but using the stack rather than a definition to save the current matrix.
 %    \begin{macrocode}
-%<*dvips>
 \cs_new:Npn \@@_absolute_lengths:n #1
   {
-     /savedmatrix~matrix~currentmatrix~def~
+     matrix~currentmatrix~
      Resolution~72~div~VResolution~72~div~scale~
      DVImag~dup~scale~
      #1 ~
-     savedmatrix~setmatrix
-  }
-%</dvips>
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[int]{\@@_matrix:n}
-%   Here the appropriate function is set up to insert an affine matrix
-%   into the PDF. With \pdfTeX{} and \LuaTeX{} in direct PDF output mode there
-%   is a primitive for this, which only needs the rotation/scaling/skew part.
-%   With \texttt{(x)dvipdfmx} the matrix also has to include a translation
-%   part: that is always zero and so is built in here.
-%    \begin{macrocode}
-%<*dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_protected:Npx \@@_matrix:n #1
-%</dvipdfmx|pdfmode|xdvipdfmx>
-%<*pdfmode>
-  {
-    \cs_if_exist:NTF \luatex_pdfextension:D
-      { \luatex_pdfextension:D setmatrix }
-      { \pdftex_pdfsetmatrix:D }
-        {#1}
+     setmatrix
   }
-%</pdfmode>
-%<*dvipdfmx|xdvipdfmx>
-  { \@@_literal:n { #1 \c_space_tl 0~0~cm } }
-%</dvipdfmx|xdvipdfmx>
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsection{Box clipping}
+% \subsubsection{Box operations}
 %
 % \begin{macro}{\@@_box_use_clip:N}
-%   The overall logic to clipping a box is the same in all cases. The general
-%   method is to save the current location, define a clipping path equivalent
-%   to the bounding box, then insert the content at the current position
-%   and in a zero width box. The \enquote{real} width is then made up using
-%   a horizontal skip before tidying up. There are other approaches that
-%   can be taken (for example using XForm objects), but the logic here shares
-%   as much code as possible and uses the same conversions (and so same
-%   rounding errors) in all three cases.
+%   Much the same idea as for the PDF mode version but with a slightly
+%   different syntax for creating the clip path. To avoid any scaling
+%   issues we need the absolute length auxiliary here.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_box_use_clip:N #1
   {
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_state_save:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvips>
+    \@@_scope_begin:
     \@@_literal:n
       {
         \@@_absolute_lengths:n
           {
-            0~
+            0 ~
             \dim_to_decimal_in_bp:n { \box_dp:N #1 } ~
             \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~
             \dim_to_decimal_in_bp:n { -\box_ht:N #1 - \box_dp:N #1 } ~
             rectclip
           }
       }
-%</dvips>
-%<*dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_literal:n
-      {
-        0~
-        \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~
-        \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~
-        \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~
-        re~W~n
-      }
-%</dvipdfmx|pdfmode|xdvipdfmx>
-%    \end{macrocode}
-%   Insert the material in a box of no width, restore the graphic state
-%   and then insert the necessary width.
-%    \begin{macrocode}
     \hbox_overlap_right:n { \box_use:N #1 }
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_state_restore:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
+    \@@_scope_end:
     \skip_horizontal:n { \box_wd:N #1 }
   }
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsection{Box rotation and scaling}
-%
-% \begin{macro}{\@@_box_rotate_begin:, \@@_box_rotate_end:}
-%   The driver for \texttt{dvips} works with a simple rotation angle.
-%   In PDF mode, an affine matrix is used instead. The transformation for
-%   \texttt{(x)dvipdfmx} can be done either way: the affine approach is
-%   chosen here as where possible we pick the PDF-style route.
-%
-%   In both cases, some rounding code is included to limit the floating
-%   point values to five decimal places. There is no point using any more
-%   as \TeX{}'s dimensions are of that precision, and the extra figures
-%   will simply bloat the PDF and make values harder to trace. In the
-%   case where the sine and cosine are used, we store the rounded values to
-%   avoid rounding twice. There are also a couple of comparisons to ensure
-%   that |-0| is not written to the output, as this avoids any issues with
-%   problematic display programs.  Note that numbers are compared to~$0$
-%   after rounding.
+% \begin{macro}{\@@_box_use_rotate:Nn}
+%   Rotating using \texttt{dvips} does not require that the box dimensions
+%   are altered and has a very convenient built-in operation. Zero rotation
+%   must be written as |0| not |-0| so there is a quick test.
 %    \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_box_rotate_begin:
+\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2
   {
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_state_save:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvipdfmx|pdfmode|xdvipdfmx>
-    \box_set_wd:Nn \l__box_internal_box \c_zero_dim
-    \fp_set:Nn \l__box_cos_fp { round ( \l__box_cos_fp , 5 ) }
-    \fp_compare:nNnT \l__box_cos_fp = \c_zero_fp
-      { \fp_zero:N \l__box_cos_fp }
-    \fp_set:Nn \l__box_sin_fp { round ( \l__box_sin_fp , 5 ) }
-    \@@_matrix:n
-      {
-        \fp_use:N \l__box_cos_fp \c_space_tl
-        \fp_compare:nNnTF \l__box_sin_fp = \c_zero_fp
-          { 0~0 }
-          {
-            \fp_use:N \l__box_sin_fp
-            \c_space_tl
-            \fp_eval:n { -\l__box_sin_fp }
-          }
-        \c_space_tl
-        \fp_use:N \l__box_cos_fp
-      }
-%</dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvips|dvisvgm>
-    \fp_set:Nn \l__box_angle_fp { round ( \l__box_angle_fp , 5 ) }
-%</dvips|dvisvgm>
-%<*dvips>
+    \@@_scope_begin:
     \@@_literal:n
       {
-        \fp_compare:nNnTF \l__box_angle_fp = \c_zero_fp
+        \fp_compare:nNnTF {#2} = \c_zero_fp
           { 0 }
-          { \fp_eval:n { -\l__box_angle_fp } }
-        \c_space_tl
+          { \fp_eval:n { round ( -#2 , 5 ) } } ~
         rotate
       }
-%</dvips>
-%    \end{macrocode}
-%   For \texttt{dvisvgm} the center of rotation can be set to the current
-%   point using the |{?x}| and |{?y}| commands as the optional arguments of
-%   the low-level operation.
+   \box_use:N #1
+   \@@_scope_end:
+  }
+% \end{macro}
+%
+% \begin{macro}{\@@_box_use_scale:Nnn}
+%   The \texttt{dvips} driver once again has a dedicated operation we can
+%   use here.
 %    \begin{macrocode}
-%<*dvisvgm>
-    \@@_transform:n
+\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3
+  {
+    \@@_scope_begin:
+    \@@_literal:n
       {
-        rotate
-          ( \fp_eval:n { -\l__box_angle_fp } , ~ { ?x } , ~ { ?y } )
+        \fp_eval:n { round ( #2 , 5 ) } ~
+        \fp_eval:n { round ( #3 , 5 ) } ~
+        scale
       }
-%</dvisvgm>
+    \hbox_overlap_right:n { \box_use:N #1 }
+    \@@_scope_end:
   }
 %    \end{macrocode}
-%   The end of a rotation means tidying up the output grouping.
+% \end{macro}
+%
+% \subsubsection{Color}
+%
+% \begin{variable}{\l_@@_current_color_tl}
+%   The current color in driver-dependent format.
+%    \begin{macrocode}
+\tl_new:N \l_@@_current_color_tl
+\tl_set:Nn \l_@@_current_color_tl { gray~0 }
+%<*package>
+\AtBeginDocument
+  {
+    \@ifpackageloaded { color }
+      { \tl_set:Nn \l_@@_current_color_tl { \current at color } }
+      { }
+  }
+%</package>
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[int]{\@@_color_ensure_current:}
+% \begin{macro}[aux]{\@@_color_reset:}
+%   Directly set the color using the specials: no optimisation here.
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_color_ensure_current:
+  {
+    \tex_special:D { color~push~\l_@@_current_color_tl }
+    \group_insert_after:N \@@_color_reset:
+  }
+
+\cs_new_protected_nopar:Npn \@@_color_reset:
+  { \tex_special:D { color~pop } }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</dvips>
+%    \end{macrocode}
+%
+% \subsection{\texttt{dvisvgm} driver}
+%
 %    \begin{macrocode}
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_eq:NN \@@_box_rotate_end: \@@_state_restore:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
 %<*dvisvgm>
-\cs_new_eq:NN \@@_box_rotate_end: \@@_transform_end:
-%</dvisvgm>
+%    \end{macrocode}
+%
+% \subsubsection{Basics}
+%
+% \begin{macro}[int]{\@@_literal:n}
+%   Unlike the other drivers, the requirements for making SVG files mean
+%   that we can't conveniently transform all operations to the current point.
+%   That makes life a bit more tricky later as that needs to be accounted for.
+%   A new line is added after each call to help to keep the output readable
+%   for debugging.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_literal:n #1
+  { \tex_special:D { dvisvgm:raw~ #1 { ?nl } } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@@_scope_begin:, \@@_scope_end:}
+%   A scope in SVG terms is slightly different to the other drivers as
+%   operations have to be \enquote{tied} to these not simply inside them.
+%    \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_scope_begin:
+  { \@@_literal:n { <g> } }
+\cs_new_protected_nopar:Npn \@@_scope_end:
+  { \@@_literal:n { </g> } }
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_box_scale_begin:, \@@_box_scale_end:}
-%   Scaling is not dissimilar to rotation, but the calculations are somewhat
-%   less complex.
+% \subsection{Driver-specific auxiliaries}
+%
+% \begin{macro}[int]{\@@_scope_begin:n}
+%   In SVG transformations, clips and so on are attached directly to scopes so
+%   we need a way or allowing for that. This is rather more useful that
+%   \cs{@@_scope_begin:} as a result. No assumptions are made about the nature
+%   of the scoped operation(s).
 %    \begin{macrocode}
-\cs_new_protected_nopar:Npn \@@_box_scale_begin:
+\cs_new_protected:Npn \@@_scope_begin:n #1
+  { \@@_literal:n { <g~ #1 > } }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Box operations}
+%
+% \begin{macro}[int]{\@@_box_use_clip:N}
+% \begin{variable}[aux]{\g_@@_clip_path_int}
+%   Clipping in SVG is more involved than with other drivers. The first issue
+%   is that the clipping path must be defined separately from where it is used,
+%   so we need to track how many paths have applied. The naming here uses
+%   \texttt{l3cp} as the namespace with a number following. Rather than use
+%   a rectangular operation, we define the path manually as this allows it to
+%   have a depth: easier than the alternative approach of shifting content
+%   up and down using scopes to allow for the depth of the \TeX{} box and
+%   keep the reference point the same!
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_box_use_clip:N #1
   {
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_state_save:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-    \fp_set:Nn \l__box_scale_x_fp { round ( \l__box_scale_x_fp , 5 ) }
-    \fp_set:Nn \l__box_scale_y_fp { round ( \l__box_scale_y_fp , 5 ) }
-%<*dvips>
+    \int_gincr:N \g_@@_clip_path_int
+    \@@_literal:n
+      { < clipPath~id = " l3cp \int_use:N \g_@@_clip_path_int " > }
     \@@_literal:n
       {
-        \fp_use:N \l__box_scale_x_fp \c_space_tl
-        \fp_use:N \l__box_scale_y_fp \c_space_tl
-        scale
+        <
+          path ~ d =
+            "
+              M ~ 0 ~
+                  \dim_to_decimal:n { -\box_dp:N #1 } ~
+              L ~ \dim_to_decimal:n { \box_wd:N #1 } ~
+                  \dim_to_decimal:n { -\box_dp:N #1 } ~
+              L ~ \dim_to_decimal:n { \box_wd:N #1 }  ~
+                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
+              L ~ 0 ~
+                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
+              Z
+            "
+        />
       }
-%</dvips>
-%<*dvipdfmx|pdfmode|xdvipdfmx>
-    \@@_matrix:n
+    \@@_literal:n
+      { < /clipPath > }
+%    \end{macrocode}
+%   In general the SVG set up does not try to transform coordinates to the
+%   current point. For clipping we need to do that, so have a transformation
+%   here to get us to the right place, and a matching one just before the
+%   \TeX{} box is inserted to get things back on track. The clip path needs to
+%   come between those two such that if lines up with the current point, as
+%   does the \TeX{} box.
+%    \begin{macrocode}
+    \@@_scope_begin:n
       {
-        \fp_use:N \l__box_scale_x_fp \c_space_tl
-        0~0~
-        \fp_use:N \l__box_scale_y_fp
+        transform =
+          "
+            translate ( { ?x } , { ?y } ) ~
+            scale ( 1 , -1 )
+          "
       }
-%</dvipdfmx|pdfmode|xdvipdfmx>
+    \@@_scope_begin:n
+      {
+        clip-path = "url ( \c_hash_str l3cp \int_use:N \g_@@_clip_path_int ) "
+      }
+    \@@_scope_begin:n
+      {
+        transform =
+          "
+            scale ( -1 , 1 ) ~
+            translate ( { ?x } , { ?y } ) ~
+            scale ( -1 , -1 )
+          "
+      }
+    \box_use:N #1
+    \@@_scope_end:
+    \@@_scope_end:
+    \@@_scope_end:
+%    \skip_horizontal:n { \box_wd:N #1 }
+  }
+\int_new:N \g_@@_clip_path_int
 %    \end{macrocode}
-%   For \texttt{dvisvgm}, in contrast to rotation there's no convenient
-%   shortcut to get the current position in the right place. We therefore have
-%   to manipulate the current point such that everything lines up.
+% \end{variable}
+% \end{macro}
+%
+% \begin{macro}[int]{\@@_box_use_rotate:Nn}
+%   Rotation has a dedicated operation which includes a centre-of-rotation
+%   optional pair. That can be picked up from the driver syntax, so there is
+%   no need to worry about the transformation matrix.
 %    \begin{macrocode}
-%<*dvisvgm>
-    \@@_transform:n
+\cs_new_protected:Npn \@@_box_use_rotate:Nn #1#2
+  {
+    \@@_scope_begin:n
       {
-        translate ( { ?x } , { ?y } )
-        scale
-          (
-            \fp_eval:n { -\l__box_scale_x_fp } ,
-            \fp_eval:n { -\l__box_scale_y_fp } 
-          )
-        translate ( { ?x } , { ?y } )
-        scale ( -1 )
+        transform =
+          "
+            rotate
+            ( \fp_eval:n { round ( -#2 , 5 ) } , ~ { ?x } , ~ { ?y } )
+          "
       }
-%</dvisvgm>
+    \box_use:N #1
+    \@@_scope_end:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_box_use_scale:Nnn}
+%   In contrast to rotation, we have to account for the current position in this
+%   case. That is done using a couple of translations in addition to the scaling
+%   (which is therefore done backward with a flip).
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_box_use_scale:Nnn #1#2#3
+  {
+    \@@_scope_begin:n
+      {
+        transform =
+          "
+            translate ( { ?x } , { ?y } ) ~
+            scale
+              (
+                \fp_eval:n { round ( -#2 , 5 ) } ,
+                \fp_eval:n { round ( -#3 , 5 ) }
+              ) ~
+            translate ( { ?x } , { ?y } ) ~
+            scale ( -1 )
+          "
+      }
+    \hbox_overlap_right:n { \box_use:N #1 }
+    \@@_scope_end:
   }
-%<*dvips|dvipdfmx|pdfmode|xdvipdfmx>
-\cs_new_eq:NN \@@_box_scale_end: \@@_state_restore:
-%</dvips|dvipdfmx|pdfmode|xdvipdfmx>
-%<*dvisvgm>
-\cs_new_eq:NN \@@_box_scale_end: \@@_transform_end:
-%</dvisvgm>
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsection{Color support}
+% \subsubsection{Color}
 %
 % \begin{variable}{\l_@@_current_color_tl}
-%   The current color is needed by all of the engines, but the way this
-%   is stored varies. In package mode if the \pkg{color} package is loaded
-%   simply pick up what it is using.
+%   The current color in driver-dependent format: the same as for
+%   \texttt{dvips}.
 %    \begin{macrocode}
 \tl_new:N \l_@@_current_color_tl
-%<*dvipdfmx|dvips|xdvipdfmx>
 \tl_set:Nn \l_@@_current_color_tl { gray~0 }
-%</dvipdfmx|dvips|xdvipdfmx>
-%<*pdfmode>
-\tl_set:Nn \l_@@_current_color_tl { 0~g~0~G }
-%</pdfmode>
 %<*package>
 \AtBeginDocument
   {
@@ -600,59 +889,30 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{variable}{\l_@@_color_stack_int}
-%   \pdfTeX{} and \LuaTeX{} have multiple stacks
-%   available, and the color stack therefore needs a number when in PDF mode.
-%    \begin{macrocode}
-%<*pdfmode>
-\int_new:N \l_@@_color_stack_int
-%</pdfmode>
-%    \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}{\@@_color_ensure_current:}
+% \begin{macro}[int]{\@@_color_ensure_current:}
 % \begin{macro}[aux]{\@@_color_reset:}
-%   Setting the current color depends on the nature of the color stack
-%   available. In all cases there is a need to reset the color after
-%   the current group.
+%   Directly set the color: same as \texttt{dvips}.
 %    \begin{macrocode}
-\cs_new_protected_nopar:Npx \@@_color_ensure_current:
-%<*dvipdfmx|dvips|dvisvgm|xdvipdfmx>
-  {
-    \tex_special:D { color~push~\exp_not:N \l_@@_current_color_tl }
-    \group_insert_after:N \exp_not:N \@@_color_reset:
-  }
-%</dvipdfmx|dvips|dvisvgm|xdvipdfmx>
-%<*pdfmode>
+\cs_new_protected_nopar:Npn \@@_color_ensure_current:
   {
-    \cs_if_exist:NTF \luatex_pdfextension:D
-      { \luatex_pdfextension:D colorstack }
-      { \pdftex_pdfcolorstack:D }
-        \exp_not:N \l_@@_color_stack_int push
-          { \exp_not:N \l_@@_current_color_tl }
+    \tex_special:D { color~push~\l_@@_current_color_tl }
     \group_insert_after:N \exp_not:N \@@_color_reset:
   }
-%</pdfmode>
-\cs_new_protected_nopar:Npx \@@_color_reset:
-%<*dvipdfmx|dvips|dvisvgm|xdvipdfmx>
+
+\cs_new_protected_nopar:Npn \@@_color_reset:
   { \tex_special:D { color~pop } }
-%</dvipdfmx|dvips|dvisvgm|xdvipdfmx>
-%<*pdfmode>
-  {
-    \cs_if_exist:NTF \luatex_pdfextension:D
-      { \luatex_pdfextension:D colorstack }
-      { \pdftex_pdfcolorstack:D }
-        \exp_not:N \l_@@_color_stack_int pop \scan_stop:
-  }
-%</pdfmode>
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
 %    \begin{macrocode}
+%</dvisvgm>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 %</initex|package>
 %    \end{macrocode}
 %
 % \end{implementation}
 %
-% \PrintIndex
+% \PrintIndex
\ No newline at end of file
diff --git a/l3kernel/testfiles/d3dvipdfmx.tlg b/l3kernel/testfiles/d3dvipdfmx.tlg
index 7422869..3731e10 100644
--- a/l3kernel/testfiles/d3dvipdfmx.tlg
+++ b/l3kernel/testfiles/d3dvipdfmx.tlg
@@ -550,7 +550,7 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push gray 0}
+.\special{pdf:bcolor [0]}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -563,7 +563,7 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
+.\special{pdf:ecolor}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3dvips.luatex.tlg b/l3kernel/testfiles/d3dvips.luatex.tlg
index b3f6dcd..4094934 100644
--- a/l3kernel/testfiles/d3dvips.luatex.tlg
+++ b/l3kernel/testfiles/d3dvips.luatex.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box27=
 \hbox(6.94444+1.0)x86.45851, direction TLT
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio
 \ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil, direction TLT
 ..\hbox(6.94444+1.0)x86.45851, direction TLT
@@ -40,7 +40,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+0.0)x86.45851, direction TLT
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio
 \ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil, direction TLT
 ..\hbox(6.94444+0.0)x86.45851, direction TLT
@@ -73,7 +73,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+1.0)x86.45851, direction TLT
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio
 \ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil, direction TLT
 ..\hbox(6.94444+1.0)x86.45851, direction TLT
@@ -106,7 +106,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+1.94444)x20.0, direction TLT
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio
 \ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil, direction TLT
 ..\hbox(6.94444+1.94444)x20.0, direction TLT
diff --git a/l3kernel/testfiles/d3dvips.tlg b/l3kernel/testfiles/d3dvips.tlg
index c1d91c6..77afc14 100644
--- a/l3kernel/testfiles/d3dvips.tlg
+++ b/l3kernel/testfiles/d3dvips.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box27=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -37,7 +37,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+0.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+0.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -67,7 +67,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -97,7 +97,7 @@ l. ...  }
 > \box27=
 \hbox(6.94444+1.94444)x20.0
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
 ..\hbox(6.94444+1.94444)x20.0
 ...\OT1/cmr/m/n/10 G
diff --git a/l3kernel/testfiles/d3dvips.xetex.tlg b/l3kernel/testfiles/d3dvips.xetex.tlg
index 7422869..3731e10 100644
--- a/l3kernel/testfiles/d3dvips.xetex.tlg
+++ b/l3kernel/testfiles/d3dvips.xetex.tlg
@@ -550,7 +550,7 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push gray 0}
+.\special{pdf:bcolor [0]}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -563,7 +563,7 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
+.\special{pdf:ecolor}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3dvips.luatex.tlg b/l3kernel/testfiles/d3dvisvgm.luatex.tlg
similarity index 68%
copy from l3kernel/testfiles/d3dvips.luatex.tlg
copy to l3kernel/testfiles/d3dvisvgm.luatex.tlg
index b3f6dcd..31a1d21 100644
--- a/l3kernel/testfiles/d3dvips.luatex.tlg
+++ b/l3kernel/testfiles/d3dvisvgm.luatex.tlg
@@ -6,133 +6,149 @@ TEST 1: Clip box
 ============================================================
 > \box27=
 \hbox(6.94444+1.0)x86.45851, direction TLT
-.\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{dvisvgm:raw <clipPath id="l3cp1">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1 L 86.45851 -1 L 86.45851 7.94444 L 0 7.94
 \ETC.}
-.\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil, direction TLT
-..\hbox(6.94444+1.0)x86.45851, direction TLT
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\discretionary
-....\OT1/cmr/m/n/10 -
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\special{ps:grestore}
-.\glue 86.45851
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp1)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-
+\ETC.}
+.\hbox(6.94444+1.0)x86.45851, direction TLT
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\discretionary
+...\OT1/cmr/m/n/10 -
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+0.0)x86.45851, direction TLT
-.\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{dvisvgm:raw <clipPath id="l3cp2">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 0 L 86.45851 0 L 86.45851 6.94444 L 0 6.9444
 \ETC.}
-.\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil, direction TLT
-..\hbox(6.94444+0.0)x86.45851, direction TLT
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\discretionary
-....\OT1/cmr/m/n/10 -
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\special{ps:grestore}
-.\glue 86.45851
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp2)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-
+\ETC.}
+.\hbox(6.94444+0.0)x86.45851, direction TLT
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\discretionary
+...\OT1/cmr/m/n/10 -
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+1.0)x86.45851, direction TLT
-.\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{dvisvgm:raw <clipPath id="l3cp3">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1 L 86.45851 -1 L 86.45851 7.94444 L 0 7.94
 \ETC.}
-.\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil, direction TLT
-..\hbox(6.94444+1.0)x86.45851, direction TLT
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\discretionary
-....\OT1/cmr/m/n/10 -
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\special{ps:grestore}
-.\glue 86.45851
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp3)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-
+\ETC.}
+.\hbox(6.94444+1.0)x86.45851, direction TLT
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\discretionary
+...\OT1/cmr/m/n/10 -
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+1.94444)x20.0, direction TLT
-.\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat
+.\special{dvisvgm:raw <clipPath id="l3cp4">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1.94444 L 20 -1.94444 L 20 8.88889 L 0 8.88
 \ETC.}
-.\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil, direction TLT
-..\hbox(6.94444+1.94444)x20.0, direction TLT
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\discretionary
-....\OT1/cmr/m/n/10 -
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\special{ps:grestore}
-.\glue 20.0
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp4)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-
+\ETC.}
+.\hbox(6.94444+1.94444)x20.0, direction TLT
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\discretionary
+...\OT1/cmr/m/n/10 -
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -162,9 +178,7 @@ l. ...  }
 .\hbox(6.94444+0.0)x50.02786, direction TLT
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 0 rotate neg exch neg exch t
-ra\ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-0, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -179,7 +193,7 @@ ra\ETC.}
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -188,9 +202,7 @@ l. ...  }
 .\hbox(31.028+0.0)x46.79762, direction TLT
 ..\kern 3.47223
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -30 rotate neg exch neg exch
- t\ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-30, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -205,7 +217,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -214,9 +226,7 @@ l. ...  }
 .\hbox(40.2855+0.0)x40.2855, direction TLT
 ..\kern 4.91046
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -45 rotate neg exch neg exch
- t\ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -231,7 +241,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -240,9 +250,7 @@ l. ...  }
 .\hbox(35.37505+4.91046)x40.2855, direction TLT
 ..\kern 40.2855
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -135 rotate neg exch neg exc
-h \ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-135, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -257,7 +265,7 @@ h \ETC.}
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -266,9 +274,7 @@ l. ...  }
 .\hbox(0.0+40.2855)x40.2855, direction TLT
 ..\kern 35.37505
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -225 rotate neg exch neg exc
-h \ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-225, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -283,7 +289,7 @@ h \ETC.}
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -292,9 +298,7 @@ l. ...  }
 .\hbox(4.91046+35.37505)x40.2855, direction TLT
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -315 rotate neg exch neg exc
-h \ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-315, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -309,7 +313,7 @@ h \ETC.}
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -318,17 +322,13 @@ l. ...  }
 .\hbox(56.9723+0.0)x56.97232, direction TLT
 ..\kern 28.48616
 ..\hbox(40.2855+0.0)x40.2855, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -45 rotate neg exch neg exch
- t\ETC.}
+...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 ...\hbox(40.2855+0.0)x40.2855, direction TLT
 ....\hbox(40.2855+0.0)x40.2855, direction TLT
 .....\hbox(40.2855+0.0)x40.2855, direction TLT
 ......\kern 4.91046
 ......\hbox(6.94444+0.0)x50.02786, direction TLT
-.......\special{ps:gsave}
-.......\special{ps:currentpoint currentpoint translate -45 rotate neg exch neg 
-exch t\ETC.}
+.......\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 .......\hbox(6.94444+0.0)x50.02786, direction TLT
 ........\hbox(6.94444+0.0)x50.02786, direction TLT
 .........\OT1/cmr/m/n/10 H
@@ -343,8 +343,8 @@ exch t\ETC.}
 .........\OT1/cmr/m/n/10 r
 .........\OT1/cmr/m/n/10 l
 .........\OT1/cmr/m/n/10 d
-.......\special{ps:grestore}
-...\special{ps:grestore}
+.......\special{dvisvgm:raw </g>{?nl}}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -374,9 +374,8 @@ l. ...  }
 .\hbox(6.94444+0.0)x50.02786, direction TLT
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 1 1 scale neg exch neg exch 
-tr\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-1) transla
+te\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -392,7 +391,7 @@ tr\ETC.}
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -402,9 +401,8 @@ l. ...  }
 .\hbox(6.94444+0.0)x125.06966, direction TLT
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x125.06966, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 2.5 1 scale neg exch neg exc
-h \ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-2.5,-1) trans
+la\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -420,7 +418,7 @@ h \ETC.}
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -430,9 +428,8 @@ l. ...  }
 .\hbox(2.31477+0.0)x50.02786, direction TLT
 ..\kern 0.0
 ..\hbox(2.31477+0.0)x50.02786, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 1 0.33333 scale neg exch neg
- e\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-0.33333) t
+ra\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil, direction TLT
 ....\hbox(6.94444+0.0)x50.02786, direction TLT
 .....\OT1/cmr/m/n/10 H
@@ -448,7 +445,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -458,9 +455,8 @@ l. ...  }
 .\hbox(6.94444+1.94444)x103.61133, direction TLT
 ..\kern 0.0
 ..\hbox(6.94444+1.94444)x103.61133, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 1 1 scale neg exch neg exch 
-tr\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-1) transla
+te\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil, direction TLT
 ....\hbox(6.94444+1.94444)x103.61133, direction TLT
 .....\OT1/cmr/m/n/10 T
@@ -489,7 +485,7 @@ tr\ETC.}
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -499,9 +495,8 @@ l. ...  }
 .\hbox(20.83333+5.83333)x310.83398, direction TLT
 ..\kern 0.0
 ..\hbox(20.83333+5.83333)x310.83398, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate 3 3 scale neg exch neg exch 
-tr\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-3,-3) transla
+te\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil, direction TLT
 ....\hbox(6.94444+1.94444)x103.61133, direction TLT
 .....\OT1/cmr/m/n/10 T
@@ -530,7 +525,7 @@ tr\ETC.}
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -540,9 +535,8 @@ l. ...  }
 .\hbox(5.83333+20.83333)x310.83398, direction TLT
 ..\kern 310.83398
 ..\hbox(5.83333+20.83333)x0.0, direction TLT
-...\special{ps:gsave}
-...\special{ps:currentpoint currentpoint translate -3 -3 scale neg exch neg exc
-h \ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(3,3) translate
+({\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil, direction TLT
 ....\hbox(6.94444+1.94444)x103.61133, direction TLT
 .....\OT1/cmr/m/n/10 T
@@ -571,7 +565,7 @@ h \ETC.}
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{ps:grestore}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -583,6 +577,7 @@ TEST 4: Color
 > \box71=
 \hbox(6.94444+0.0)x50.02786, direction TLT
 .\special{color push gray 0}
+.\special{color pop}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -595,7 +590,6 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3dvisvgm.tlg b/l3kernel/testfiles/d3dvisvgm.tlg
index 5687d79..5000c40 100644
--- a/l3kernel/testfiles/d3dvisvgm.tlg
+++ b/l3kernel/testfiles/d3dvisvgm.tlg
@@ -6,109 +6,133 @@ TEST 1: Clip box
 ============================================================
 > \box27=
 \hbox(6.94444+1.0)x86.45851
-.\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
-..\hbox(6.94444+1.0)x86.45851
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\glue 86.45851
+.\special{dvisvgm:raw <clipPath id="l3cp1">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1 L 86.45851 -1 L 86.45851 7.94444 L 0 7.94\ETC.}
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp1)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-\ETC.}
+.\hbox(6.94444+1.0)x86.45851
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+0.0)x86.45851
-.\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
-..\hbox(6.94444+0.0)x86.45851
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\glue 86.45851
+.\special{dvisvgm:raw <clipPath id="l3cp2">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 0 L 86.45851 0 L 86.45851 6.94444 L 0 6.9444\ETC.}
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp2)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-\ETC.}
+.\hbox(6.94444+0.0)x86.45851
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+1.0)x86.45851
-.\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
-..\hbox(6.94444+1.0)x86.45851
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\glue 86.45851
+.\special{dvisvgm:raw <clipPath id="l3cp3">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1 L 86.45851 -1 L 86.45851 7.94444 L 0 7.94\ETC.}
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp3)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-\ETC.}
+.\hbox(6.94444+1.0)x86.45851
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
 > \box27=
 \hbox(6.94444+1.94444)x20.0
-.\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
-..\hbox(6.94444+1.94444)x20.0
-...\OT1/cmr/m/n/10 G
-...\OT1/cmr/m/n/10 o
-...\OT1/cmr/m/n/10 i
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 g
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 u
-...\OT1/cmr/m/n/10 p
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 a
-...\OT1/cmr/m/n/10 n
-...\OT1/cmr/m/n/10 d
-...\glue 3.33333 plus 1.66666 minus 1.11111
-...\OT1/cmr/m/n/10 d
-...\OT1/cmr/m/n/10 o
-...\kern-0.27779
-...\OT1/cmr/m/n/10 w
-...\OT1/cmr/m/n/10 n
-..\glue 0.0 plus 1.0fil minus 1.0fil
-.\glue 20.0
+.\special{dvisvgm:raw <clipPath id="l3cp4">{?nl}}
+.\special{dvisvgm:raw <path d="M 0 -1.94444 L 20 -1.94444 L 20 8.88889 L 0 8.88\ETC.}
+.\special{dvisvgm:raw </clipPath>{?nl}}
+.\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(1,-1)">{?nl}}
+.\special{dvisvgm:raw <g clip-path="url(#l3cp4)">{?nl}}
+.\special{dvisvgm:raw <g transform="scale(-1,1) translate({?x},{?y}) scale(-1,-\ETC.}
+.\hbox(6.94444+1.94444)x20.0
+..\OT1/cmr/m/n/10 G
+..\OT1/cmr/m/n/10 o
+..\OT1/cmr/m/n/10 i
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 g
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 u
+..\OT1/cmr/m/n/10 p
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 a
+..\OT1/cmr/m/n/10 n
+..\OT1/cmr/m/n/10 d
+..\glue 3.33333 plus 1.66666 minus 1.11111
+..\OT1/cmr/m/n/10 d
+..\OT1/cmr/m/n/10 o
+..\kern-0.27779
+..\OT1/cmr/m/n/10 w
+..\OT1/cmr/m/n/10 n
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
+.\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -138,7 +162,7 @@ l. ...  }
 .\hbox(6.94444+0.0)x50.02786
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-0, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-0, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -153,7 +177,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -162,7 +186,7 @@ l. ...  }
 .\hbox(31.028+0.0)x46.79762
 ..\kern 3.47223
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-30, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-30, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -177,7 +201,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -186,7 +210,7 @@ l. ...  }
 .\hbox(40.2855+0.0)x40.2855
 ..\kern 4.91046
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -201,7 +225,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -210,7 +234,7 @@ l. ...  }
 .\hbox(35.37505+4.91046)x40.2855
 ..\kern 40.2855
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-135, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-135, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -225,7 +249,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -234,7 +258,7 @@ l. ...  }
 .\hbox(0.0+40.2855)x40.2855
 ..\kern 35.37505
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-225, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-225, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -249,7 +273,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -258,7 +282,7 @@ l. ...  }
 .\hbox(4.91046+35.37505)x40.2855
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="rotate(-315, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-315, {?x}, {?y})">{?nl}}
 ...\hbox(6.94444+0.0)x50.02786
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -273,7 +297,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -282,13 +306,13 @@ l. ...  }
 .\hbox(56.9723+0.0)x56.97232
 ..\kern 28.48616
 ..\hbox(40.2855+0.0)x40.2855
-...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">}
+...\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 ...\hbox(40.2855+0.0)x40.2855
 ....\hbox(40.2855+0.0)x40.2855
 .....\hbox(40.2855+0.0)x40.2855
 ......\kern 4.91046
 ......\hbox(6.94444+0.0)x50.02786
-.......\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">}
+.......\special{dvisvgm:raw <g transform="rotate(-45, {?x}, {?y})">{?nl}}
 .......\hbox(6.94444+0.0)x50.02786
 ........\hbox(6.94444+0.0)x50.02786
 .........\OT1/cmr/m/n/10 H
@@ -303,8 +327,8 @@ l. ...  }
 .........\OT1/cmr/m/n/10 r
 .........\OT1/cmr/m/n/10 l
 .........\OT1/cmr/m/n/10 d
-.......\special{dvisvgm:raw </g>}
-...\special{dvisvgm:raw </g>}
+.......\special{dvisvgm:raw </g>{?nl}}
+...\special{dvisvgm:raw </g>{?nl}}
 ! OK.
 <argument> \l_tmpa_box 
 l. ...  }
@@ -334,7 +358,7 @@ l. ...  }
 .\hbox(6.94444+0.0)x50.02786
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(-1,-1)translate({\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-1) translate\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -350,7 +374,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -360,7 +384,7 @@ l. ...  }
 .\hbox(6.94444+0.0)x125.06966
 ..\kern 0.0
 ..\hbox(6.94444+0.0)x125.06966
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(-2.5,-1)translate\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-2.5,-1) transla\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -376,7 +400,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -386,7 +410,7 @@ l. ...  }
 .\hbox(2.31477+0.0)x50.02786
 ..\kern 0.0
 ..\hbox(2.31477+0.0)x50.02786
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(-1,-0.33333)trans\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-0.33333) tra\ETC.}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
 .....\OT1/cmr/m/n/10 H
@@ -402,7 +426,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -412,7 +436,7 @@ l. ...  }
 .\hbox(6.94444+1.94444)x103.61133
 ..\kern 0.0
 ..\hbox(6.94444+1.94444)x103.61133
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(-1,-1)translate({\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-1,-1) translate\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil
 ....\hbox(6.94444+1.94444)x103.61133
 .....\OT1/cmr/m/n/10 T
@@ -439,7 +463,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -449,7 +473,7 @@ l. ...  }
 .\hbox(20.83333+5.83333)x310.83398
 ..\kern 0.0
 ..\hbox(20.83333+5.83333)x310.83398
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(-3,-3)translate({\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(-3,-3) translate\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil
 ....\hbox(6.94444+1.94444)x103.61133
 .....\OT1/cmr/m/n/10 T
@@ -476,7 +500,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -486,7 +510,7 @@ l. ...  }
 .\hbox(5.83333+20.83333)x310.83398
 ..\kern 310.83398
 ..\hbox(5.83333+20.83333)x0.0
-...\special{dvisvgm:raw <g transform="translate({?x},{?y})scale(3,3)translate({?x\ETC.}
+...\special{dvisvgm:raw <g transform="translate({?x},{?y}) scale(3,3) translate({\ETC.}
 ...\hbox(6.94444+1.94444)x0.0, glue set - 103.61133fil
 ....\hbox(6.94444+1.94444)x103.61133
 .....\OT1/cmr/m/n/10 T
@@ -513,7 +537,7 @@ l. ...  }
 .....\OT1/cmr/m/n/10 w
 .....\OT1/cmr/m/n/10 n
 ....\glue 0.0 plus 1.0fil minus 1.0fil
-...\special{dvisvgm:raw </g>}
+...\special{dvisvgm:raw </g>{?nl}}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
 ! OK.
 <argument> \l_tmpa_box 
@@ -524,7 +548,8 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push }
+.\special{color push gray 0}
+.\special{color pop}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -537,7 +562,6 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3dvisvgm.xetex.tlg b/l3kernel/testfiles/d3dvisvgm.xetex.tlg
index 7422869..3731e10 100644
--- a/l3kernel/testfiles/d3dvisvgm.xetex.tlg
+++ b/l3kernel/testfiles/d3dvisvgm.xetex.tlg
@@ -550,7 +550,7 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push gray 0}
+.\special{pdf:bcolor [0]}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -563,7 +563,7 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
+.\special{pdf:ecolor}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3pdfmode.ptex.tlg b/l3kernel/testfiles/d3pdfmode.ptex.tlg
index 14a9c16..ebe511b 100644
--- a/l3kernel/testfiles/d3pdfmode.ptex.tlg
+++ b/l3kernel/testfiles/d3pdfmode.ptex.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -37,7 +37,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+0.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+0.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -67,7 +67,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -97,7 +97,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.94444)x20.0
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
 ..\hbox(6.94444+1.94444)x20.0
 ...\OT1/cmr/m/n/10 G
diff --git a/l3kernel/testfiles/d3pdfmode.uptex.tlg b/l3kernel/testfiles/d3pdfmode.uptex.tlg
index 14a9c16..ebe511b 100644
--- a/l3kernel/testfiles/d3pdfmode.uptex.tlg
+++ b/l3kernel/testfiles/d3pdfmode.uptex.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -37,7 +37,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+0.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+0.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -67,7 +67,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -97,7 +97,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.94444)x20.0
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
 ..\hbox(6.94444+1.94444)x20.0
 ...\OT1/cmr/m/n/10 G
diff --git a/l3kernel/testfiles/d3pdfmode.xetex.tlg b/l3kernel/testfiles/d3pdfmode.xetex.tlg
index 7422869..3731e10 100644
--- a/l3kernel/testfiles/d3pdfmode.xetex.tlg
+++ b/l3kernel/testfiles/d3pdfmode.xetex.tlg
@@ -550,7 +550,7 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push gray 0}
+.\special{pdf:bcolor [0]}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -563,7 +563,7 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
+.\special{pdf:ecolor}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/d3xdvipdfmx.ptex.tlg b/l3kernel/testfiles/d3xdvipdfmx.ptex.tlg
index 14a9c16..ebe511b 100644
--- a/l3kernel/testfiles/d3xdvipdfmx.ptex.tlg
+++ b/l3kernel/testfiles/d3xdvipdfmx.ptex.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -37,7 +37,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+0.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+0.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -67,7 +67,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -97,7 +97,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.94444)x20.0
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
 ..\hbox(6.94444+1.94444)x20.0
 ...\OT1/cmr/m/n/10 G
diff --git a/l3kernel/testfiles/d3xdvipdfmx.uptex.tlg b/l3kernel/testfiles/d3xdvipdfmx.uptex.tlg
index 14a9c16..ebe511b 100644
--- a/l3kernel/testfiles/d3xdvipdfmx.uptex.tlg
+++ b/l3kernel/testfiles/d3xdvipdfmx.uptex.tlg
@@ -7,7 +7,7 @@ TEST 1: Clip box
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -37,7 +37,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+0.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+0.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+0.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -67,7 +67,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.0)x86.45851
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.0)x0.0, glue set - 86.45851fil
 ..\hbox(6.94444+1.0)x86.45851
 ...\OT1/cmr/m/n/10 G
@@ -97,7 +97,7 @@ l. ...  }
 > \box42=
 \hbox(6.94444+1.94444)x20.0
 .\special{ps:gsave}
-.\special{ps:currentpoint currentpoint translate /savedmatrix matrix currentmat\ETC.}
+.\special{ps:currentpoint currentpoint translate matrix currentmatrix Resolutio\ETC.}
 .\hbox(6.94444+1.94444)x0.0, glue set - 20.0fil
 ..\hbox(6.94444+1.94444)x20.0
 ...\OT1/cmr/m/n/10 G
diff --git a/l3kernel/testfiles/d3xdvipdfmx.xetex.tlg b/l3kernel/testfiles/d3xdvipdfmx.xetex.tlg
index 7422869..3731e10 100644
--- a/l3kernel/testfiles/d3xdvipdfmx.xetex.tlg
+++ b/l3kernel/testfiles/d3xdvipdfmx.xetex.tlg
@@ -550,7 +550,7 @@ TEST 4: Color
 ============================================================
 > \box71=
 \hbox(6.94444+0.0)x50.02786
-.\special{color push gray 0}
+.\special{pdf:bcolor [0]}
 .\OT1/cmr/m/n/10 H
 .\OT1/cmr/m/n/10 e
 .\OT1/cmr/m/n/10 l
@@ -563,7 +563,7 @@ TEST 4: Color
 .\OT1/cmr/m/n/10 r
 .\OT1/cmr/m/n/10 l
 .\OT1/cmr/m/n/10 d
-.\special{color pop}
+.\special{pdf:ecolor}
 ! OK.
 <argument> \l_tmpa_coffin 
 l. ...  }
diff --git a/l3kernel/testfiles/driver.tex b/l3kernel/testfiles/driver.tex
index f6a5477..8141980 100644
--- a/l3kernel/testfiles/driver.tex
+++ b/l3kernel/testfiles/driver.tex
@@ -88,9 +88,6 @@
 
 \TEST { Color }
   {
-    \OMIT
-      \coffin_new:N \l_tmpa_coffin
-    \TIMO
     \hcoffin_set:Nn \l_tmpa_coffin { Hello~world }
     \box_show:N \l_tmpa_coffin
   }
diff --git a/l3kernel/testfiles/m3coffins001.ptex.tlg b/l3kernel/testfiles/m3coffins001.ptex.tlg
index ca00891..84756d0 100644
--- a/l3kernel/testfiles/m3coffins001.ptex.tlg
+++ b/l3kernel/testfiles/m3coffins001.ptex.tlg
@@ -209,7 +209,7 @@ Defining \2 on line ...
 ......\kern 0.0
 ......\kern 0.0
 ......\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(10.34444+3.4)x45.1334
 ........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .........\vbox(13.74443+0.0)x45.1334
@@ -231,11 +231,11 @@ Defining \2 on line ...
 ............\glue 3.0
 ...........\rule(*+*)x0.4
 ..........\rule(0.4+0.0)x*
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -45.1334
 .....\kern -45.41116
 .....\hbox(10.34444+3.4)x45.41116, shifted -3.4
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\hbox(10.34444+3.4)x45.41116
 .......\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ........\vbox(13.74443+0.0)x45.41116
@@ -260,25 +260,25 @@ Defining \2 on line ...
 ...........\glue 3.0
 ..........\rule(*+*)x0.4
 .........\rule(0.4+0.0)x*
-......\special{color pop}
+......\special{pdf:ecolor}
 .....\kern 45.1334
 ....\kern -90.54457
 ....\kern -0.5
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern -11.61815
 ...\hbox(3.75+1.25)x9.61815, shifted 5.75
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 l
 ....\OT1/cmss/m/n/5 ,
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -300,7 +300,7 @@ l. ...}
 ........\kern 0.0
 ........\kern 0.0
 ........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(10.34444+3.4)x45.1334
 ..........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 ...........\vbox(13.74443+0.0)x45.1334
@@ -322,11 +322,11 @@ l. ...}
 ..............\glue 3.0
 .............\rule(*+*)x0.4
 ............\rule(0.4+0.0)x*
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -45.1334
 .......\kern -45.41116
 .......\hbox(10.34444+3.4)x45.41116, shifted -3.4
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\hbox(10.34444+3.4)x45.41116
 .........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ..........\vbox(13.74443+0.0)x45.41116
@@ -351,36 +351,36 @@ l. ...}
 .............\glue 3.0
 ............\rule(*+*)x0.4
 ...........\rule(0.4+0.0)x*
-........\special{color pop}
+........\special{pdf:ecolor}
 .......\kern 45.1334
 ......\kern -90.54457
 ......\kern -0.5
 ......\hbox(1.0+0.0)x1.0, shifted 0.5
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern -11.61815
 .....\hbox(3.75+1.25)x9.61815, shifted 5.75
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 l
 ......\OT1/cmss/m/n/5 ,
 ......\OT1/cmss/m/n/5 b
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.77228
 ....\hbox(1.0+0.0)x1.0, shifted -6.37222
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 37.51178
 ...\hbox(3.75+1.25)x15.52101, shifted -5.62222
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 h
 ....\OT1/cmss/m/n/5 c
@@ -388,7 +388,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 v
 ....\OT1/cmss/m/n/5 c
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -412,7 +412,7 @@ l. ...}
 ..........\kern 0.0
 ..........\kern 0.0
 ..........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-...........\special{color push gray 0}
+...........\special{pdf:bcolor [0]}
 ...........\hbox(10.34444+3.4)x45.1334
 ............\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .............\vbox(13.74443+0.0)x45.1334
@@ -434,11 +434,11 @@ l. ...}
 ................\glue 3.0
 ...............\rule(*+*)x0.4
 ..............\rule(0.4+0.0)x*
-...........\special{color pop}
+...........\special{pdf:ecolor}
 .........\kern -45.1334
 .........\kern -45.41116
 .........\hbox(10.34444+3.4)x45.41116, shifted -3.4
-..........\special{color push gray 0}
+..........\special{pdf:bcolor [0]}
 ..........\hbox(10.34444+3.4)x45.41116
 ...........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ............\vbox(13.74443+0.0)x45.41116
@@ -463,36 +463,36 @@ l. ...}
 ...............\glue 3.0
 ..............\rule(*+*)x0.4
 .............\rule(0.4+0.0)x*
-..........\special{color pop}
+..........\special{pdf:ecolor}
 .........\kern 45.1334
 ........\kern -90.54457
 ........\kern -0.5
 ........\hbox(1.0+0.0)x1.0, shifted 0.5
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(1.0+0.0)x1.0
 ..........\rule(1.0+0.0)x1.0
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -90.54457
 .......\kern -11.61815
 .......\hbox(3.75+1.25)x9.61815, shifted 5.75
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\OT1/cmss/m/n/5 (
 ........\OT1/cmss/m/n/5 l
 ........\OT1/cmss/m/n/5 ,
 ........\OT1/cmss/m/n/5 b
 ........\OT1/cmss/m/n/5 )
-........\special{color pop}
+........\special{pdf:ecolor}
 ......\kern -90.54457
 ......\kern 44.77228
 ......\hbox(1.0+0.0)x1.0, shifted -6.37222
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern 37.51178
 .....\hbox(3.75+1.25)x15.52101, shifted -5.62222
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 h
 ......\OT1/cmss/m/n/5 c
@@ -500,18 +500,18 @@ l. ...}
 ......\OT1/cmss/m/n/5 v
 ......\OT1/cmss/m/n/5 c
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.91116
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 46.41116
 ...\hbox(3.75+1.25)x23.78499, shifted 1.25
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 \
 ....\OT1/cmss/m/n/5 1
@@ -523,7 +523,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 -
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -565,7 +565,7 @@ TEST 6: Rotation
 .....\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .....\hbox(6.94444+0.0)x0.0
 ......\hbox(6.94444+0.0)x50.02786
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\OT1/cmr/m/n/10 H
 .......\OT1/cmr/m/n/10 e
 .......\OT1/cmr/m/n/10 l
@@ -578,7 +578,7 @@ TEST 6: Rotation
 .......\OT1/cmr/m/n/10 r
 .......\OT1/cmr/m/n/10 l
 .......\OT1/cmr/m/n/10 d
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\special{pdf:literal Q}
 ! OK.
 <argument> \aaa 
@@ -621,7 +621,7 @@ l. ...  }
 ...........\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 ...........\hbox(6.94444+0.0)x0.0
 ............\hbox(6.94444+0.0)x50.02786
-.............\special{color push gray 0}
+.............\special{pdf:bcolor [0]}
 .............\OT1/cmr/m/n/10 H
 .............\OT1/cmr/m/n/10 e
 .............\OT1/cmr/m/n/10 l
@@ -634,7 +634,7 @@ l. ...  }
 .............\OT1/cmr/m/n/10 r
 .............\OT1/cmr/m/n/10 l
 .............\OT1/cmr/m/n/10 d
-.............\special{color pop}
+.............\special{pdf:ecolor}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
 ! OK.
@@ -688,7 +688,7 @@ l. ...  }
 .................\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .................\hbox(6.94444+0.0)x0.0
 ..................\hbox(6.94444+0.0)x50.02786
-...................\special{color push gray 0}
+...................\special{pdf:bcolor [0]}
 ...................\OT1/cmr/m/n/10 H
 ...................\OT1/cmr/m/n/10 e
 ...................\OT1/cmr/m/n/10 l
@@ -701,7 +701,7 @@ l. ...  }
 ...................\OT1/cmr/m/n/10 r
 ...................\OT1/cmr/m/n/10 l
 ...................\OT1/cmr/m/n/10 d
-...................\special{color pop}
+...................\special{pdf:ecolor}
 .................\special{pdf:literal Q}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
@@ -737,7 +737,7 @@ TEST 7: Scaling
 ...\special{pdf:literal 1 0 0 1.1 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -750,7 +750,7 @@ TEST 7: Scaling
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
@@ -789,7 +789,7 @@ l. ...  }
 .......\special{pdf:literal 1 0 0 1.1 0 0 cm}
 .......\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ........\hbox(6.94444+0.0)x50.02786
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\OT1/cmr/m/n/10 H
 .........\OT1/cmr/m/n/10 e
 .........\OT1/cmr/m/n/10 l
@@ -802,7 +802,7 @@ l. ...  }
 .........\OT1/cmr/m/n/10 r
 .........\OT1/cmr/m/n/10 l
 .........\OT1/cmr/m/n/10 d
-.........\special{color pop}
+.........\special{pdf:ecolor}
 ........\glue 0.0 plus 1.0fil minus 1.0fil
 .......\special{pdf:literal Q}
 ......\glue 0.0 plus 1.0fil minus 1.0fil
@@ -841,7 +841,7 @@ TEST 8: Resizing
 ...\special{pdf:literal 0.56874 0 0 8.19439 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -854,7 +854,7 @@ TEST 8: Resizing
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
diff --git a/l3kernel/testfiles/m3coffins001.uptex.tlg b/l3kernel/testfiles/m3coffins001.uptex.tlg
index 8b4d0b6..81c8c8a 100644
--- a/l3kernel/testfiles/m3coffins001.uptex.tlg
+++ b/l3kernel/testfiles/m3coffins001.uptex.tlg
@@ -213,7 +213,7 @@ LaTeX Font Info:    Font shape `JY2/mc/m/n' will be
 ......\kern 0.0
 ......\kern 0.0
 ......\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(10.34444+3.4)x45.1334
 ........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .........\vbox(13.74443+0.0)x45.1334
@@ -235,11 +235,11 @@ LaTeX Font Info:    Font shape `JY2/mc/m/n' will be
 ............\glue 3.0
 ...........\rule(*+*)x0.4
 ..........\rule(0.4+0.0)x*
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -45.1334
 .....\kern -45.41116
 .....\hbox(10.34444+3.4)x45.41116, shifted -3.4
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\hbox(10.34444+3.4)x45.41116
 .......\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ........\vbox(13.74443+0.0)x45.41116
@@ -264,25 +264,25 @@ LaTeX Font Info:    Font shape `JY2/mc/m/n' will be
 ...........\glue 3.0
 ..........\rule(*+*)x0.4
 .........\rule(0.4+0.0)x*
-......\special{color pop}
+......\special{pdf:ecolor}
 .....\kern 45.1334
 ....\kern -90.54457
 ....\kern -0.5
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern -11.61815
 ...\hbox(3.75+1.25)x9.61815, shifted 5.75
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 l
 ....\OT1/cmss/m/n/5 ,
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -304,7 +304,7 @@ l. ...}
 ........\kern 0.0
 ........\kern 0.0
 ........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(10.34444+3.4)x45.1334
 ..........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 ...........\vbox(13.74443+0.0)x45.1334
@@ -326,11 +326,11 @@ l. ...}
 ..............\glue 3.0
 .............\rule(*+*)x0.4
 ............\rule(0.4+0.0)x*
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -45.1334
 .......\kern -45.41116
 .......\hbox(10.34444+3.4)x45.41116, shifted -3.4
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\hbox(10.34444+3.4)x45.41116
 .........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ..........\vbox(13.74443+0.0)x45.41116
@@ -355,36 +355,36 @@ l. ...}
 .............\glue 3.0
 ............\rule(*+*)x0.4
 ...........\rule(0.4+0.0)x*
-........\special{color pop}
+........\special{pdf:ecolor}
 .......\kern 45.1334
 ......\kern -90.54457
 ......\kern -0.5
 ......\hbox(1.0+0.0)x1.0, shifted 0.5
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern -11.61815
 .....\hbox(3.75+1.25)x9.61815, shifted 5.75
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 l
 ......\OT1/cmss/m/n/5 ,
 ......\OT1/cmss/m/n/5 b
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.77228
 ....\hbox(1.0+0.0)x1.0, shifted -6.37222
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 37.51178
 ...\hbox(3.75+1.25)x15.52101, shifted -5.62222
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 h
 ....\OT1/cmss/m/n/5 c
@@ -392,7 +392,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 v
 ....\OT1/cmss/m/n/5 c
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -416,7 +416,7 @@ l. ...}
 ..........\kern 0.0
 ..........\kern 0.0
 ..........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-...........\special{color push gray 0}
+...........\special{pdf:bcolor [0]}
 ...........\hbox(10.34444+3.4)x45.1334
 ............\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .............\vbox(13.74443+0.0)x45.1334
@@ -438,11 +438,11 @@ l. ...}
 ................\glue 3.0
 ...............\rule(*+*)x0.4
 ..............\rule(0.4+0.0)x*
-...........\special{color pop}
+...........\special{pdf:ecolor}
 .........\kern -45.1334
 .........\kern -45.41116
 .........\hbox(10.34444+3.4)x45.41116, shifted -3.4
-..........\special{color push gray 0}
+..........\special{pdf:bcolor [0]}
 ..........\hbox(10.34444+3.4)x45.41116
 ...........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ............\vbox(13.74443+0.0)x45.41116
@@ -467,36 +467,36 @@ l. ...}
 ...............\glue 3.0
 ..............\rule(*+*)x0.4
 .............\rule(0.4+0.0)x*
-..........\special{color pop}
+..........\special{pdf:ecolor}
 .........\kern 45.1334
 ........\kern -90.54457
 ........\kern -0.5
 ........\hbox(1.0+0.0)x1.0, shifted 0.5
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(1.0+0.0)x1.0
 ..........\rule(1.0+0.0)x1.0
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -90.54457
 .......\kern -11.61815
 .......\hbox(3.75+1.25)x9.61815, shifted 5.75
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\OT1/cmss/m/n/5 (
 ........\OT1/cmss/m/n/5 l
 ........\OT1/cmss/m/n/5 ,
 ........\OT1/cmss/m/n/5 b
 ........\OT1/cmss/m/n/5 )
-........\special{color pop}
+........\special{pdf:ecolor}
 ......\kern -90.54457
 ......\kern 44.77228
 ......\hbox(1.0+0.0)x1.0, shifted -6.37222
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern 37.51178
 .....\hbox(3.75+1.25)x15.52101, shifted -5.62222
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 h
 ......\OT1/cmss/m/n/5 c
@@ -504,18 +504,18 @@ l. ...}
 ......\OT1/cmss/m/n/5 v
 ......\OT1/cmss/m/n/5 c
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.91116
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 46.41116
 ...\hbox(3.75+1.25)x23.78499, shifted 1.25
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 \
 ....\OT1/cmss/m/n/5 1
@@ -527,7 +527,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 -
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -569,7 +569,7 @@ TEST 6: Rotation
 .....\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .....\hbox(6.94444+0.0)x0.0
 ......\hbox(6.94444+0.0)x50.02786
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\OT1/cmr/m/n/10 H
 .......\OT1/cmr/m/n/10 e
 .......\OT1/cmr/m/n/10 l
@@ -582,7 +582,7 @@ TEST 6: Rotation
 .......\OT1/cmr/m/n/10 r
 .......\OT1/cmr/m/n/10 l
 .......\OT1/cmr/m/n/10 d
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\special{pdf:literal Q}
 ! OK.
 <argument> \aaa 
@@ -625,7 +625,7 @@ l. ...  }
 ...........\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 ...........\hbox(6.94444+0.0)x0.0
 ............\hbox(6.94444+0.0)x50.02786
-.............\special{color push gray 0}
+.............\special{pdf:bcolor [0]}
 .............\OT1/cmr/m/n/10 H
 .............\OT1/cmr/m/n/10 e
 .............\OT1/cmr/m/n/10 l
@@ -638,7 +638,7 @@ l. ...  }
 .............\OT1/cmr/m/n/10 r
 .............\OT1/cmr/m/n/10 l
 .............\OT1/cmr/m/n/10 d
-.............\special{color pop}
+.............\special{pdf:ecolor}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
 ! OK.
@@ -692,7 +692,7 @@ l. ...  }
 .................\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .................\hbox(6.94444+0.0)x0.0
 ..................\hbox(6.94444+0.0)x50.02786
-...................\special{color push gray 0}
+...................\special{pdf:bcolor [0]}
 ...................\OT1/cmr/m/n/10 H
 ...................\OT1/cmr/m/n/10 e
 ...................\OT1/cmr/m/n/10 l
@@ -705,7 +705,7 @@ l. ...  }
 ...................\OT1/cmr/m/n/10 r
 ...................\OT1/cmr/m/n/10 l
 ...................\OT1/cmr/m/n/10 d
-...................\special{color pop}
+...................\special{pdf:ecolor}
 .................\special{pdf:literal Q}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
@@ -741,7 +741,7 @@ TEST 7: Scaling
 ...\special{pdf:literal 1 0 0 1.1 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -754,7 +754,7 @@ TEST 7: Scaling
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
@@ -793,7 +793,7 @@ l. ...  }
 .......\special{pdf:literal 1 0 0 1.1 0 0 cm}
 .......\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ........\hbox(6.94444+0.0)x50.02786
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\OT1/cmr/m/n/10 H
 .........\OT1/cmr/m/n/10 e
 .........\OT1/cmr/m/n/10 l
@@ -806,7 +806,7 @@ l. ...  }
 .........\OT1/cmr/m/n/10 r
 .........\OT1/cmr/m/n/10 l
 .........\OT1/cmr/m/n/10 d
-.........\special{color pop}
+.........\special{pdf:ecolor}
 ........\glue 0.0 plus 1.0fil minus 1.0fil
 .......\special{pdf:literal Q}
 ......\glue 0.0 plus 1.0fil minus 1.0fil
@@ -845,7 +845,7 @@ TEST 8: Resizing
 ...\special{pdf:literal 0.56874 0 0 8.19439 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -858,7 +858,7 @@ TEST 8: Resizing
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
diff --git a/l3kernel/testfiles/m3coffins001.xetex.tlg b/l3kernel/testfiles/m3coffins001.xetex.tlg
index ca00891..84756d0 100644
--- a/l3kernel/testfiles/m3coffins001.xetex.tlg
+++ b/l3kernel/testfiles/m3coffins001.xetex.tlg
@@ -209,7 +209,7 @@ Defining \2 on line ...
 ......\kern 0.0
 ......\kern 0.0
 ......\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(10.34444+3.4)x45.1334
 ........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .........\vbox(13.74443+0.0)x45.1334
@@ -231,11 +231,11 @@ Defining \2 on line ...
 ............\glue 3.0
 ...........\rule(*+*)x0.4
 ..........\rule(0.4+0.0)x*
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -45.1334
 .....\kern -45.41116
 .....\hbox(10.34444+3.4)x45.41116, shifted -3.4
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\hbox(10.34444+3.4)x45.41116
 .......\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ........\vbox(13.74443+0.0)x45.41116
@@ -260,25 +260,25 @@ Defining \2 on line ...
 ...........\glue 3.0
 ..........\rule(*+*)x0.4
 .........\rule(0.4+0.0)x*
-......\special{color pop}
+......\special{pdf:ecolor}
 .....\kern 45.1334
 ....\kern -90.54457
 ....\kern -0.5
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern -11.61815
 ...\hbox(3.75+1.25)x9.61815, shifted 5.75
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 l
 ....\OT1/cmss/m/n/5 ,
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -300,7 +300,7 @@ l. ...}
 ........\kern 0.0
 ........\kern 0.0
 ........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(10.34444+3.4)x45.1334
 ..........\hbox(13.74443+0.0)x45.1334, shifted 3.4
 ...........\vbox(13.74443+0.0)x45.1334
@@ -322,11 +322,11 @@ l. ...}
 ..............\glue 3.0
 .............\rule(*+*)x0.4
 ............\rule(0.4+0.0)x*
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -45.1334
 .......\kern -45.41116
 .......\hbox(10.34444+3.4)x45.41116, shifted -3.4
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\hbox(10.34444+3.4)x45.41116
 .........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ..........\vbox(13.74443+0.0)x45.41116
@@ -351,36 +351,36 @@ l. ...}
 .............\glue 3.0
 ............\rule(*+*)x0.4
 ...........\rule(0.4+0.0)x*
-........\special{color pop}
+........\special{pdf:ecolor}
 .......\kern 45.1334
 ......\kern -90.54457
 ......\kern -0.5
 ......\hbox(1.0+0.0)x1.0, shifted 0.5
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern -11.61815
 .....\hbox(3.75+1.25)x9.61815, shifted 5.75
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 l
 ......\OT1/cmss/m/n/5 ,
 ......\OT1/cmss/m/n/5 b
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.77228
 ....\hbox(1.0+0.0)x1.0, shifted -6.37222
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 37.51178
 ...\hbox(3.75+1.25)x15.52101, shifted -5.62222
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 h
 ....\OT1/cmss/m/n/5 c
@@ -388,7 +388,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 v
 ....\OT1/cmss/m/n/5 c
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -412,7 +412,7 @@ l. ...}
 ..........\kern 0.0
 ..........\kern 0.0
 ..........\hbox(10.34444+3.4)x45.1334, shifted -3.4
-...........\special{color push gray 0}
+...........\special{pdf:bcolor [0]}
 ...........\hbox(10.34444+3.4)x45.1334
 ............\hbox(13.74443+0.0)x45.1334, shifted 3.4
 .............\vbox(13.74443+0.0)x45.1334
@@ -434,11 +434,11 @@ l. ...}
 ................\glue 3.0
 ...............\rule(*+*)x0.4
 ..............\rule(0.4+0.0)x*
-...........\special{color pop}
+...........\special{pdf:ecolor}
 .........\kern -45.1334
 .........\kern -45.41116
 .........\hbox(10.34444+3.4)x45.41116, shifted -3.4
-..........\special{color push gray 0}
+..........\special{pdf:bcolor [0]}
 ..........\hbox(10.34444+3.4)x45.41116
 ...........\hbox(13.74443+0.0)x45.41116, shifted 3.4
 ............\vbox(13.74443+0.0)x45.41116
@@ -463,36 +463,36 @@ l. ...}
 ...............\glue 3.0
 ..............\rule(*+*)x0.4
 .............\rule(0.4+0.0)x*
-..........\special{color pop}
+..........\special{pdf:ecolor}
 .........\kern 45.1334
 ........\kern -90.54457
 ........\kern -0.5
 ........\hbox(1.0+0.0)x1.0, shifted 0.5
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\hbox(1.0+0.0)x1.0
 ..........\rule(1.0+0.0)x1.0
-.........\special{color pop}
+.........\special{pdf:ecolor}
 .......\kern -90.54457
 .......\kern -11.61815
 .......\hbox(3.75+1.25)x9.61815, shifted 5.75
-........\special{color push gray 0}
+........\special{pdf:bcolor [0]}
 ........\OT1/cmss/m/n/5 (
 ........\OT1/cmss/m/n/5 l
 ........\OT1/cmss/m/n/5 ,
 ........\OT1/cmss/m/n/5 b
 ........\OT1/cmss/m/n/5 )
-........\special{color pop}
+........\special{pdf:ecolor}
 ......\kern -90.54457
 ......\kern 44.77228
 ......\hbox(1.0+0.0)x1.0, shifted -6.37222
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\hbox(1.0+0.0)x1.0
 ........\rule(1.0+0.0)x1.0
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\kern -90.54457
 .....\kern 37.51178
 .....\hbox(3.75+1.25)x15.52101, shifted -5.62222
-......\special{color push gray 0}
+......\special{pdf:bcolor [0]}
 ......\OT1/cmss/m/n/5 (
 ......\OT1/cmss/m/n/5 h
 ......\OT1/cmss/m/n/5 c
@@ -500,18 +500,18 @@ l. ...}
 ......\OT1/cmss/m/n/5 v
 ......\OT1/cmss/m/n/5 c
 ......\OT1/cmss/m/n/5 )
-......\special{color pop}
+......\special{pdf:ecolor}
 ....\kern -90.54457
 ....\kern 44.91116
 ....\hbox(1.0+0.0)x1.0, shifted 0.5
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\hbox(1.0+0.0)x1.0
 ......\rule(1.0+0.0)x1.0
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ...\kern -90.54457
 ...\kern 46.41116
 ...\hbox(3.75+1.25)x23.78499, shifted 1.25
-....\special{color push gray 0}
+....\special{pdf:bcolor [0]}
 ....\OT1/cmss/m/n/5 (
 ....\OT1/cmss/m/n/5 \
 ....\OT1/cmss/m/n/5 1
@@ -523,7 +523,7 @@ l. ...}
 ....\OT1/cmss/m/n/5 -
 ....\OT1/cmss/m/n/5 b
 ....\OT1/cmss/m/n/5 )
-....\special{color pop}
+....\special{pdf:ecolor}
 ! OK.
 <argument> \zzz 
 l. ...}
@@ -565,7 +565,7 @@ TEST 6: Rotation
 .....\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .....\hbox(6.94444+0.0)x0.0
 ......\hbox(6.94444+0.0)x50.02786
-.......\special{color push gray 0}
+.......\special{pdf:bcolor [0]}
 .......\OT1/cmr/m/n/10 H
 .......\OT1/cmr/m/n/10 e
 .......\OT1/cmr/m/n/10 l
@@ -578,7 +578,7 @@ TEST 6: Rotation
 .......\OT1/cmr/m/n/10 r
 .......\OT1/cmr/m/n/10 l
 .......\OT1/cmr/m/n/10 d
-.......\special{color pop}
+.......\special{pdf:ecolor}
 .....\special{pdf:literal Q}
 ! OK.
 <argument> \aaa 
@@ -621,7 +621,7 @@ l. ...  }
 ...........\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 ...........\hbox(6.94444+0.0)x0.0
 ............\hbox(6.94444+0.0)x50.02786
-.............\special{color push gray 0}
+.............\special{pdf:bcolor [0]}
 .............\OT1/cmr/m/n/10 H
 .............\OT1/cmr/m/n/10 e
 .............\OT1/cmr/m/n/10 l
@@ -634,7 +634,7 @@ l. ...  }
 .............\OT1/cmr/m/n/10 r
 .............\OT1/cmr/m/n/10 l
 .............\OT1/cmr/m/n/10 d
-.............\special{color pop}
+.............\special{pdf:ecolor}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
 ! OK.
@@ -688,7 +688,7 @@ l. ...  }
 .................\special{pdf:literal 0.70711 0.70711 -0.70711 0.70711 0 0 cm}
 .................\hbox(6.94444+0.0)x0.0
 ..................\hbox(6.94444+0.0)x50.02786
-...................\special{color push gray 0}
+...................\special{pdf:bcolor [0]}
 ...................\OT1/cmr/m/n/10 H
 ...................\OT1/cmr/m/n/10 e
 ...................\OT1/cmr/m/n/10 l
@@ -701,7 +701,7 @@ l. ...  }
 ...................\OT1/cmr/m/n/10 r
 ...................\OT1/cmr/m/n/10 l
 ...................\OT1/cmr/m/n/10 d
-...................\special{color pop}
+...................\special{pdf:ecolor}
 .................\special{pdf:literal Q}
 ...........\special{pdf:literal Q}
 .....\special{pdf:literal Q}
@@ -737,7 +737,7 @@ TEST 7: Scaling
 ...\special{pdf:literal 1 0 0 1.1 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -750,7 +750,7 @@ TEST 7: Scaling
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
@@ -789,7 +789,7 @@ l. ...  }
 .......\special{pdf:literal 1 0 0 1.1 0 0 cm}
 .......\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ........\hbox(6.94444+0.0)x50.02786
-.........\special{color push gray 0}
+.........\special{pdf:bcolor [0]}
 .........\OT1/cmr/m/n/10 H
 .........\OT1/cmr/m/n/10 e
 .........\OT1/cmr/m/n/10 l
@@ -802,7 +802,7 @@ l. ...  }
 .........\OT1/cmr/m/n/10 r
 .........\OT1/cmr/m/n/10 l
 .........\OT1/cmr/m/n/10 d
-.........\special{color pop}
+.........\special{pdf:ecolor}
 ........\glue 0.0 plus 1.0fil minus 1.0fil
 .......\special{pdf:literal Q}
 ......\glue 0.0 plus 1.0fil minus 1.0fil
@@ -841,7 +841,7 @@ TEST 8: Resizing
 ...\special{pdf:literal 0.56874 0 0 8.19439 0 0 cm}
 ...\hbox(6.94444+0.0)x0.0, glue set - 50.02786fil
 ....\hbox(6.94444+0.0)x50.02786
-.....\special{color push gray 0}
+.....\special{pdf:bcolor [0]}
 .....\OT1/cmr/m/n/10 H
 .....\OT1/cmr/m/n/10 e
 .....\OT1/cmr/m/n/10 l
@@ -854,7 +854,7 @@ TEST 8: Resizing
 .....\OT1/cmr/m/n/10 r
 .....\OT1/cmr/m/n/10 l
 .....\OT1/cmr/m/n/10 d
-.....\special{color pop}
+.....\special{pdf:ecolor}
 ....\glue 0.0 plus 1.0fil minus 1.0fil
 ...\special{pdf:literal Q}
 ..\glue 0.0 plus 1.0fil minus 1.0fil
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index b22de7d..b2dddca 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -4776,20 +4776,20 @@ Defining key expl/check-declarations on line ...
 Defining key expl/log-functions on line ...
 Defining \c__expl_def_ext_tl on line ...
  (l3pdfmode.def
-Defining \__driver_state_save: on line ...
-Defining \__driver_state_restore: on line ...
 Defining \__driver_literal:n on line ...
+Defining \__driver_scope_begin: on line ...
+Defining \__driver_scope_end: on line ...
 Defining \__driver_matrix:n on line ...
-Defining \__driver_box_use_clip:N on line ...
-Defining \__driver_box_rotate_begin: on line ...
-Defining \__driver_box_rotate_end: on line ...
-Defining \__driver_box_scale_begin: on line ...
-Defining \__driver_box_scale_end: on line ...
 Defining \l__driver_current_color_tl on line ...
 Defining \l__driver_color_stack_int on line ...
 \l__driver_color_stack_int=\count134
 Defining \__driver_color_ensure_current: on line ...
 Defining \__driver_color_reset: on line ...
+Defining \__driver_box_use_clip:N on line ...
+Defining \__driver_box_use_rotate:Nn on line ...
+Defining \l__driver_cos_fp on line ...
+Defining \l__driver_sin_fp on line ...
+Defining \__driver_box_use_scale:Nnn on line ...
 )
 Defining \__expl_status_pop:w on line ...
 Defining \l__expl_status_stack_tl on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index fac7ee0..8d5353c 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -4767,18 +4767,18 @@ Defining key expl/check-declarations on line ...
 Defining key expl/log-functions on line ...
 Defining \c__expl_def_ext_tl on line ...
  (l3dvipdfmx.def
-Defining \__driver_state_save: on line ...
-Defining \__driver_state_restore: on line ...
 Defining \__driver_literal:n on line ...
+Defining \__driver_scope_begin: on line ...
+Defining \__driver_scope_end: on line ...
 Defining \__driver_matrix:n on line ...
-Defining \__driver_box_use_clip:N on line ...
-Defining \__driver_box_rotate_begin: on line ...
-Defining \__driver_box_rotate_end: on line ...
-Defining \__driver_box_scale_begin: on line ...
-Defining \__driver_box_scale_end: on line ...
 Defining \l__driver_current_color_tl on line ...
 Defining \__driver_color_ensure_current: on line ...
 Defining \__driver_color_reset: on line ...
+Defining \__driver_box_use_clip:N on line ...
+Defining \__driver_box_use_rotate:Nn on line ...
+Defining \l__driver_cos_fp on line ...
+Defining \l__driver_sin_fp on line ...
+Defining \__driver_box_use_scale:Nnn on line ...
 )
 Defining \__expl_status_pop:w on line ...
 Defining \l__expl_status_stack_tl on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index d62110a..dd91ad6 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -4968,20 +4968,20 @@ Defining key expl/check-declarations on line ...
 Defining key expl/log-functions on line ...
 Defining \c__expl_def_ext_tl on line ...
  (l3pdfmode.def
-Defining \__driver_state_save: on line ...
-Defining \__driver_state_restore: on line ...
 Defining \__driver_literal:n on line ...
+Defining \__driver_scope_begin: on line ...
+Defining \__driver_scope_end: on line ...
 Defining \__driver_matrix:n on line ...
-Defining \__driver_box_use_clip:N on line ...
-Defining \__driver_box_rotate_begin: on line ...
-Defining \__driver_box_rotate_end: on line ...
-Defining \__driver_box_scale_begin: on line ...
-Defining \__driver_box_scale_end: on line ...
 Defining \l__driver_current_color_tl on line ...
 Defining \l__driver_color_stack_int on line ...
 \l__driver_color_stack_int=\count134
 Defining \__driver_color_ensure_current: on line ...
 Defining \__driver_color_reset: on line ...
+Defining \__driver_box_use_clip:N on line ...
+Defining \__driver_box_use_rotate:Nn on line ...
+Defining \l__driver_cos_fp on line ...
+Defining \l__driver_sin_fp on line ...
+Defining \__driver_box_use_scale:Nnn on line ...
 )
 Defining \__expl_status_pop:w on line ...
 Defining \l__expl_status_stack_tl on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 636d052..97bcd8c 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -4968,18 +4968,18 @@ Defining key expl/check-declarations on line ...
 Defining key expl/log-functions on line ...
 Defining \c__expl_def_ext_tl on line ...
  (l3dvipdfmx.def
-Defining \__driver_state_save: on line ...
-Defining \__driver_state_restore: on line ...
 Defining \__driver_literal:n on line ...
+Defining \__driver_scope_begin: on line ...
+Defining \__driver_scope_end: on line ...
 Defining \__driver_matrix:n on line ...
-Defining \__driver_box_use_clip:N on line ...
-Defining \__driver_box_rotate_begin: on line ...
-Defining \__driver_box_rotate_end: on line ...
-Defining \__driver_box_scale_begin: on line ...
-Defining \__driver_box_scale_end: on line ...
 Defining \l__driver_current_color_tl on line ...
 Defining \__driver_color_ensure_current: on line ...
 Defining \__driver_color_reset: on line ...
+Defining \__driver_box_use_clip:N on line ...
+Defining \__driver_box_use_rotate:Nn on line ...
+Defining \l__driver_cos_fp on line ...
+Defining \l__driver_sin_fp on line ...
+Defining \__driver_box_use_scale:Nnn on line ...
 )
 Defining \__expl_status_pop:w on line ...
 Defining \l__expl_status_stack_tl on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 958ae41..e4bae42 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -4774,18 +4774,18 @@ Defining key expl/check-declarations on line ...
 Defining key expl/log-functions on line ...
 Defining \c__expl_def_ext_tl on line ...
  (l3xdvipdfmx.def
-Defining \__driver_state_save: on line ...
-Defining \__driver_state_restore: on line ...
 Defining \__driver_literal:n on line ...
+Defining \__driver_scope_begin: on line ...
+Defining \__driver_scope_end: on line ...
 Defining \__driver_matrix:n on line ...
-Defining \__driver_box_use_clip:N on line ...
-Defining \__driver_box_rotate_begin: on line ...
-Defining \__driver_box_rotate_end: on line ...
-Defining \__driver_box_scale_begin: on line ...
-Defining \__driver_box_scale_end: on line ...
 Defining \l__driver_current_color_tl on line ...
 Defining \__driver_color_ensure_current: on line ...
 Defining \__driver_color_reset: on line ...
+Defining \__driver_box_use_clip:N on line ...
+Defining \__driver_box_use_rotate:Nn on line ...
+Defining \l__driver_cos_fp on line ...
+Defining \l__driver_sin_fp on line ...
+Defining \__driver_box_use_scale:Nnn on line ...
 )
 Defining \__expl_status_pop:w on line ...
 Defining \l__expl_status_stack_tl on line ...

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list