[latex3-commits] [git/LaTeX3-latex3-latex3] master: Better approach to dvips Separations (1ca42d17f)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Sep 9 21:18:14 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1ca42d17f23bfe63c406d05841119db5f3acf474
>---------------------------------------------------------------
commit 1ca42d17f23bfe63c406d05841119db5f3acf474
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed Sep 9 20:18:14 2020 +0100
Better approach to dvips Separations
>---------------------------------------------------------------
1ca42d17f23bfe63c406d05841119db5f3acf474
l3backend/l3backend-color.dtx | 63 +++++++++++++++++++++-------------
l3backend/l3backend-header.dtx | 4 +--
l3kernel/testfiles/m3expl001.ptex.tlg | 8 +++--
l3kernel/testfiles/m3expl001.uptex.tlg | 8 +++--
l3kernel/testfiles/m3expl003.ptex.tlg | 8 +++--
l3kernel/testfiles/m3expl003.uptex.tlg | 8 +++--
6 files changed, 62 insertions(+), 37 deletions(-)
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 72364c4e6..ea46f7f2c 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -311,20 +311,29 @@
% \begin{macro}{\@@_backend_select_separation:nn}
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2
- { \@@_backend_select:n { setspotcolor ~ #1 ~ #2 } }
+ { \@@_backend_select:n { separation ~ #1 ~ #2 } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_separation_init:nnnnn}
-% \begin{macro}{\@@_backend_separation_init:nnn}
-% \begin{macro}[EXP]{\@@_backend_separation_init:n}
-% \begin{macro}[EXP]{\@@_backend_separation_init:w}
+% \begin{macro}
+% {
+% \@@_backend_separation_init:nnnnn,
+% \@@_backend_separation_init_aux:nnnnn
+% }
+% \begin{macro}
+% {
+% \@@_backend_separation_init_/DeviceCMYK:nnn ,
+% \@@_backend_separation_init_/DeviceGray:nnn ,
+% \@@_backend_separation_init_/DeviceRGB:nnn
+% }
+% \begin{macro}{\@@_backend_separation_init_Device:Nn}
% \begin{macro}{\@@_backend_separation_init_CIELAB:nnnnn}
% \begin{macro}{\@@_backend_separation_init_CIELAB:n}
% Initialising here means creating a small header set up plus massaging
% some data. This comes about as we have to deal with PDF-focussed data,
% which makes most sense \enquote{higher-up}. The approach is based on
-% ideas from \url{https://tex.stackexchange.com/q/560093}.
+% ideas from \url{https://tex.stackexchange.com/q/560093} plus using
+% the PostScript manual for other aspects.
% \begin{macrocode}
\cs_new_protected:Npx \@@_backend_separation_init:nnnnn #1#2#3#4#5
{
@@ -334,29 +343,44 @@
{ \AtBeginDvi }
{ \use:n }
{
- \exp_not:N \@@_backend_separation_init:nnn
- {#1} {#2} {#5}
+ \exp_not:N \@@_backend_separation_init_aux:nnnnn
+ {#1} {#2} {#3} {#4} {#5}
}
}
}
-\cs_new_protected:Npn \@@_backend_separation_init:nnn #1#2#3
+\cs_new_protected:Npn \@@_backend_separation_init_aux:nnnnn #1#2#3#4#5
{
\__kernel_backend_literal:e
{
!
TeXDict ~ begin ~
- /color \int_use:N \g_@@_separation_int \c_space_tl
- [#3] ~ aload ~ pop ~ ( \str_convert_pdfname:n {#1} ) ~
- find \@@_backend_separation_init:n {#2} customcolor ~ def ~
+ /color \int_use:N \g_@@_separation_int
+ {
+ [
+ /Separation ~ ( \str_convert_pdfname:n {#1} ) ~
+ #2 ~
+ {
+ \use:c { @@_backend_separation_init_ #2 :nnn }
+ {#3} {#4} {#5}
+ }
+ ] ~ setcolorspace
+ } ~ def ~
end
}
}
-\cs_new:Npn \@@_backend_separation_init:n #1
+\cs_new:cpn { @@_backend_separation_init_ /DeviceCMYK :nnn } #1#2#3
+ { \@@_backend_separation_init_Device:Nn 4 {#3} }
+\cs_new:cpn { @@_backend_separation_init_ /DeviceGray :nnn } #1#2#3
+ { \@@_backend_separation_init_Device:Nn 1 {#3} }
+\cs_new:cpn { @@_backend_separation_init_ /DeviceRGB :nnn } #1#2#3
+ { \@@_backend_separation_init_Device:Nn 2 {#3} }
+\cs_new:Npn \@@_backend_separation_init_Device:Nn #1#2
{
- \@@_backend_separation_init:w #1 /Device #1 /Device \s_@@_stop
+ #2 ~
+ \prg_replicate:nn {#1}
+ { #1 ~ index ~ mul ~ #1 ~ 1 ~ roll ~ }
+ \int_eval:n { #1 + 1 } ~ -1 ~ roll ~ pop
}
-\cs_new:Npn \@@_backend_separation_init:w #1 /Device #2 /Device #3 \s_@@_stop
- { \str_lowercase:n {#2} }
% \end{macrocode}
% Currently no CIELAB support.
% \begin{macrocode}
@@ -368,7 +392,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macrocode}
%</dvips>
@@ -464,10 +487,8 @@
}
%</luatex|pdftex>
}
-%<*luatex|pdftex>
\cs_if_exist:NF \pdf_object_now:nn
{ \cs_gset_protected:Npn \@@_backend_separation_init:nnnnn #1#2#3#4#5 { } }
-%</luatex|pdftex>
\cs_new_protected:Npn \@@_backend_separation_init:n #1
{
%<*dvipdfmx|xetex>
@@ -494,10 +515,8 @@
{ 100 ~ 0 ~ 0 }
{ #3 ~ #4 ~ #5 }
}
-%<*luatex|pdftex>
\cs_if_exist:NF \pdf_object_now:nn
{ \cs_gset_protected:Npn \@@_backend_separation_init_CIELAB:nnnnn #1#2#3#4#5 { } }
-%</luatex|pdftex>
\cs_new_protected:Npn \@@_backend_separation_init_CIELAB:n #1
{
\pdf_object_new:nn { @@_illuminant_CIELAB_ #1 } { array }
@@ -511,10 +530,8 @@
>>
}
}
-%<*luatex|pdftex>
\cs_if_exist:NF \pdf_object_new:nn
{ \cs_gset_protected:Npn \@@_backend_separation_init_CIELAB:n #1 { } }
-%</luatex|pdftex>
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/l3backend/l3backend-header.dtx b/l3backend/l3backend-header.dtx
index c2d0f8745..e1793b4ca 100644
--- a/l3backend/l3backend-header.dtx
+++ b/l3backend/l3backend-header.dtx
@@ -67,12 +67,12 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{TeXcolorsetspotcolor, setspotcolor}
+% \begin{macro}{TeXcolorseparation, separation}
% Support for separation/spot colors: this strange naming is so
% things work with the color stack.
% \begin{macrocode}
TeXDict begin
-/TeXcolorsetspotcolor { setcustomcolor } def
+/TeXcolorseparation { setcolor } def
end
% \end{macrocode}
% \end{macro}
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 3d5a26a0a..4621b4d56 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -36,9 +36,11 @@ Defining \__color_backend_select:n on line ...
Defining \__color_backend_reset: on line ...
Defining \__color_backend_select_separation:nn on line ...
Defining \__color_backend_separation_init:nnnnn on line ...
-Defining \__color_backend_separation_init:nnn on line ...
-Defining \__color_backend_separation_init:n on line ...
-Defining \__color_backend_separation_init:w on line ...
+Defining \__color_backend_separation_init_aux:nnnnn on line ...
+Defining \__color_backend_separation_init_/DeviceCMYK:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceGray:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceRGB:nnn on line ...
+Defining \__color_backend_separation_init_Device:Nn on line ...
Defining \__color_backend_separation_init_CIELAB:nnnnn on line ...
Defining \__color_backend_separation_init_CIELAB:n on line ...
Defining \__color_backend_fill_cmyk:n on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 3d5a26a0a..4621b4d56 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -36,9 +36,11 @@ Defining \__color_backend_select:n on line ...
Defining \__color_backend_reset: on line ...
Defining \__color_backend_select_separation:nn on line ...
Defining \__color_backend_separation_init:nnnnn on line ...
-Defining \__color_backend_separation_init:nnn on line ...
-Defining \__color_backend_separation_init:n on line ...
-Defining \__color_backend_separation_init:w on line ...
+Defining \__color_backend_separation_init_aux:nnnnn on line ...
+Defining \__color_backend_separation_init_/DeviceCMYK:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceGray:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceRGB:nnn on line ...
+Defining \__color_backend_separation_init_Device:Nn on line ...
Defining \__color_backend_separation_init_CIELAB:nnnnn on line ...
Defining \__color_backend_separation_init_CIELAB:n on line ...
Defining \__color_backend_fill_cmyk:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 3d5a26a0a..4621b4d56 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -36,9 +36,11 @@ Defining \__color_backend_select:n on line ...
Defining \__color_backend_reset: on line ...
Defining \__color_backend_select_separation:nn on line ...
Defining \__color_backend_separation_init:nnnnn on line ...
-Defining \__color_backend_separation_init:nnn on line ...
-Defining \__color_backend_separation_init:n on line ...
-Defining \__color_backend_separation_init:w on line ...
+Defining \__color_backend_separation_init_aux:nnnnn on line ...
+Defining \__color_backend_separation_init_/DeviceCMYK:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceGray:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceRGB:nnn on line ...
+Defining \__color_backend_separation_init_Device:Nn on line ...
Defining \__color_backend_separation_init_CIELAB:nnnnn on line ...
Defining \__color_backend_separation_init_CIELAB:n on line ...
Defining \__color_backend_fill_cmyk:n on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 3d5a26a0a..4621b4d56 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -36,9 +36,11 @@ Defining \__color_backend_select:n on line ...
Defining \__color_backend_reset: on line ...
Defining \__color_backend_select_separation:nn on line ...
Defining \__color_backend_separation_init:nnnnn on line ...
-Defining \__color_backend_separation_init:nnn on line ...
-Defining \__color_backend_separation_init:n on line ...
-Defining \__color_backend_separation_init:w on line ...
+Defining \__color_backend_separation_init_aux:nnnnn on line ...
+Defining \__color_backend_separation_init_/DeviceCMYK:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceGray:nnn on line ...
+Defining \__color_backend_separation_init_/DeviceRGB:nnn on line ...
+Defining \__color_backend_separation_init_Device:Nn on line ...
Defining \__color_backend_separation_init_CIELAB:nnnnn on line ...
Defining \__color_backend_separation_init_CIELAB:n on line ...
Defining \__color_backend_fill_cmyk:n on line ...
More information about the latex3-commits
mailing list.