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

Marcel Fabian Krüger tex at 2krueger.de
Thu Oct 14 15:09:48 CEST 2021


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

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

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

    Extend ICC profile support to SVG


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

3aa87046d74d0c13f08c995d3cd33ec4910d974a
 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 366cc65ad..237f0100f 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -773,6 +773,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 52f44c664..a69ae0b37 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -2557,11 +2557,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.