[latex3-commits] [git/LaTeX3-latex3-latex3] dvipdfmx-color: Add "pdfcolorstack n current" to (x)dvipdfmx scopes (be897a9fa)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Mar 17 11:49:44 CET 2021


Repository : https://github.com/latex3/latex3
On branch  : dvipdfmx-color
Link       : https://github.com/latex3/latex3/commit/be897a9faef083833efc30fb0b755d59bc7c4e74

>---------------------------------------------------------------

commit be897a9faef083833efc30fb0b755d59bc7c4e74
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Mar 17 10:49:44 2021 +0000

    Add "pdfcolorstack n current" to (x)dvipdfmx scopes


>---------------------------------------------------------------

be897a9faef083833efc30fb0b755d59bc7c4e74
 l3backend/CHANGELOG.md        |  3 +++
 l3backend/l3backend-color.dtx | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index ed6da43a3..4152526f4 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Fixed
+- Maintain stack color correctly with `(x)dvipdfmx`
+
 ## [2021-03-02]
 
 ### Changed
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 50271f57b..84cc7def3 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -240,6 +240,17 @@
           \c_@@_backend_main_stack_int
         \int_const:cn { main at pdfcolorstack } { \c_@@_backend_main_stack_int }
       }
+%    \end{macrocode}
+%   The backend automatically restores the stack color from the \enquote{classical}
+%   approach (\texttt{pdf:bcolor}) after a scope. That will be an issue for us, so
+%   we manually ensure that the one we are using is inserted.
+%    \begin{macrocode}
+    \cs_gset_protected:Npn \__kernel_backend_scope_end:
+      {
+        \__kernel_backend_literal:n { x:grestore }
+        \__kernel_backend_literal:n
+          { pdfcolorstack ~ \g_@@_backend_stack_int current }
+      }
   }
 %    \end{macrocode}
 % \end{variable}





More information about the latex3-commits mailing list.