[latex3-commits] [l3svn] 01/03: Allow color model to be fixed

noreply at latex-project.org noreply at latex-project.org
Sun Oct 22 17:33:38 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit 252c48825365241019608add096ca3a536a4d6a0
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Oct 22 10:43:30 2017 +0100

    Allow color model to be fixed
---
 l3trial/l3color-extras/l3color-extras.dtx          |   37 ++++++++++++++-
 .../l3color-extras/testfiles/m3color-extras001.lvt |   11 +++++
 .../testfiles/m3color-extras001.ptex.tlg           |   50 +++++++++++++++++++-
 .../l3color-extras/testfiles/m3color-extras001.tlg |   50 +++++++++++++++++++-
 .../testfiles/m3color-extras001.uptex.tlg          |   50 +++++++++++++++++++-
 .../testfiles/m3color-extras001.xetex.tlg          |   50 +++++++++++++++++++-
 6 files changed, 242 insertions(+), 6 deletions(-)

diff --git a/l3trial/l3color-extras/l3color-extras.dtx b/l3trial/l3color-extras/l3color-extras.dtx
index a81206d..b99c0a8 100644
--- a/l3trial/l3color-extras/l3color-extras.dtx
+++ b/l3trial/l3color-extras/l3color-extras.dtx
@@ -203,6 +203,12 @@
 %   \meta{value(s)} for typeset material.
 % \end{function}
 %
+% \begin{variable}{\l_color_fixed_model_tl}
+%   When this is set to a non-empty value, colors will be converted to
+%   the specified model when they are selected. Note that included images
+%   and similar are not influenced by this setting.
+% \end{variable}
+%
 % \section{Spot colors}
 % \label{l3color:sec:spot}
 %
@@ -270,7 +276,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[int]{\@@_extract:nNN}
+% \begin{macro}[int]{\@@_extract:nNN, \@@_extract:VNN}
 % \begin{macro}[aux]{\@@_extract:NNw}
 %   Split the model and color from a named color, and store the two. No test
 %   for the existence of the color: that is assumed to be the case (this
@@ -285,6 +291,7 @@
       \exp_after:wN \exp_after:wN \exp_after:wN #3
         \cs:w l_@@_named_ #1 _tl \cs_end: \q_stop
   }
