[latex3-commits] [git/LaTeX3-latex3-latex3] icc2: Extend ICC profile support to SVG (fdeae93a1)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Feb 24 12:44:08 CET 2021


Repository : https://github.com/latex3/latex3
On branch  : icc2
Link       : https://github.com/latex3/latex3/commit/fdeae93a18d34c77eba9e2c292f3122dd82911ff

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

commit fdeae93a18d34c77eba9e2c292f3122dd82911ff
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Feb 24 11:43:49 2021 +0000

    Extend ICC profile support to SVG


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

fdeae93a18d34c77eba9e2c292f3122dd82911ff
 l3backend/l3backend-color.dtx | 24 ++++++++++++++++++++++++
 l3kernel/l3color.dtx          | 15 ++++++++++++---
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index a5a75bf8b..8b35dd8a1 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -759,6 +759,30 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_backend_select_iccbased:nn}
+%   As detailed in \url{https://www.w3.org/TR/css-color-4/#at-profile},
+%   we can apply a color profile using CSS. As we have a local file, we use
+%   a relative URL.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select_iccbased:nn #1#2
+  {
+    \__kernel_backend_literal_svg:x
+      {
+        <style>
+          @color-profile ~
+            \str_if_eq:nnTF {#2} { cmyk }
+              { device-cmyk }
+              { --color \int_use:N \g_@@_model_int }
+                \c_space_tl
+            {
+              src:("#1")
+            }
+        </style>
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 %    \begin{macrocode}
 %</dvisvgm>
 %    \end{macrocode}
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index 9f8ddea69..58be0df22 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -2529,11 +2529,20 @@
         {#1}
   }
 \cs_new_protected:Npn \@@_iccprofile_apply_gray:n #1
-  { \@@_backend_iccbased_device:nnn {#1} { Gray } { 1 } }
+  {
+    \int_gincr:N \g_@@_model_int
+    \@@_backend_iccbased_device:nnn {#1} { Gray } { 1 }
+  }
 \cs_new_protected:Npn \@@_iccprofile_apply_rgb:n #1
-  { \@@_backend_iccbased_device:nnn {#1} { RGB } { 3 } }
+  {
+    \int_gincr:N \g_@@_model_int
+    \@@_backend_iccbased_device:nnn {#1} { RGB } { 3 }
+  }
 \cs_new_protected:Npn \@@_iccprofile_apply_cmyk:n #1
-  { \@@_backend_iccbased_device:nnn {#1} { CMYK } { 4 } }
+  {
+    \int_gincr:N \g_@@_model_int
+    \@@_backend_iccbased_device:nnn {#1} { CMYK } { 4 }
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}





More information about the latex3-commits mailing list.