summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend/l3backend-color.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-color.dtx')
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx86
1 files changed, 71 insertions, 15 deletions
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index 72254382f5..3bd3fbc429 100644
--- a/macros/latex/contrib/l3backend/l3backend-color.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-color.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-10-12}
+% \date{Released 2021-10-17}
%
% \maketitle
%
@@ -486,6 +486,55 @@
% backend.
%
% \begin{macrocode}
+%<*dvipdfmx|luatex|pdftex|xetex|dvips>
+% \end{macrocode}
+%
+% But we start with some functionality needed for both PostScript and
+% PDF based backends.
+%
+% \begin{variable}{\g_@@_backend_colorant_prop}
+% \begin{macrocode}
+\prop_new:N \g_@@_backend_colorant_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP]{\@@_backend_devicen_colorants:n}
+% \begin{macro}[EXP]{\@@_backend_devicen_colorants:w}
+% \begin{macrocode}
+\cs_new:Npx \@@_backend_devicen_colorants:n #1
+ {
+ \exp_not:N \tl_if_blank:nF {#1}
+ {
+ \c_space_tl
+ << ~
+ /Colorants ~
+ << ~
+ \exp_not:N \@@_backend_devicen_colorants:w #1 ~
+ \exp_not:N \q_recursion_tail \c_space_tl
+ \exp_not:N \q_recursion_stop
+ >> ~
+ >>
+ }
+ }
+\cs_new:Npn \@@_backend_devicen_colorants:w #1 ~
+ {
+ \quark_if_recursion_tail_stop:n {#1}
+ \prop_if_in:NnT \g_@@_backend_colorant_prop {#1}
+ {
+ #1 ~
+ \prop_item:Nn \g_@@_backend_colorant_prop {#1} ~
+ }
+ \@@_backend_devicen_colorants:w
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|luatex|pdftex|xetex|dvips>
+% \end{macrocode}
+%
+% \begin{macrocode}
%<*dvips>
% \end{macrocode}
%
@@ -535,6 +584,15 @@
{ \exp_not:N \int_use:N \g_@@_model_int }
{#1} {#2} {#3} {#4} {#5}
}
+ \prop_gput:Nxx \exp_not:N \g_@@_backend_colorant_prop
+ { / \exp_not:N \str_convert_pdfname:n {#1} }
+ {
+ << ~
+ /setcolorspace ~ {} ~
+ >> ~ begin ~
+ color \exp_not:N \int_use:N \g_@@_model_int \c_space_tl
+ end
+ }
}
}
\cs_generate_variant:Nn \@@_backend_separation_init:nnnnn { nxx }
@@ -740,6 +798,7 @@
[ ~ #1 ~ ] ~
#2 ~
{ ~ #3 ~ } ~
+ \@@_backend_devicen_colorants:n {#1}
] ~ setcolorspace
} ~ def ~
end
@@ -793,7 +852,7 @@
% \end{macro}
%
% \begin{macro}{\@@_backend_separation_init:nnnnn}
-% \begin{macro}{\@@_backend_separation_init:n}
+% \begin{macro}{\@@_backend_separation_init:nn}
% \begin{macro}{\@@_backend_separation_init_CIELAB:nnn}
% Initialising the PDF structures needs two parts: creating an object
% containing the \enquote{real} name of the Separation, then adding a reference
@@ -810,15 +869,11 @@
/C0 ~ [#4] ~
/C1 ~ [#5] /N ~ 1
}
- \@@_backend_separation_init:n
- {
- /Separation ~
- / \str_convert_pdfname:n {#1} ~ #2 ~
- \pdf_object_ref_last:
- }
+ \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:}
+ { \pdfmanagement_if_active_p: }
{
\use:x
{
@@ -829,9 +884,12 @@
}
}
}
-\cs_new_protected:Npn \@@_backend_separation_init:n #1
+\cs_new_protected:Npn \@@_backend_separation_init:nn #1#2
{
- \pdf_object_unnamed_write:nx { array } {#1}
+ \pdf_object_unnamed_write:nx { array }
+ { /Separation /#1 ~ #2 ~ \pdf_object_ref_last: }
+ \prop_gput:Nnx \g_@@_backend_colorant_prop { /#1 }
+ { \pdf_object_ref_last: }
}
% \end{macrocode}
% For CIELAB colors, we need one object per document for the illuminant,
@@ -866,7 +924,6 @@
%
% \begin{macro}{\@@_backend_devicen_init:nnn}
% \begin{macro}[EXP]{\@@_backend_devicen_init:w}
-% \begin{macro}{\@@_backend_devicen_init:n}
% Similar to the Separations case, but with an arbitrary function for
% the alternative space work.
% \begin{macrocode}
@@ -894,12 +951,13 @@
}
{ {#3} }
}
- \@@_backend_separation_init:n
+ \pdf_object_unnamed_write:nx { array }
{
/DeviceN ~
[ ~ #1 ~ ] ~
#2 ~
\pdf_object_ref_last:
+ \@@_backend_devicen_colorants:n {#1}
}
\bool_lazy_and:nnT
{ \cs_if_exist_p:N \pdfmanagement_if_active_p: }
@@ -920,11 +978,9 @@
\tl_if_blank:nF {#2}
{ \@@_backend_devicen_init:w #2 \s_@@_stop }
}
-\cs_new_eq:NN \@@_backend_devicen_init:n \@@_backend_separation_init:n
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>