[latex3-commits] [git/LaTeX3-latex3-latex3] main: Use a common auxiliary for page resources (681815acc)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Apr 19 16:05:47 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/681815acc22ba57f1488051e3b69482e351ab547

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

commit 681815acc22ba57f1488051e3b69482e351ab547
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Apr 19 15:02:59 2022 +0100

    Use a common auxiliary for page resources


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

681815acc22ba57f1488051e3b69482e351ab547
 l3backend/l3backend-color.dtx           | 71 ++++++++++++---------------------
 l3kernel/testfiles/m3expl001.luatex.tlg |  1 +
 l3kernel/testfiles/m3expl001.tlg        |  1 +
 l3kernel/testfiles/m3expl001.xetex.tlg  |  1 +
 l3kernel/testfiles/m3expl003.luatex.tlg |  1 +
 l3kernel/testfiles/m3expl003.tlg        |  1 +
 l3kernel/testfiles/m3expl003.xetex.tlg  |  1 +
 7 files changed, 32 insertions(+), 45 deletions(-)

diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 99a40a72f..e96b50783 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -885,6 +885,27 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_backend_init_resource:n}
+%   Resource initiation comes up a few times.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_init_resource:n #1
+  {
+    \bool_lazy_and:nnT
+      { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
+      { \pdfmanagement_if_active_p: }
+      {
+        \use:x
+          {
+            \pdfmanagement_add:nnn
+              { Page / Resources / ColorSpace }
+              { #1 }
+              { \pdf_object_ref_last: }
+          }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@@_backend_separation_init:nnnnn}
 % \begin{macro}{\@@_backend_separation_init:nn}
 % \begin{macro}{\@@_backend_separation_init_CIELAB:nnn}
@@ -905,18 +926,7 @@
       }
     \exp_args:Nx \@@_backend_separation_init:nn
       { \str_convert_pdfname:n {#1} } {#2}
-    \bool_lazy_and:nnT
-      { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
-      { \pdfmanagement_if_active_p: }
-      {
-        \use:x
-          {
-            \pdfmanagement_add:nnn
-              { Page / Resources / ColorSpace }
-              { color \int_use:N \g_@@_model_int }
-              { \pdf_object_ref_last: }
-          }
-      }
+    \@@_backend_init_resource:n { color \int_use:N \g_@@_model_int }
   }
 \cs_new_protected:Npn \@@_backend_separation_init:nn #1#2
   {
@@ -993,18 +1003,7 @@
         \pdf_object_ref_last:
         \@@_backend_devicen_colorants:n {#1}
       }
-    \bool_lazy_and:nnT
-      { \cs_if_exist_p:N \pdfmanagement_if_active_p: }
-      { \pdfmanagement_if_active_p: }
-      {
-        \use:x
-          {
-            \pdfmanagement_add:nnn
-              { Page / Resources / ColorSpace }
-              { color \int_use:N \g_@@_model_int }
-              { \pdf_object_ref_last: }
-          }
-      }
+    \@@_backend_init_resource:n { color \int_use:N \g_@@_model_int }
   }
 \cs_new:Npn \@@_backend_devicen_init:w #1 ~ #2 \s_@@_stop
   {
@@ -1036,23 +1035,14 @@
       }
     \pdf_object_unnamed_write:nx { array }
       { /ICCBased ~ \pdf_object_ref:n { @@_icc_ #1 } }
-    \cs_if_exist:NT \pdfmanagement_add:nnn
-      {
-        \use:x
-          {
-            \pdfmanagement_add:nnn { Page / Resources / ColorSpace }
-              { color \int_use:N \g_@@_model_int }
-              { ~ \pdf_object_ref_last: }
-          }
-      }
+    \@@_backend_init_resource:n { color \int_use:N \g_@@_model_int }
   }
 %    \end{macrocode}
 % \end{macro}
-
 %
 % \begin{macro}{\@@_backend_iccbased_device:nnn}
 %   This is very similar to setting up a color space: the only part we
-%   skip is adding it to the page resources.
+%   add to the page resources differently.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_backend_iccbased_device:nnn #1#2#3
   {
@@ -1067,16 +1057,7 @@
       }
     \pdf_object_unnamed_write:nx { array }
       { /ICCBased ~ \pdf_object_ref:n { @@_icc_ #1 } }
-    \cs_if_exist:NT \pdfmanagement_add:nnn
-      {
-        \use:x
-          {
-            \pdfmanagement_add:nnn
-              { Page / Resources / ColorSpace }
-              { Default #2 }
-              { \pdf_object_ref_last: }
-          }
-      }
+    \@@_backend_init_resource:n { Default #2 }
   }
 %    \end{macrocode}
 % \end{macro} 
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index a5862c380..1166bd352 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -47,6 +47,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 8c4df0b9e..3b759e4de 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -47,6 +47,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index f8c4f7a0b..d023bed3a 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -51,6 +51,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index a5862c380..1166bd352 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -47,6 +47,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 8c4df0b9e..3b759e4de 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -47,6 +47,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index f8c4f7a0b..d023bed3a 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -51,6 +51,7 @@ Defining \__color_backend_devicen_colorants:w on line ...
 Defining \__color_backend_select_separation:nn on line ...
 Defining \__color_backend_select_devicen:nn on line ...
 Defining \__color_backend_select_iccbased:nn on line ...
+Defining \__color_backend_init_resource:n on line ...
 Defining \__color_backend_separation_init:nnnnn on line ...
 Defining \__color_backend_separation_init:nn on line ...
 Defining \__color_backend_separation_init_CIELAB:nnn on line ...





More information about the latex3-commits mailing list.