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

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Oct 18 14:20:56 CEST 2021


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

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

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

    Extend ICC profile support to SVG


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

3a1e92b365e1a75399d33e84a8bb57d4e181c613
 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 24074441f..aef9b3fac 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -852,6 +852,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 3bca87f5d..8aa2e00f5 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -2640,11 +2640,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.