[latex3-commits] [git/LaTeX3-latex3-pdfresources] colorspace-firstaid: WIP colorspace firstaid (14fe786)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Apr 19 20:10:51 CEST 2022


Repository : https://github.com/latex3/pdfresources
On branch  : colorspace-firstaid
Link       : https://github.com/latex3/pdfresources/commit/14fe786cf0a774c365c513c26c21e00056253fb1

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

commit 14fe786cf0a774c365c513c26c21e00056253fb1
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Apr 19 20:10:51 2022 +0200

    WIP colorspace firstaid


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

14fe786cf0a774c365c513c26c21e00056253fb1
 firstaid/colorspace-patches-tmp-ltx.sty | 85 +++++++++++++++++++++++++++++++++
 pdfmanagement-firstaid.dtx              | 48 +++----------------
 2 files changed, 92 insertions(+), 41 deletions(-)

diff --git a/firstaid/colorspace-patches-tmp-ltx.sty b/firstaid/colorspace-patches-tmp-ltx.sty
new file mode 100644
index 0000000..85da81a
--- /dev/null
+++ b/firstaid/colorspace-patches-tmp-ltx.sty
@@ -0,0 +1,85 @@
+%% This is file `hyperxmp-patches-tmp-ltx.sty"
+% Copyright (C) 2019-2021 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version.  The latest version
+% of this license is in the file
+%
+%    https://www.latex-project.org/lppl.txt
+%
+% This file is part of the "pdfmanagement bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+%    https://github.com/latex3/pdfresources
+%
+% for those people who are interested.
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+\ProvidesExplPackage{colorspace-patches-tmp-ltx}{2022-04-14}{0.95n}
+  {temporay patches to for the colorspace package to test pdfresource management ... UF}
+
+\hook_gput_code:nnn {begindocument} {pdf}
+  {
+    \tl_if_exist:NT \spc at op
+      {
+        \def\spc at Pageresources#1{}
+      }
+
+  }
+
+\hook_gput_code:nnn {begindocument/end} {pdf}
+  {
+    \tl_if_exist:NT \spc at op
+      {
+        \__pdf_backend_object_new:nn  {__spc_extgstate_op_false}{dict}
+        \__pdf_backend_object_write:nn
+          {__spc_extgstate_op_false}
+          {/Type /ExtGState~/op~false~/OP~false}
+        \pdfmanagement_add:nnn
+          {Page/Resources/ExtGState}
+          {SPCko}
+          {\__pdf_backend_object_ref:n {__spc_extgstate_op_false}}
+        \__pdf_backend_object_new:nn  {__spc_extgstate_op_true0}{dict}
+        \__pdf_backend_object_write:nn
+          {__spc_extgstate_op_true0}
+          {/Type /ExtGState~/op~true~/OP~true~/OPM~0}%
+        \pdfmanagement_add:nnn
+          {Page/Resources/ExtGState}
+          {SPCmz}
+          {\__pdf_backend_object_ref:n {__spc_extgstate_op_true0}}
+        \__pdf_backend_object_new:nn  {__spc_extgstate_op_true1}{dict}
+        \__pdf_backend_object_write:nn
+          {__spc_extgstate_op_true1}
+          {/Type /ExtGState~/op~true~/OP~true~/OPM~1}%
+         \pdfmanagement_add:nnn
+          {Page/Resources/ExtGState}
+          {SPCop}
+          {\__pdf_backend_object_ref:n {__spc_extgstate_op_true1}}
+      }
+  }
+
+\RemoveFromHook{begindocument}[colorspace]
+
+\hook_gput_code:nnn {enddocument} {pdf}
+ {
+  \def\spc at elt#1#2
+   {
+    \str_set_eq:Nc\l_tmpa_str {spc at ir@#2}
+    \seq_set_split:NnV \l_tmpa_seq {~}\l_tmpa_str
+    \seq_get_left:NN\l_tmpa_seq\l_tmpa_str
+    %remove spaces
+    \exp_args:NNx
+    \str_replace_all:Nnn\l_tmpa_str {\c_hash_str20}{~}
+    %remove slash
+    \str_set:Nx\l_tmpa_str{\str_tail:N\l_tmpa_str}
+    \pdfmanagement_add:nex
+      {Page/Resources/ColorSpace}{\l_tmpa_str}{\seq_item:Nn\l_tmpa_seq{2}~0~R}
+   }
+   \spc at csall
+ }
+
+\endinput
diff --git a/pdfmanagement-firstaid.dtx b/pdfmanagement-firstaid.dtx
index 15fc8cf..0fc1fe9 100644
--- a/pdfmanagement-firstaid.dtx
+++ b/pdfmanagement-firstaid.dtx
@@ -68,7 +68,7 @@
   {LaTeX PDF management testphase bundle / firstaid-patches}
 
 %<@@=pdfmanagement>
-\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color,beamer,output}
+\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color,beamer,output,colorspace}
   {
     \bool_new:c       { g_@@_firstaid_#1_bool }
     \bool_gset_true:c { g_@@_firstaid_#1_bool }
@@ -291,48 +291,14 @@
 % as colorspace uses temporary macros whose contents is lost.
 %    \begin{macrocode}
 %<*package>
-%<@@=pdf>
-% this must be earlier, to avoid problems with luatex which has two pageresources
-% lua/tex
-\hook_gput_code:nnn {begindocument} {pdf}
-  {
-    \tl_if_exist:NT \spc at op
-      {
-        \def\spc at Pageresources#1{}
-      }
-
-  }
-
-\hook_gput_code:nnn {begindocument/end} {pdf}
-  {
-    \tl_if_exist:NT \spc at op
+\bool_if:NT \g_@@_firstaid_colorspace_bool
+ {
+    \AddToHook
       {
-        \@@_backend_object_new:nn  {__spc_extgstate_op_false}{dict}
-        \@@_backend_object_write:nn
-          {__spc_extgstate_op_false}
-          {/Type /ExtGState~/op~false~/OP~false}
-        \pdfmanagement_add:nnn
-          {Page/Resources/ExtGState}
-          {SPCko}
-          {\@@_backend_object_ref:n {__spc_extgstate_op_false}}
-        \@@_backend_object_new:nn  {__spc_extgstate_op_true0}{dict}
-        \@@_backend_object_write:nn
-          {__spc_extgstate_op_true0}
-          {/Type /ExtGState~/op~true~/OP~true~/OPM~0}%
-        \pdfmanagement_add:nnn
-          {Page/Resources/ExtGState}
-          {SPCmz}
-          {\@@_backend_object_ref:n {__spc_extgstate_op_true0}}
-        \@@_backend_object_new:nn  {__spc_extgstate_op_true1}{dict}
-        \@@_backend_object_write:nn
-          {__spc_extgstate_op_true1}
-          {/Type /ExtGState~/op~true~/OP~true~/OPM~1}%
-         \pdfmanagement_add:nnn
-          {Page/Resources/ExtGState}
-          {SPCop}
-          {\@@_backend_object_ref:n {__spc_extgstate_op_true1}}
+       package/colorspace/after
       }
-  }
+      {\RequirePackage{colorspace-patches-tmp-ltx}}
+ }
 %</package>
 %    \end{macrocode}%
 % \end{documentation}





More information about the latex3-commits mailing list.