summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-30 03:00:54 +0000
committerNorbert Preining <norbert@preining.info>2021-01-30 03:00:54 +0000
commit431a21790bcbf7d842f7a3d5e6e3eaef4ae823af (patch)
tree5ae95f1f34bf81d03294fc88ed5cab6eb0e25a88 /macros/latex/contrib/l3backend
parentbc31a53b31d92ddf5db3e7df811734a0141f8b3f (diff)
CTAN sync 202101300300
Diffstat (limited to 'macros/latex/contrib/l3backend')
-rw-r--r--macros/latex/contrib/l3backend/CHANGELOG.md14
-rw-r--r--macros/latex/contrib/l3backend/README.md4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-basics.dtx18
-rw-r--r--macros/latex/contrib/l3backend/l3backend-box.dtx6
-rw-r--r--macros/latex/contrib/l3backend/l3backend-code.pdfbin786373 -> 805273 bytes
-rw-r--r--macros/latex/contrib/l3backend/l3backend-code.tex3
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx339
-rw-r--r--macros/latex/contrib/l3backend/l3backend-draw.dtx16
-rw-r--r--macros/latex/contrib/l3backend/l3backend-graphics.dtx6
-rw-r--r--macros/latex/contrib/l3backend/l3backend-header.dtx11
-rw-r--r--macros/latex/contrib/l3backend/l3backend-opacity.dtx286
-rw-r--r--macros/latex/contrib/l3backend/l3backend-pdf.dtx163
-rw-r--r--macros/latex/contrib/l3backend/l3backend.ins10
13 files changed, 663 insertions, 213 deletions
diff --git a/macros/latex/contrib/l3backend/CHANGELOG.md b/macros/latex/contrib/l3backend/CHANGELOG.md
index 242cacf93a..4d4f19b44b 100644
--- a/macros/latex/contrib/l3backend/CHANGELOG.md
+++ b/macros/latex/contrib/l3backend/CHANGELOG.md
@@ -6,6 +6,17 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+## [2020-01-29]
+
+### Added
+- Basic opacity support
+
+### Changed
+- Use color stack for fill color, and for stroke color if possible
+
+### Fixed
+- Implementation of `filldraw` for `dvips`
+
## [2021-01-09]
### Added
@@ -135,7 +146,8 @@ this project uses date-based 'snapshot' version identifiers.
- Include `l3backend` in file names
- Moved backend code to internal for each 'parent' module
-[Unreleased]: https://github.com/latex3/latex3/compare/2021-01-09...HEAD
+[Unreleased]: https://github.com/latex3/latex3/compare/2020-01-29...HEAD
+[2020-01-29]: https://github.com/latex3/latex3/compare/2021-01-09...2020-01-29
[2021-01-09]: https://github.com/latex3/latex3/compare/2020-09-24...2021-01-09
[2020-09-24]: https://github.com/latex3/latex3/compare/2020-09-11...2020-09-24
[2020-09-11]: https://github.com/latex3/latex3/compare/2020-09-01...2020-09-11
diff --git a/macros/latex/contrib/l3backend/README.md b/macros/latex/contrib/l3backend/README.md
index 21f57acd74..bc607bd543 100644
--- a/macros/latex/contrib/l3backend/README.md
+++ b/macros/latex/contrib/l3backend/README.md
@@ -1,7 +1,7 @@
LaTeX3 Backend Drivers
======================
-Release 2021-01-09
+Release 2020-01-29
This package forms parts of `expl3`, and contains the code used to interface
with backends (drivers) across the `expl3` codebase. The functions here are
@@ -11,6 +11,6 @@ on an independent schedule.
-----
-<p>Copyright (C) 2019-2021 The LaTeX3 Project <br />
+<p>Copyright (C) 2019-2021 The LaTeX Project <br />
<a href="http://latex-project.org/">http://latex-project.org/</a> <br />
All rights reserved.</p>
diff --git a/macros/latex/contrib/l3backend/l3backend-basics.dtx b/macros/latex/contrib/l3backend/l3backend-basics.dtx
index 9fad72c75d..0033514bdc 100644
--- a/macros/latex/contrib/l3backend/l3backend-basics.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-basics.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-basics.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -70,27 +70,27 @@
% \begin{macrocode}
\ProvidesExplFile
%<*dvipdfmx>
- {l3backend-dvipdfmx.def}{2021-01-09}{}
+ {l3backend-dvipdfmx.def}{2020-01-29}{}
{L3 backend support: dvipdfmx}
%</dvipdfmx>
%<*dvips>
- {l3backend-dvips.def}{2021-01-09}{}
+ {l3backend-dvips.def}{2020-01-29}{}
{L3 backend support: dvips}
%</dvips>
%<*dvisvgm>
- {l3backend-dvisvgm.def}{2021-01-09}{}
+ {l3backend-dvisvgm.def}{2020-01-29}{}
{L3 backend support: dvisvgm}
%</dvisvgm>
%<*luatex>
- {l3backend-luatex.def}{2021-01-09}{}
+ {l3backend-luatex.def}{2020-01-29}{}
{L3 backend support: PDF output (LuaTeX)}
%</luatex>
%<*pdftex>
- {l3backend-pdftex.def}{2021-01-09}{}
+ {l3backend-pdftex.def}{2020-01-29}{}
{L3 backend support: PDF output (pdfTeX)}
%</pdftex>
%<*xetex>
- {l3backend-xetex.def}{2021-01-09}{}
+ {l3backend-xetex.def}{2020-01-29}{}
{L3 backend support: XeTeX}
%</xetex>
% \end{macrocode}
diff --git a/macros/latex/contrib/l3backend/l3backend-box.dtx b/macros/latex/contrib/l3backend/l3backend-box.dtx
index 9fd7b70694..d47bd2ed7a 100644
--- a/macros/latex/contrib/l3backend/l3backend-box.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-box.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-box.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-code.pdf b/macros/latex/contrib/l3backend/l3backend-code.pdf
index f0a28c396f..2e72444e29 100644
--- a/macros/latex/contrib/l3backend/l3backend-code.pdf
+++ b/macros/latex/contrib/l3backend/l3backend-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/l3backend/l3backend-code.tex b/macros/latex/contrib/l3backend/l3backend-code.tex
index 55dce66e1f..d8a1ca7cf6 100644
--- a/macros/latex/contrib/l3backend/l3backend-code.tex
+++ b/macros/latex/contrib/l3backend/l3backend-code.tex
@@ -2,7 +2,7 @@
File: l3backend-code.tex
-Copyright (C) 2019 The LaTeX3 Project
+Copyright (C) 2019,2021 The LaTeX Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -44,6 +44,7 @@ for those people who are interested.
l3backend-draw.dtx ,
l3backend-graphics.dtx ,
l3backend-pdf.dtx ,
+ l3backend-opacity.dtx ,
l3backend-header.dtx
}
\ExplSyntaxOff
diff --git a/macros/latex/contrib/l3backend/l3backend-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index f3087b0904..9e19d8ac0a 100644
--- a/macros/latex/contrib/l3backend/l3backend-color.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-color.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-color.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -173,44 +173,81 @@
% state generally. The exact form depends on the engine, and for
% \texttt{dvipdfmx}/\XeTeX{} the backend version.
%
+% \subsubsection{Common code}
+%
+% \begin{macrocode}
+%<*dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_backend_stack_int}
+% \pdfTeX{}, \LuaTeX{} and recent \texttt{(x)dvipdfmx} have multiple stacks
+% available, and to track which one is in use a variable is required.
+% \begin{macrocode}
+\int_new:N \l_@@_backend_stack_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+%</dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
% \subsubsection{\texttt{dvipdfmx}/\XeTeX{}}
%
% \begin{macrocode}
%<*dvipdfmx|xetex>
% \end{macrocode}
%
-% \begin{macro}{\__kernel_color_stack_init:Nnn}
-% \begin{variable}{\g__color_stack_int}
+% \begin{macro}{\__kernel_color_backend_stack_init:Nnn}
+% \begin{variable}
+% {\g_@@_backend_stack_int, \c_@@_backend_main_stack_int}
% In \texttt{(x)dvipdfmx}, the base color stack is not set up, so we have to
% force that, as well as providing a mechanism more generally.
% \begin{macrocode}
-\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+\int_compare:nNnTF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ { \cs_new_protected:Npn \__kernel_color_backend_stack_init:Nnn #1#2#3 { } }
{
- \int_new:N \g__color_stack_int
- \cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+ \int_new:N \g_@@_backend_stack_int
+ \cs_new_protected:Npx \__kernel_color_backend_stack_init:Nnn #1#2#3
{
- \int_gincr:N \g__color_stack_int
- \int_const:Nn #1 { \g__color_stack_int }
- \__kernel_backend_literal:x
+ \int_gincr:N \exp_not:N \g_@@_backend_stack_int
+ \int_const:Nn #1 { \exp_not:N \g_@@_backend_stack_int }
+ \cs_if_exist:NTF \AtBeginDvi
+ { \exp_not:N \AtBeginDvi }
+ { \exp_not:N \use:n }
{
- pdfcolorstackinit ~
- \int_use:N \g__color_stack_int \c_space_tl
- \tl_if_blank:nF {#2} { #2 ~ }
- (#3)
+ \__kernel_backend_literal:x
+ {
+ pdfcolorstackinit ~
+ \exp_not:N \int_use:N \exp_not:N \g_@@_backend_stack_int
+ \c_space_tl
+ \exp_not:N \tl_if_blank:nF {#2} { #2 ~ }
+ (#3)
+ }
}
}
+ \cs_if_exist:cTF { main@pdfcolorstack }
+ {
+ \int_set:Nn \l_@@_backend_stack_int
+ { \int_use:c { main@pdfcolorstack } }
+ }
+ {
+ \__kernel_color_backend_stack_init:Nnn \c_@@_backend_main_stack_int
+ { page ~ direct } { 0 ~ g ~ 0 ~ G }
+ \int_set_eq:NN \l_@@_backend_stack_int
+ \c_@@_backend_main_stack_int
+ }
}
% \end{macrocode}
% \end{variable}
% \end{macro}
%
-% \begin{macro}{\__kernel_color_stack_push:nn}
-% \begin{macro}{\__kernel_color_stack_pop:n}
+% \begin{macro}{\@@_backend_stack_push:nn, \@@_backend_stack_push:nx}
+% \begin{macro}{\@@_backend_stack_pop:n}
% Simple enough but needs a version check.
% \begin{macrocode}
\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
- \cs_new_protected:Npn \__kernel_color_stack_push:nn #1#2
+ \cs_new_protected:Npn \@@_backend_stack_push:nn #1#2
{
\__kernel_backend_literal:x
{
@@ -219,7 +256,8 @@
push ~ (#2)
}
}
- \cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+ \cs_generate_variant:Nn \@@_backend_stack_push:nn { nx }
+ \cs_new_protected:Npn \@@_backend_stack_pop:n #1
{
\__kernel_backend_literal:x
{
@@ -243,9 +281,9 @@
%<*luatex|pdftex>
% \end{macrocode}
%
-% \begin{macro}{\__kernel_color_stack_init:Nnn}
+% \begin{macro}{\__kernel_color_backend_stack_init:Nnn}
% \begin{macrocode}
-\cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+\cs_new_protected:Npn \__kernel_color_backend_stack_init:Nnn #1#2#3
{
\int_const:Nn #1
{
@@ -262,10 +300,10 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\__kernel_color_stack_push:nn}
-% \begin{macro}{\__kernel_color_stack_pop:n}
+% \begin{macro}{\@@_backend_stack_push:nn, \@@_backend_stack_push:nx}
+% \begin{macro}{\@@_backend_stack_pop:n}
% \begin{macrocode}
-\cs_new_protected:Npn \__kernel_color_stack_push:nn #1#2
+\cs_new_protected:Npn \@@_backend_stack_push:nn #1#2
{
%<*luatex>
\tex_pdfextension:D colorstack ~
@@ -275,7 +313,8 @@
%</pdftex>
\int_eval:n {#1} ~ push ~ {#2}
}
-\cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+\cs_generate_variant:Nn \@@_backend_stack_push:nn { nx }
+\cs_new_protected:Npn \@@_backend_stack_pop:n #1
{
%<*luatex>
\tex_pdfextension:D colorstack ~
@@ -309,7 +348,7 @@
% \@@_backend_select:n
% }
% \begin{macro}{\@@_backend_reset:}
-% \begin{macro}{color.sc, color.fc}
+% \begin{macro}{color.sc}
% Push the data to the stack. In the case of \texttt{dvips} also saves the
% drawing color in raw PostScript.
% \begin{macrocode}
@@ -323,8 +362,7 @@
{
\__kernel_backend_literal:n { color~push~ #1 }
%<*dvips>
- \__kernel_backend_postscript:n { /color.sc~ { ~ } ~def }
- \__kernel_backend_postscript:n { /color.fc~ { ~ } ~def }
+ \__kernel_backend_postscript:n { /color.sc ~ { } ~ def }
%</dvips>
\group_insert_after:N \@@_backend_reset:
}
@@ -345,11 +383,10 @@
%<*dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
%
-% \begin{variable}{\l__kernel_color_stack_int}
-% \pdfTeX{}, \LuaTeX{} and recent \texttt{(x)dvipdfmx} have multiple stacks
-% available, and to track which one is in use a variable is required.
+% \begin{variable}{\l_@@_backend_fill_tl, \l_@@_backend_stroke_tl}
% \begin{macrocode}
-\int_new:N \l__kernel_color_stack_int
+\tl_new:N \l_@@_backend_fill_tl
+\tl_new:N \l_@@_backend_stroke_tl
% \end{macrocode}
% \end{variable}
%
@@ -359,25 +396,29 @@
% \@@_backend_select_gray:n ,
% \@@_backend_select_rgb:n
% }
+% \begin{macro}{\@@_backend_select:nn}
% \begin{macro}{\@@_backend_reset:}
-% Simply dump the data, but allowing for \LuaTeX{}.
+% Store the values then pass to the stack.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
- { \@@_backend_select:n { #1 ~ k ~ #1 ~ K } }
+ { \@@_backend_select:nn { #1 ~ k } { #1 ~ K } }
\cs_new_protected:Npn \@@_backend_select_gray:n #1
- { \@@_backend_select:n { #1 ~ g ~ #1 ~ G } }
+ { \@@_backend_select:nn { #1 ~ g } { #1 ~ G } }
\cs_new_protected:Npn \@@_backend_select_rgb:n #1
- { \@@_backend_select:n { #1 ~ rg ~ #1 ~ RG } }
-\cs_new_protected:Npn \@@_backend_select:n #1
+ { \@@_backend_select:nn { #1 ~ rg } { #1 ~ RG } }
+\cs_new_protected:Npn \@@_backend_select:nn #1#2
{
- \__kernel_color_stack_push:nn \l__kernel_color_stack_int {#1}
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#2}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int { #1 ~ #2 }
\group_insert_after:N \@@_backend_reset:
}
\cs_new_protected:Npn \@@_backend_reset:
- { \__kernel_color_stack_pop:n \l__kernel_color_stack_int }
+ { \@@_backend_stack_pop:n \l_@@_backend_stack_int }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
%</dvipdfmx|luatex|pdftex|xetex>
@@ -733,7 +774,7 @@
% we share the same code as for \pdfTeX{}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2
- { \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } }
+ { \@@_backend_select:nn { /#1 ~ cs ~ #2 ~ scn } { /#1 ~ CS ~ #2 ~ SCN } }
\cs_new_eq:NN \@@_backend_select_devicen:nn \@@_backend_select_separation:nn
% \end{macrocode}
% \end{macro}
@@ -876,6 +917,28 @@
%</dvipdfmx|luatex|pdftex|xetex>
% \end{macrocode}
%
+% \begin{macrocode}
+%<*dvipdfmx|xetex>
+% \end{macrocode}
+%
+% \begin{macro}{\@@_backend_select_separation:nn, \@@_backend_select_devicen:nn}
+% For older \texttt{(x)dvipdfmx}, we \emph{could} support separations using a
+% dedicated mechanism, but it was not added that long before the color
+% stacks. So instead of having two complex paths, just disable here.
+% \begin{macrocode}
+\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ {
+ \cs_gset_protected:Npn \@@_backend_select_separation:nn #1#2 { }
+ \cs_gset_eq:NN \@@_backend_select_devicen:nn
+ \@@_backend_select_separation:nn
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|xetex>
+% \end{macrocode}
+%
% \subsection{Fill and stroke color}
%
% Here, \texttt{dvipdfmx}/\XeTeX{} follows \LuaTeX{} and \pdfTeX{},
@@ -892,9 +955,11 @@
% \@@_backend_fill_cmyk:n ,
% \@@_backend_fill_gray:n ,
% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n ,
% \@@_backend_stroke_cmyk:n ,
% \@@_backend_stroke_gray:n ,
-% \@@_backend_stroke_rgb:n
+% \@@_backend_stroke_rgb:n ,
+% \@@_backend_stroke:n
% }
% Drawing (fill/stroke) color is handled in \texttt{dvipdfmx}/\XeTeX{} in the
% same way as \LuaTeX{}/\pdfTeX{}. We use the same approach as earlier, except the
@@ -903,17 +968,31 @@
% automatically.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ k } }
+ { \@@_backend_fill:n { #1 ~ k } }
\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ g } }
+ { \@@_backend_fill:n { #1 ~ g } }
\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ rg } }
- \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ K } }
+ { \@@_backend_fill:n { #1 ~ rg } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int
+ { #1 ~ \l_@@_backend_stroke_tl }
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
+ { \@@_backend_stroke:n { #1 ~ K } }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ G } }
+ { \@@_backend_stroke:n { #1 ~ G } }
\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1
- { \__kernel_backend_literal_pdf:n { #1 ~ RG } }
+ { \@@_backend_stroke:n { #1 ~ RG } }
+\cs_new_protected:Npn \@@_backend_stroke:n #1
+ {
+ \tl_set:Nn \l_@@_backend_stroke_tl {#1}
+ \@@_backend_stack_push:nn \l_@@_backend_stack_int
+ { \l_@@_backend_fill_tl \c_space_tl #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
% \end{macrocode}
% \end{macro}
%
@@ -926,9 +1005,9 @@
% }
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2
- { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } }
+ { \@@_backend_fill:n { /#1 ~ cs ~ #2 ~ scn } }
\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2
- { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } }
+ { \@@_backend_stroke:n { /#1 ~ CS ~ #2 ~ SCN } }
\cs_new_eq:NN \@@_backend_fill_devicen:nn \@@_backend_fill_separation:nn
\cs_new_eq:NN \@@_backend_stroke_devicen:nn \@@_backend_stroke_separation:nn
% \end{macrocode}
@@ -939,6 +1018,52 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<*dvipdfmx|xetex>
+% \end{macrocode}
+%
+% \begin{macro}
+% {
+% \@@_backend_fill_cmyk:n ,
+% \@@_backend_fill_gray:n ,
+% \@@_backend_fill_rgb:n
+% }
+% \begin{macro}{\@@_backend_reset:}
+% \begin{macro}{\@@_backend_stroke:n}
+% \begin{macro}{\@@_backend_fill_separation:nn, \@@_backend_stroke_separation:nn}
+% Deal with older \texttt{(x)dvipdfmx}.
+% \begin{macrocode}
+\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ {
+ \cs_gset_protected:Npn \@@_backend_fill_cmyk:n #1
+ {
+ \__kernel_backend_literal:n { pdf: bc ~ [#1] }
+ \group_insert_after:N \@@_backend_reset:
+ }
+ \cs_gset_eq:NN \@@_backend_fill_gray:n \@@_backend_fill_cmyk:n
+ \cs_gset_eq:NN \@@_backend_fill_rgb:n \@@_backend_fill_cmyk:n
+ \cs_gset_protected:Npn \@@_backend_reset:
+ { \__kernel_backend_literal:n { pdf: ec } }
+ \cs_gset_protected:Npn \@@_backend_stroke:n #1
+ { \__kernel_backend_literal:n {#1} }
+ \cs_gset_protected:Npn \@@_backend_fill_separation:nn #1#2 { }
+ \cs_gset_eq:NN \@@_backend_fill_devicen:nn
+ \@@_backend_fill_separation:nn
+ \cs_gset_eq:NN \@@_backend_stroke_separation:nn
+ \@@_backend_fill_separation:nn
+ \cs_gset_eq:NN \@@_backend_stroke_devicen:nn
+ \@@_backend_stroke_separation:nn
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|xetex>
+% \end{macrocode}
+%
+% \begin{macrocode}
%<*dvips>
% \end{macrocode}
%
@@ -947,19 +1072,26 @@
% \@@_backend_fill_cmyk:n ,
% \@@_backend_fill_gray:n ,
% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n ,
% \@@_backend_stroke_cmyk:n ,
% \@@_backend_stroke_gray:n ,
% \@@_backend_stroke_rgb:n
% }
-% All questions of saving the non-stacked data.
+% Fill color here is the same as general color \emph{except} we skip the
+% stroke part.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setcmykcolor } def } }
+ { \@@_backend_fill:n { cmyk ~ #1 } }
\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setgray } def } }
+ { \@@_backend_fill:n { gray ~ #1 } }
\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \__kernel_backend_postscript:n { /color.fc { #1 ~ setrgbcolor } def } }
- \cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
+ { \@@_backend_fill:n { rgb ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \__kernel_backend_literal:n { color~push~ #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
{ \__kernel_backend_postscript:n { /color.sc { #1 ~ setcmykcolor } def } }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
{ \__kernel_backend_postscript:n { /color.sc { #1 ~ setgray } def } }
@@ -977,9 +1109,9 @@
% }
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_fill_separation:nn #1#2
- { \__kernel_backend_postscript:n { /color.fc { #1 } def } }
+ { \@@_backend_fill:n { separation ~ #1 ~ #2 } }
\cs_new_protected:Npn \@@_backend_stroke_separation:nn #1#2
- { \__kernel_backend_postscript:n { /color.sc { #1 } def } }
+ { \__kernel_backend_postscript:n { /color.sc { separation ~ #1 ~ #2 } def } }
\cs_new_eq:NN \@@_backend_fill_devicen:nn \@@_backend_fill_separation:nn
\cs_new_eq:NN \@@_backend_stroke_devicen:nn \@@_backend_stroke_separation:nn
% \end{macrocode}
@@ -996,84 +1128,84 @@
% \begin{macro}
% {
% \@@_backend_fill_cmyk:n ,
-% \@@_backend_stroke_cmyk:n
-% }
-% \begin{macro}{\@@_backend_cmyk:nw}
-% \begin{macro}
-% {
% \@@_backend_fill_gray:n ,
-% \@@_backend_stroke_gray:n
-% }
-% \begin{macro}{\@@_backend_gray:nn, \@@_backend_gray_aux:n}
-% \begin{macro}
-% {
-% \@@_backend_fill_rgb:n ,
-% \@@_backend_stroke_rgb:n
+% \@@_backend_fill_rgb:n ,
+% \@@_backend_fill:n
% }
-% \begin{macro}{\@@_backend_rgb:nw}
-% \begin{macro}{\@@_backend:nnnn}
-% For drawings in SVG, we use scopes for all colors. That
+% Fill color here is the same as general color \emph{except} we skip the
+% stroke part.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
+ { \@@_backend_fill:n { cmyk ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill_gray:n #1
+ { \@@_backend_fill:n { gray ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
+ { \@@_backend_fill:n { rgb ~ #1 } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \__kernel_backend_literal:n { color~push~ #1 }
+ \group_insert_after:N \@@_backend_reset:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_backend_stroke_cmyk:n}
+% \begin{macro}{\@@_backend_stroke_cmyk:w}
+% \begin{macro}{\@@_backend_stroke_gray:n, \@@_backend_stroke_gray_aux:n}
+% \begin{macro}{\@@_backend_stroke_rgb:n}
+% \begin{macro}{\@@_backend_stroke_rgb:w}
+% \begin{macro}{\@@_backend:nnn}
+% For drawings in SVG, we use scopes for all stroke colors. That
% requires using \texttt{RGB} values, which luckily are easy to
% convert here (|cmyk| to |RGB| is a fixed function).
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_fill_cmyk:n #1
- { \@@_backend_cmyk:nw { fill } #1 \s_@@_stop }
\cs_new_protected:Npn \@@_backend_stroke_cmyk:n #1
- { \@@_backend_cmyk:nw { stroke } #1 \s_@@_stop }
-\cs_new_protected:Npn \@@_backend_cmyk:nw
- #1#2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+ { \@@_backend_cmyk:w #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_cmyk:w
+ #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
{
\use:x
{
- \@@_backend:nnnn
- {#1}
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #5 ) ) } }
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #5 ) ) } }
- { \fp_eval:n { -100 * ( 1 - min ( 1 , #4 + #5 ) ) } }
+ \@@_backend:nnn
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #1 + #4 ) ) } }
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #4 ) ) } }
+ { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #4 ) ) } }
}
}
-\cs_new_protected:Npn \@@_backend_fill_gray:n #1
- { \@@_backend_grab:nn { fill } {#1} }
\cs_new_protected:Npn \@@_backend_stroke_gray:n #1
- { \@@_backend_grab:nn { stroke } {#1} }
-\cs_new_protected:Npn \@@_backend_gray:nn #1#2
{
\use:x
{
- \@@_backend_gray_aux:nn
- {#1}
- { \fp_eval:n { 100 * (#2) } }
+ \@@_backend_stroke_gray_aux:n
+ { \fp_eval:n { 100 * (#1) } }
}
}
-\cs_new_protected:Npn \@@_backend_gray_aux:nn #1#2
- { \@@_backend:nnn {#1} {#2} {#2} {#2} }
-\cs_new_protected:Npn \@@_backend_fill_rgb:n #1
- { \@@_backend_rgb:nw { fill } #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_gray_aux:n #1
+ { \@@_backend:nnn {#1} {#1} {#1} }
\cs_new_protected:Npn \@@_backend_stroke_rgb:n #1
- { \@@_backend_rgb:nw { stroke } #1 \s_@@_stop }
-\cs_new_protected:Npn \@@_backend_rgb:nw
- #1#2 ~ #3 ~ #4\s_@@_stop
+ { \@@_backend_rgb:w #1 \s_@@_stop }
+\cs_new_protected:Npn \@@_backend_stroke_rgb:w
+ #1 ~ #2 ~ #3 \s_@@_stop
{
\use:x
{
- \@@_backend:nnnn
- { fill }
+ \@@_backend:nnn
+ { \fp_eval:n { 100 * (#1) } }
{ \fp_eval:n { 100 * (#2) } }
{ \fp_eval:n { 100 * (#3) } }
- { \fp_eval:n { 100 * (#4) } }
}
}
-\cs_new_protected:Npx \@@_backend:nnnn #1#2#3#4
+\cs_new_protected:Npx \@@_backend:nnn #1#2#3
{
\__kernel_backend_scope:n
{
- #1 =
+ stroke =
"
rgb
(
+ #1 \c_percent_str ,
#2 \c_percent_str ,
- #3 \c_percent_str ,
- #4 \c_percent_str
+ #3 \c_percent_str
)
"
}
@@ -1085,7 +1217,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}
% {
diff --git a/macros/latex/contrib/l3backend/l3backend-draw.dtx b/macros/latex/contrib/l3backend/l3backend-draw.dtx
index 2951e21504..8992c92d68 100644
--- a/macros/latex/contrib/l3backend/l3backend-draw.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-draw.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-draw.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -221,14 +221,11 @@
}
\cs_new_protected:Npn \@@_backend_fill:
{
- \@@_backend_literal:n { gsave }
- \@@_backend_literal:n { color.fc }
\@@_backend_literal:x
{
\bool_if:NT \g_@@_draw_eor_bool { eo }
fill
}
- \@@_backend_literal:n { grestore }
\bool_if:NT \g_@@_draw_clip_bool
{
\@@_backend_literal:x
@@ -242,16 +239,15 @@
}
\cs_new_protected:Npn \@@_backend_fillstroke:
{
- \@@_backend_literal:n { gsave }
- \@@_backend_literal:n { color.sc }
- \@@_backend_literal:n { color.fc }
\@@_backend_literal:x
{
\bool_if:NT \g_@@_draw_eor_bool { eo }
fill
}
- \@@_backend_literal:n { grestore }
+ \@@_backend_literal:n { gsave }
+ \@@_backend_literal:n { color.sc }
\@@_backend_literal:n { stroke }
+ \@@_backend_literal:n { grestore }
\bool_if:NT \g_@@_draw_clip_bool
{
\@@_backend_literal:x
diff --git a/macros/latex/contrib/l3backend/l3backend-graphics.dtx b/macros/latex/contrib/l3backend/l3backend-graphics.dtx
index 7d288ac17d..b0881891f2 100644
--- a/macros/latex/contrib/l3backend/l3backend-graphics.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-graphics.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-graphics.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-header.dtx b/macros/latex/contrib/l3backend/l3backend-header.dtx
index 80dac57f72..269214356a 100644
--- a/macros/latex/contrib/l3backend/l3backend-header.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-header.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-header.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -59,11 +59,10 @@
%<*dvips&header>
% \end{macrocode}
%
-% \begin{macro}{color.sc, color.fc}
-% Empty definitions for color at the top level.
+% \begin{macro}{color.sc}
+% Empty definition for color at the top level.
% \begin{macrocode}
/color.sc { } def
-/color.fc { } def
% \end{macrocode}
% \end{macro}
%
diff --git a/macros/latex/contrib/l3backend/l3backend-opacity.dtx b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
new file mode 100644
index 0000000000..62317fa8b4
--- /dev/null
+++ b/macros/latex/contrib/l3backend/l3backend-opacity.dtx
@@ -0,0 +1,286 @@
+% \iffalse meta-comment
+%
+%% File: l3backend-opacity.dtx
+%
+% Copyright (C) 2021 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% https://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3backend bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
+%
+%<*driver>
+\documentclass[full,kernel]{l3doc}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+% The \textsf{l3backend-opacity} package\\ Backend opacity support^^A
+% }
+%
+% \author{^^A
+% The \LaTeX{} Project\thanks
+% {^^A
+% E-mail:
+% \href{mailto:latex-team@latex-project.org}
+% {latex-team@latex-project.org}^^A
+% }^^A
+% }
+%
+% \date{Released 2020-01-29}
+%
+% \maketitle
+%
+% \begin{documentation}
+%
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3backend-opacity} Implementation}
+%
+% \begin{macrocode}
+%<*package>
+%<@@=opacity>
+% \end{macrocode}
+%
+% Although opacity is not color, it needs to be managed in a somewhat
+% similar way: using a dedicated stack if possible. Depending on the backend,
+% that may not be possible. There is also the need to cover fill/stroke setting
+% as well as more general running opacity. It is easiest to describe the value
+% used in terms of opacity, although commonly this is referred to as
+% transparency.
+%
+% \begin{macrocode}
+%<*dvips>
+% \end{macrocode}
+%
+% \begin{macro}{\@@_backend_select:n,\@@_backend_select_aux:n}
+% No stack so set values directly.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select:n #1
+ {
+ \exp_args:Nx \@@_backend_select_aux:n
+ { \fp_eval:n { min(max(0,#1),1) } }
+ }
+\cs_new_protected:Npn \@@_backend_select_aux:n #1
+ {
+ \__kernel_backend_postscript:n
+ { #1 ~ .setfillconstantalpha ~ #1 ~ .setstrokeconstantalpha }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
+% \begin{macro}{\@@_backend:nn, \@@_backend:xn}
+% Similar to the above but with no stack and only adding to one or other of
+% the entries.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ { \@@_backend:xn { \fp_eval:n { min(max(0,#1),1) } } { fill } }
+\cs_new_protected:Npn \@@_backend_stroke:n #1
+ { \@@_backend:xn { \fp_eval:n { min(max(0,#1),1) } } { stroke } }
+\cs_new_protected:Npn \@@_backend:nn #1#2
+ {
+ \__kernel_backend_postscript:n { #1 ~ .set #2 constantalpha }
+ }
+\cs_generate_variant:Nn \@@_backend:nn { x }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvips>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
+% \begin{variable}{\c_@@_backend_stack_int}
+% Set up a stack.
+% \begin{macrocode}
+\cs_if_exist:NT \pdfmanagement_add:nnn
+ {
+ \__kernel_color_backend_stack_init:Nnn \c_@@_backend_stack_int
+ { page ~ direct } { /opacity 1 ~ gs }
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity 1 } { << /ca ~ 1 /CA ~ 1 >> }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_backend_fill_tl, \l_@@_backend_stroke_tl}
+% We use |tl| here for speed: at the backend, this should be reasonable.
+% \begin{macrocode}
+\tl_new:N \l_@@_backend_fill_tl
+\tl_new:N \l_@@_backend_stroke_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_backend_select:n, \@@_backend_select_aux:n}
+% \begin{macro}{\@@_backend_reset:}
+% Other than the need to evaluate the opacity as an \texttt{fp}, much the
+% same as color.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select:n #1
+ {
+ \exp_args:Nx \@@_backend_select_aux:n
+ { \fp_eval:n { min(max(0,#1),1) } }
+ }
+\cs_new_protected:Npn \@@_backend_select_aux:n #1
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#1}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity #1 }
+ { << /ca ~ #1 /CA ~ #1 >> }
+ \@@_backend_stack_push:nn \c_@@_backend_stack_int
+ { /opacity #1 ~ gs }
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_if_exist:NF \pdfmanagement_add:nnn
+ {
+ \cs_gset_protected:Npn \@@_backend_select_aux:n #1 { }
+ }
+\cs_new_protected:Npn \@@_backend_reset:
+ { \@@_backend_stack_pop:n \c_@@_backend_stack_int }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_backend_fill:n, \@@_backend_stroke:n}
+% \begin{macro}{\@@_backend_fillstroke:nn, \@@_backend_fillstroke:xx}
+% For separate fill and stroke, we need to work out if we need to do
+% more work or if we can stick to a single setting.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ {
+ \@@_backend_fill_stroke:xx
+ { \fp_eval:n { min(max(0,#1),1) } }
+ \l_@@_backend_stroke_tl
+ }
+\cs_new_protected:Npn \@@_backend_stroke:n #1
+ {
+ \@@_backend_fill_stroke:xx
+ \l_@@_backend_fill_tl
+ { \fp_eval:n { min(max(0,#1),1) } }
+ }
+\cs_new_protected:Npn \@@_backend_fill_stroke:nn #1#2
+ {
+ \str_if_eq:nnTF {#1} {#2}
+ { \@@_backend_select_aux:n {#1} }
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#2}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.fill #1 }
+ { << /ca ~ #1 >> }
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.stroke #1 }
+ { << /CA ~ #2 >> }
+ \@@_backend_stack_push:nn \c_@@_backend_stack_int
+ { /opacity.fill #1 ~ gs /opacity.stroke #2 ~ gs }
+ \group_insert_after:N \@@_backend_reset:
+ }
+ }
+\cs_generate_variant:Nn \@@_backend_fill_stroke:nn { xx }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*dvipdfmx|xdvipdfmx>
+% \end{macrocode}
+%
+% \begin{macro}{\@@_backend_select:n}
+% Older backends have no stack support, so everything is done directly.
+% \begin{macrocode}
+\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ {
+ \cs_gset_protected:Npn \@@_backend_select_aux:n #1
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#1}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity #1 }
+ { << /ca ~ #1 /CA ~ #1 >> }
+ \__kernel_backend_literal_pdf:n { /opacity #1 ~ gs }
+ }
+ \cs_gset_protected:Npn \@@_backend_fill_stroke:nn #1#2
+ {
+ \str_if_eq:nnTF {#1} {#2}
+ { \@@_backend_select_aux:n {#1} }
+ {
+ \tl_set:Nn \l_@@_backend_fill_tl {#1}
+ \tl_set:Nn \l_@@_backend_stroke_tl {#2}
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.fill #1 }
+ { << /ca ~ #1 >> }
+ \pdfmanagement_add:nnn { Page / Resources / ExtGState }
+ { opacity.stroke #1 }
+ { << /CA ~ #2 >> }
+ \__kernel_backend_literal_pdf:n
+ { /opacity.fill #1 ~ gs /opacity.stroke #2 ~ gs }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|xdvipdfmx>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*dvisvgm>
+% \end{macrocode}
+%
+% \begin{macro}{\@@_backend_select:n, \@@_backend_fill:n, \@@_backend_stroke:n}
+% \begin{macro}{\@@_backend:nn}
+% Once again, we use a scope here. There is a general opacity function for
+% SVG, but that is of course not set up using the stack.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select:n #1
+ { \@@_backend:nn {#1} { } }
+\cs_new_protected:Npn \@@_backend_fill:n #1
+ { \@@_backend:nn {#1} { fill- } }
+\cs_new_protected:Npn \@@_backend_stroke:n #1
+ { \@@_backend:nn { {#1} } { stroke- } }
+\cs_new_protected:Npn \@@_backend:nn #1#2
+ { \__kernel_backend_scope:x { #2 opacity = " \fp_eval:n { min(max(0,#1),1) } " } }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvisvgm>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/macros/latex/contrib/l3backend/l3backend-pdf.dtx b/macros/latex/contrib/l3backend/l3backend-pdf.dtx
index e74ac8286b..226f864933 100644
--- a/macros/latex/contrib/l3backend/l3backend-pdf.dtx
+++ b/macros/latex/contrib/l3backend/l3backend-pdf.dtx
@@ -2,7 +2,7 @@
%
%% File: l3backend-pdf.dtx
%
-% Copyright (C) 2019-2021 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@
% }
%
% \author{^^A
-% The \LaTeX3 Project\thanks
+% The \LaTeX{} Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2021-01-09}
+% \date{Released 2020-01-29}
%
% \maketitle
%
@@ -616,11 +616,12 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_destination:nn, \@@_backend_destination_box:nn}
+% \begin{macro}{\@@_backend_destination:nn}
+% \begin{macro}{\@@_backend_destination:nnnn, \@@_backend_destination_aux:nnnn}
% Here, we need to turn the zoom into a scale. We also need to know where
% the current anchor point actually is: worked out in PostScript. For the
% rectangle version, we have a bit more PostScript: we need two points.
-% fitr without rule spec doesn't work, so it falls back to /Fit here.
+% fitr without rule spec doesn't work, so it falls back to \texttt{/Fit} here.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_destination:nn #1#2
{
@@ -648,32 +649,42 @@
/DEST
}
}
-\cs_new_protected:Npn \@@_backend_destination_box:nn #1#2
- {
- \group_begin:
- \hbox_set:Nn \l_@@_internal_box {#2}
- \box_move_down:nn
- { \box_dp:N \l_@@_internal_box }
- { \hbox:n { \__kernel_backend_postscript:n { pdf.save.ll } } }
- \box_use:N \l_@@_internal_box
- \box_move_up:nn
- { \box_ht:N \l_@@_internal_box }
- { \hbox:n { \__kernel_backend_postscript:n { pdf.save.ur } } }
- \@@_backend_pdfmark:n
- {
- /View
- [
- /FitR ~
- pdf.llx ~ pdf.lly ~ pdf.dest2device ~
- pdf.urx ~ pdf.ury ~ pdf.dest2device
- ]
- /Dest ( #1 ) cvn
- /DEST
- }
- \group_end:
+\cs_new_protected:Npn \@@_backend_destination:nnnn #1#2#3#4
+ {
+ \exp_args:Ne \@@_backend_destination_aux:nnnn
+ { \dim_eval:n {#2} } {#1} {#3} {#4}
+ }
+\cs_new_protected:Npn \@@_backend_destination_aux:nnnn #1#2#3#4
+ {
+ \vbox_to_zero:n
+ {
+ \tex_kern:D \dim_eval:n {#4} \scan_stop:
+ \hbox:n { \__kernel_backend_postscript:n { pdf.save.ll } }
+ \tex_vss:D
+ }
+ \tex_kern:D #1 \scan_stop:
+ \vbox_to_zero:n
+ {
+ \tex_kern:D \dim_eval:n { -#3 } \scan_stop:
+ \hbox:n { \__kernel_backend_postscript:n { pdf.save.ur } }
+ \tex_vss:D
+ }
+ \tex_kern:D -#1 \scan_stop:
+ \@@_backend_pdfmark:n
+ {
+ /View
+ [
+ /FitR ~
+ pdf.llx ~ pdf.lly ~ pdf.dest2device ~
+ pdf.urx ~ pdf.ury ~ pdf.dest2device
+ ]
+ /Dest ( #2 ) cvn
+ /DEST
+ }
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsubsection{Structure}
%
@@ -859,7 +870,8 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_destination:nn, \@@_backend_destination_box:nn}
+% \begin{macro}{\@@_backend_destination:nn}
+% \begin{macro}{\@@_backend_destination:nnnn}
% A simple task: pass the data to the primitive. The |\scan_stop:| deals
% with the danger of an unterminated keyword. The zoom given here is a
% percentage, but we need to pass it as \emph{per mille}. The rectangle
@@ -888,26 +900,23 @@
{ xyz ~ zoom \fp_eval:n { #2 * 10 } }
\scan_stop:
}
-\cs_new_protected:Npn \@@_backend_destination_box:nn #1#2
+\cs_new_protected:Npn \@@_backend_destination:nnnn #1#2#3#4
{
- \group_begin:
- \hbox_set:Nn \l_@@_internal_box {#2}
%<*luatex>
- \tex_pdfextension:D dest ~
+ \tex_pdfextension:D dest ~
%</luatex>
%<*pdftex>
- \tex_pdfdest:D
+ \tex_pdfdest:D
%</pdftex>
- name {#1}
- fitr ~
- width \box_wd:N \l_@@_internal_box
- height \box_ht:N \l_@@_internal_box
- depth \box_dp:N \l_@@_internal_box
- \box_use:N \l_@@_internal_box
- \group_end:
+ name {#1}
+ fitr ~
+ width \dim_eval:n {#2} ~
+ height \dim_eval:n {#3} ~
+ depth \dim_eval:n {#4} \scan_stop:
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsubsection{Catalogue entries}
%
@@ -1475,11 +1484,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_backend_destination:nn, \@@_backend_destination_box:nn}
+% \begin{macro}{\@@_backend_destination:nn}
+% \begin{macro}{\@@_backend_destination:nnnn,\@@_backend_destination_aux:nnnn}
% Here, we need to turn the zoom into a scale. The method for \texttt{FitR}
% is from Alexander Grahn: the idea is to avoid needing to do any calculations
% in \TeX{} by using the backend data for \texttt{@xpos} and \texttt{@ypos}.
-% fitr without rule spec doesn't work, so it falls back to /Fit here.
+% \texttt{/FitR} without rule spec doesn't work, so it falls back to
+% \texttt{/Fit} here.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_destination:nn #1#2
{
@@ -1503,39 +1514,47 @@
]
}
}
-\cs_new_protected:Npn \@@_backend_destination_box:nn #1#2
+\cs_new_protected:Npn \@@_backend_destination:nnnn #1#2#3#4
{
- \group_begin:
- \hbox_set:Nn \l_@@_internal_box {#2}
- \box_move_down:nn { \box_dp:N \l_@@_internal_box }
- {
- \hbox:n
- {
- \@@_backend:n { obj ~ @pdf_ #1 _llx ~ @xpos }
- \@@_backend:n { obj ~ @pdf_ #1 _lly ~ @ypos }
- }
- }
- \box_use:N \l_@@_internal_box
- \box_move_up:nn { \box_ht:N \l_@@_internal_box }
- {
- \hbox:n
- {
- \@@_backend:n
- {
- dest ~ (#1)
- [
- @thispage
- /FitR ~
- @pdf_ #1 _llx ~ @pdf_ #1 _lly ~
- @xpos ~ @ypos
- ]
- }
- }
- }
- \group_end:
+ \exp_args:Ne \@@_backend_destination_aux:nnnn
+ { \dim_eval:n {#2} } {#1} {#3} {#4}
+ }
+\cs_new_protected:Npn \@@_backend_destination_aux:nnnn #1#2#3#4
+ {
+ \vbox_to_zero:n
+ {
+ \tex_kern:D \dim_eval:n {#4} \scan_stop:
+ \hbox:n
+ {
+ \@@_backend:n { obj ~ @pdf_ #2 _llx ~ @xpos }
+ \@@_backend:n { obj ~ @pdf_ #2 _lly ~ @ypos }
+ }
+ \tex_vss:D
+ }
+ \tex_kern:D #1 \scan_stop:
+ \vbox_to_zero:n
+ {
+ \tex_kern:D \dim_eval:n { -#3 } \scan_stop:
+ \hbox:n
+ {
+ \@@_backend:n
+ {
+ dest ~ (#2)
+ [
+ @thispage
+ /FitR ~
+ @pdf_ #2 _llx ~ @pdf_ #2 _lly ~
+ @xpos ~ @ypos
+ ]
+ }
+ }
+ \tex_vss:D
+ }
+ \tex_kern:D -#1 \scan_stop:
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsubsection{Structure}
%
diff --git a/macros/latex/contrib/l3backend/l3backend.ins b/macros/latex/contrib/l3backend/l3backend.ins
index ebce5ad026..7fced393bd 100644
--- a/macros/latex/contrib/l3backend/l3backend.ins
+++ b/macros/latex/contrib/l3backend/l3backend.ins
@@ -2,7 +2,7 @@
File l3backend.ins
-Copyright (C) 2019-2021 The LaTeX3 Project
+Copyright (C) 2019-2021 The LaTeX Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,7 +35,7 @@ license information is placed in the derived files.
\preamble
-Copyright (C) 1990-2021 The LaTeX3 Project
+Copyright (C) 1990-2021 The LaTeX Project
It may be distributed and/or modified under the conditions of
the LaTeX Project Public License (LPPL), either version 1.3c of
@@ -64,6 +64,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,dvipdfmx}
\from{l3backend-graphics.dtx}{package,dvipdfmx}
\from{l3backend-pdf.dtx} {package,dvipdfmx}
+ \from{l3backend-opacity.dtx} {package,dvipdfmx}
}
}
\generate
@@ -76,6 +77,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,dvips}
\from{l3backend-graphics.dtx}{package,dvips}
\from{l3backend-pdf.dtx} {package,dvips}
+ \from{l3backend-opacity.dtx} {package,dvips}
}
\file{l3backend-dvips.pro}
{
@@ -92,6 +94,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,dvisvgm}
\from{l3backend-graphics.dtx}{package,dvisvgm}
\from{l3backend-pdf.dtx} {package,dvisvgm}
+ \from{l3backend-opacity.dtx} {package,dvisvgm}
}
}
\generate
@@ -104,6 +107,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,luatex}
\from{l3backend-graphics.dtx}{package,luatex}
\from{l3backend-pdf.dtx} {package,luatex}
+ \from{l3backend-opacity.dtx} {package,luatex}
}
}
\generate
@@ -116,6 +120,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,pdftex}
\from{l3backend-graphics.dtx}{package,pdftex}
\from{l3backend-pdf.dtx} {package,pdftex}
+ \from{l3backend-opacity.dtx} {package,pdftex}
}
}
\generate
@@ -128,6 +133,7 @@ and all files in that bundle must be distributed together.
\from{l3backend-draw.dtx} {package,xetex}
\from{l3backend-graphics.dtx}{package,xetex}
\from{l3backend-pdf.dtx} {package,xetex}
+ \from{l3backend-opacity.dtx} {package,xetex}
}
}