diff options
author | Norbert Preining <norbert@preining.info> | 2021-10-19 03:01:14 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-10-19 03:01:14 +0000 |
commit | d045bcbc99b0eda65a444496d60d16ea2d063c65 (patch) | |
tree | 86dd463beaafa251038cf6f29adadd6276da1250 /macros/latex/contrib/l3backend/l3backend-color.dtx | |
parent | ad3ad18aa939862832c90a74bcf41e8a5570ff65 (diff) |
CTAN sync 202110190301
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-color.dtx')
-rw-r--r-- | macros/latex/contrib/l3backend/l3backend-color.dtx | 121 |
1 files changed, 117 insertions, 4 deletions
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx index 3bd3fbc429..d47b2a7179 100644 --- a/macros/latex/contrib/l3backend/l3backend-color.dtx +++ b/macros/latex/contrib/l3backend/l3backend-color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-10-17} +% \date{Released 2021-10-18} % % \maketitle % @@ -546,6 +546,13 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_backend_select_iccbased:nn} +% No support. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_select_iccbased:nn #1#2 { } +% \end{macrocode} +% \end{macro} +% % \begin{macro} % { % \@@_backend_separation_init:nnnnn, @@ -807,6 +814,13 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_backend_iccbased_init:nnn} +% No support at present. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_iccbased_init:nnn #1#2#3 { } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</dvips> % \end{macrocode} @@ -815,11 +829,15 @@ %<*dvisvgm> % \end{macrocode} % -% \begin{macro}{\@@_backend_select_separation:nn, \@@_backend_select_devicen:nn} +% \begin{macro} +% { +% \@@_backend_select_separation:nn, +% \@@_backend_select_devicen:nn +% } % No support at present. % \begin{macrocode} \cs_new_protected:Npn \@@_backend_select_separation:nn #1#2 { } -\cs_new_protected:Npn \@@_backend_select_devicen:nn #1#2 { } +\cs_new_eq:NN \@@_backend_select_devicen:nn \@@_backend_select_separation:nn % \end{macrocode} % \end{macro} % @@ -832,6 +850,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} @@ -840,7 +882,12 @@ %<*dvipdfmx|luatex|pdftex|xetex> % \end{macrocode} % -% \begin{macro}{\@@_backend_select_separation:nn, \@@_backend_select_devicen:nn} +% \begin{macro} +% { +% \@@_backend_select_separation:nn, +% \@@_backend_select_devicen:nn , +% \@@_backend_select_iccbased:nn +% } % Although \texttt{(x)dvipdfmx} has a built-in approach to color spaces, that % can't be used with the generic color stacks. So we take an approach in which % we share the same code as for \pdfTeX{}. @@ -848,6 +895,7 @@ \cs_new_protected:Npn \@@_backend_select_separation:nn #1#2 { \@@_backend_select:nn { /#1 ~ cs ~ #2 ~ scn } { /#1 ~ CS ~ #2 ~ SCN } } \cs_new_eq:NN \@@_backend_select_devicen:nn \@@_backend_select_separation:nn +\cs_new_eq:NN \@@_backend_select_iccbased:nn \@@_backend_select_separation:nn % \end{macrocode} % \end{macro} % @@ -982,6 +1030,71 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_backend_iccbased_init:nnn} +% Lots of data to save here: we only want to do that once per file, +% so track it by name. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_iccbased_init:nnn #1#2#3 + { + \pdf_object_if_exist:nF { @@_icc_ #1 } + { + \pdf_object_new:nn { @@_icc_ #1 } { fstream } + \pdf_object_write:nx { @@_icc_ #1 } + { + { + /N ~ \exp_not:n { #2 } ~ + \tl_if_empty:nF { #3 } { /Range~[ #3 ] } + } + {#1} + } + } + \pdf_object_unnamed_write:nx { array } + { /ICCBased ~ \pdf_object_ref:n { @@_icc_ #1 } } + \cs_if_exist:NT \pdfmanagement_add:nnn + { + \use:x + { + \pdfmanagement_add:nnn { Page / Resources / ColorSpace } + { color \int_use:N \g_@@_model_int } + { ~ \pdf_object_ref_last: } + } + } + } +% \end{macrocode} +% \end{macro} + +% +% \begin{macro}{\@@_backend_iccbased_device:nnn} +% This is very similar to setting up a color space: the only part we +% skip is adding it to the page resources. +% \begin{macrocode} +\cs_new_protected:Npn \@@_backend_iccbased_device:nnn #1#2#3 + { + \pdf_object_if_exist:nF { @@_icc_ #1 } + { + \pdf_object_new:nn { @@_icc_ #1 } { fstream } + \pdf_object_write:nn { @@_icc_ #1 } + { + { /N ~ #3 } + {#1} + } + } + \pdf_object_unnamed_write:nx { array } + { /ICCBased ~ \pdf_object_ref:n { @@_icc_ #1 } } + \cs_if_exist:NT \pdfmanagement_add:nnn + { + \use:x + { + \pdfmanagement_add:nnn + { Page / Resources / ColorSpace } + { Default #2 } + { \pdf_object_ref_last: } + } + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</dvipdfmx|luatex|pdftex|xetex> % \end{macrocode} |