[latex3-commits] [git/LaTeX3-latex3-latex3] master: Enable CIELAB support with dvips (7845cfc57)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Sep 11 15:20:40 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/7845cfc57275a617ac482a59810a7f96949711c9

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

commit 7845cfc57275a617ac482a59810a7f96949711c9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Sep 11 13:34:54 2020 +0100

    Enable CIELAB support with dvips


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

7845cfc57275a617ac482a59810a7f96949711c9
 l3backend/CHANGELOG.md                 |  3 ++
 l3backend/l3backend-color.dtx          | 57 +++++++++++++++++++++++++++++++---
 l3kernel/testfiles/m3expl001.ptex.tlg  |  2 ++
 l3kernel/testfiles/m3expl001.uptex.tlg |  2 ++
 l3kernel/testfiles/m3expl003.ptex.tlg  |  2 ++
 l3kernel/testfiles/m3expl003.uptex.tlg |  2 ++
 6 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 25f142920..8f497177b 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+- Support for CIELAB separations with `dvips`
+
 ### Fixed
 - Some PDF object functions
 - Separation color selection for `dvipdfmx`/XeTeX
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index eb54b518c..483e40f96 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -318,6 +318,7 @@
 % \begin{macro}
 %   {
 %     \@@_backend_separation_init:nnnnn,
+%     \@@_backend_separation_init:nxxnn,
 %     \@@_backend_separation_init_aux:nnnnn
 %   }
 % \begin{macro}[EXP]
@@ -354,6 +355,7 @@
             }
       }
   }
+\cs_generate_variant:Nn \@@_backend_separation_init:nnnnn { nxx }
 \cs_new_protected:Npn \@@_backend_separation_init_aux:nnnnn #1#2#3#4#5
   {
     \__kernel_backend_literal:e
@@ -362,9 +364,9 @@
         TeXDict ~ begin ~
         /color \int_use:N \g_@@_separation_int
           {
-            [
+            [ ~
               /Separation ~ ( \str_convert_pdfname:n {#1} ) ~
-              #2 ~
+              [ ~ #2 ~ ] ~
                 {
                   \cs_if_exist_use:cF { @@_backend_separation_init_ #2 :nnn }
                     { \@@_backend_separation_init:nnn }
@@ -476,9 +478,56 @@
       { \@@_backend_separation_init:nw {#1} #4 \s_@@_stop }
   }
 %    \end{macrocode}
-%  Currently no CIELAB support.
+%  CIELAB support uses the detail from the PostScript reference, page 227;
+%  other than that block of PostScript, this is the same as for PDF-based
+%  routes.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_separation_init_CIELAB:nnn #1#2#3 { }
+\cs_new_protected:Npn \@@_backend_separation_init_CIELAB:nnn #1#2#3
+  {
+    \@@_backend_separation_init:nxxnn
+      {#2}
+      {
+        /CIEBasedABC ~
+            << ~
+              /RangeABC ~ [ ~ \c_@@_model_range_CIELAB_tl \c_space_tl ] ~
+              /DecodeABC ~
+                [ ~
+                  { ~ 16 ~ add ~ 116 ~ div ~ } ~ bind ~
+                  { ~ 500 ~ div ~ } ~ bind ~
+                  { ~ 200 ~ div ~ } ~ bind ~
+                ] ~
+              /MatrixABC ~ [ ~ 1 ~ 1 ~ 1 ~ 1 ~ 0 ~ 0 ~ 0 ~ 0 ~ -1 ~ ] ~
+              /DecodeLMN ~
+                [ ~
+                  { ~
+                    dup ~ 6 ~ 29 ~ div ~ ge ~
+                      { ~ dup ~ dup ~ mul ~ mul ~ ~ } ~
+                      { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~
+                    ifelse ~
+                    0.9505 ~ mul ~
+                  } ~ bind ~
+                  { ~
+                    dup ~ 6 ~ 29 ~ div ~ ge ~
+                      { ~ dup ~ dup ~ mul ~ mul ~ } ~
+                      { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~
+                    ifelse ~
+                  } ~ bind ~
+                  { ~
+                    dup ~ 6 ~ 29 ~ div ~ ge ~
+                      { ~ dup ~ dup ~ mul ~ mul ~ } ~
+                      { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~
+                    ifelse ~
+                    1.0890 ~ mul ~
+                  } ~ bind
+                ] ~
+              /WhitePoint ~
+                [ ~ \tl_use:c { c_@@_model_whitepoint_CIELAB_ #1 _tl } ~ ] ~
+            >>
+      }
+      { \c_@@_model_range_CIELAB_tl }
+      { 100 ~ 0 ~ 0 }
+      {#3}
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 28e8aac1f..ba9930c14 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -36,6 +36,8 @@ 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 \exp_args:Nnxx on line ...
+Defining \__color_backend_separation_init:nxxnn 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 ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 28e8aac1f..ba9930c14 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -36,6 +36,8 @@ 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 \exp_args:Nnxx on line ...
+Defining \__color_backend_separation_init:nxxnn 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 ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 28e8aac1f..ba9930c14 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -36,6 +36,8 @@ 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 \exp_args:Nnxx on line ...
+Defining \__color_backend_separation_init:nxxnn 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 ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 28e8aac1f..ba9930c14 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -36,6 +36,8 @@ 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 \exp_args:Nnxx on line ...
+Defining \__color_backend_separation_init:nxxnn 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 ...





More information about the latex3-commits mailing list.