+\cs_generate_variant:Nn \@@_extract:nNN { V }
 \cs_new_protected:Npn \@@_extract:NNw #1#2 #3 ~ #4 \q_stop
   {
     \tl_set:Nn #1 {#3}
@@ -600,20 +607,46 @@
 % \end{macro}
 % \end{macro}
 %
-% \subsection{Selecting colors}
+% \subsection{Selecting colors (and color models)}
+%
+% \begin{variable}{\l_color_fixed_model_tl}
+%   For selecting a single fixed model.
+%    \begin{macrocode}
+\tl_new:N \l_color_fixed_model_tl
+%    \end{macrocode}
+% \end{variable}
 %
 % \begin{macro}[int]{\@@_select:}
+% \begin{macro}[aux]{\@@_select:w}
 %   A driver-neutral location for \enquote{last minute} manipulations before
 %   handing off to the driver code.  We set the special |.| syntax here: this
 %   will therefore always be available.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_select:
   {
+    \tl_if_empty:NF \l_color_fixed_model_tl
+      {
+        \exp_after:wN \@@_select:w
+          \l__color_current_tl \q_stop
+        \tl_if_eq:NNF \l_@@_model_tl \l_color_fixed_model_tl
+          {
+            \@@_convert:VVN \l_@@_model_tl \l_color_fixed_model_tl
+              \l_@@_value_tl
+          }
+        \tl_set:Nx \l__color_current_tl
+          { \l_color_fixed_model_tl \c_space_tl \l_@@_value_tl }
+      }
     \tl_set_eq:cN { l_@@_named_ . _tl } \l__color_current_tl
     \__driver_color_select:
   }
+\cs_new_protected:Npn \@@_select:w #1 ~ #2 \q_stop
+  {
+    \tl_set:Nn \l_@@_model_tl {#1}
+    \tl_set:Nn \l_@@_value_tl {#2}
+  }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\color_select:n}
 % \begin{macro}{\color_select:nn}
diff --git a/l3trial/l3color-extras/testfiles/m3color-extras001.lvt b/l3trial/l3color-extras/testfiles/m3color-extras001.lvt
index 11807ea..89b1749 100644
--- a/l3trial/l3color-extras/testfiles/m3color-extras001.lvt
+++ b/l3trial/l3color-extras/testfiles/m3color-extras001.lvt
@@ -98,6 +98,17 @@
     \test:nn { cmyk } { 0.9 , 0.2 , 0.4 , 0 }
   }
 
+\TEST { Fixing~the~model }
+  {
+    \test:n { red!25 }
+    \tl_set:Nn \l_color_fixed_model_tl { rgb }
+    \test:n { red!25 }
+    \tl_set:Nn \l_color_fixed_model_tl { cmyk }
+    \test:n { red!25 }
+    \tl_set:Nn \l_color_fixed_model_tl { gray }
+    \test:n { red!25 }
+  }
+
 \TEST { Showing~colors }
   {
     \color_show:n { unknown }
diff --git a/l3trial/l3color-extras/testfiles/m3color-extras001.ptex.tlg b/l3trial/l3color-extras/testfiles/m3color-extras001.ptex.tlg
index 9cab528..d2a7f25 100644
--- a/l3trial/l3color-extras/testfiles/m3color-extras001.ptex.tlg
+++ b/l3trial/l3color-extras/testfiles/m3color-extras001.ptex.tlg
@@ -155,7 +155,55 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Showing colors
+TEST 7: Fixing the model
+============================================================
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0 0.25 0.25 0}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.825}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 8: Showing colors
 ============================================================
 The color unknown is undefined.
 > .
diff --git a/l3trial/l3color-extras/testfiles/m3color-extras001.tlg b/l3trial/l3color-extras/testfiles/m3color-extras001.tlg
index b96d6ea..a978c61 100644
--- a/l3trial/l3color-extras/testfiles/m3color-extras001.tlg
+++ b/l3trial/l3color-extras/testfiles/m3color-extras001.tlg
@@ -155,7 +155,55 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Showing colors
+TEST 7: Fixing the model
+============================================================
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {1 0.75 0.75 rg 1 0.75 0.75 RG}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {1 0.75 0.75 rg 1 0.75 0.75 RG}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0 0.25 0.25 0 k 0 0.25 0.25 0 K}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.825 g 0.825 G}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 8: Showing colors
 ============================================================
 The color unknown is undefined.
 > .
diff --git a/l3trial/l3color-extras/testfiles/m3color-extras001.uptex.tlg b/l3trial/l3color-extras/testfiles/m3color-extras001.uptex.tlg
index 9cab528..d2a7f25 100644
--- a/l3trial/l3color-extras/testfiles/m3color-extras001.uptex.tlg
+++ b/l3trial/l3color-extras/testfiles/m3color-extras001.uptex.tlg
@@ -155,7 +155,55 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Showing colors
+TEST 7: Fixing the model
+============================================================
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0 0.25 0.25 0}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.825}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 8: Showing colors
 ============================================================
 The color unknown is undefined.
 > .
diff --git a/l3trial/l3color-extras/testfiles/m3color-extras001.xetex.tlg b/l3trial/l3color-extras/testfiles/m3color-extras001.xetex.tlg
index 9cab528..d2a7f25 100644
--- a/l3trial/l3color-extras/testfiles/m3color-extras001.xetex.tlg
+++ b/l3trial/l3color-extras/testfiles/m3color-extras001.xetex.tlg
@@ -155,7 +155,55 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Showing colors
+TEST 7: Fixing the model
+============================================================
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 1 0.75 0.75}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0 0.25 0.25 0}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box57=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.825}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 8: Showing colors
 ============================================================
 The color unknown is undefined.
 > .

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list