[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add support for init of color stacks (84ebc709d)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Dec 9 00:17:21 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/84ebc709d2158046458d7d636952809ccf6ae37e

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

commit 84ebc709d2158046458d7d636952809ccf6ae37e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Dec 8 23:17:21 2020 +0000

    Add support for init of color stacks


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

84ebc709d2158046458d7d636952809ccf6ae37e
 l3backend/l3backend-color.dtx | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index a25575151..59dca8eff 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -179,6 +179,33 @@
 %<*dvipdfmx|xetex>
 %    \end{macrocode}
 %
+% \begin{macro}{\__kernel_color_stack_init:Nnn}
+% \begin{variable}{\g__color_stack_int}
+%   In \texttt{(x)dvipdfmx}, the base color stack is not set up, so we have to
+%   force that, as well as providing a mechanism more generally.
+%    \begin{macrocode}
+\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+  {
+    \int_new:N \g__color_stack_int
+    \cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+      {
+        \int_gincr:N \g__color_stack_int
+        \int_gset_eq:NN #1 \g__color_stack_int
+        \__kernel_backend_literal:x
+          {
+            pdfcolorstackinit ~
+            \int_use:N \g__color_stack_int \c_space_tl
+            \tl_if_blank:nF {#2} { #2 ~ }
+            (#3)
+          }
+      }
+    \__kernel_backend_literal:n
+      { pdfcolorstackinit ~ 0 ~ page ~ direct ~ ( 0~g ) }
+  }
+%    \end{macrocode}
+% \end{variable}
+% \end{macro}
+%
 % \begin{macro}{\__kernel_color_stack_push:nn}
 % \begin{macro}{\__kernel_color_stack_pop:n}
 %   Simple enough but needs a version check.
@@ -218,6 +245,20 @@
 %<*luatex>
 %    \end{macrocode}
 %
+% \begin{macro}{\__kernel_color_stack_init:Nnn}
+%    \begin{macrocode}
+\cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+  {
+    \int_set:Nn #1
+      {
+        \tex_pdfextension:D colorstackinit ~
+        \tl_if_blank:nF {#2} { ~ #2 }
+        {#3}
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\__kernel_color_stack_push:nn}
 % \begin{macro}{\__kernel_color_stack_pop:n}
 %    \begin{macrocode}
@@ -245,6 +286,20 @@
 %<*pdftex>
 %    \end{macrocode}
 %
+% \begin{macro}{\__kernel_color_stack_init:Nnn}
+%    \begin{macrocode}
+\cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+  {
+    \int_set:Nn #1
+      {
+        \tex_pdfcolorstackinit ~
+        \tl_if_blank:nF {#2} { ~ #2 }
+        {#3}
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\__kernel_color_stack_push:nn}
 % \begin{macro}{\__kernel_color_stack_pop:n}
 %    \begin{macrocode}





More information about the latex3-commits mailing list.