summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-10 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2021-01-10 03:01:42 +0000
commitef57fc77f3c939d55d51322d428e40a5a3c9ed8e (patch)
treec296d1bf47b8ffa67bb75b1843c2e0786fb0634c /macros/latex/contrib/l3backend
parent0b5fb424a9fab0df06b2d7b9f8edc803cb89a760 (diff)
CTAN sync 202101100301
Diffstat (limited to 'macros/latex/contrib/l3backend')
-rw-r--r--macros/latex/contrib/l3backend/CHANGELOG.md13
-rw-r--r--macros/latex/contrib/l3backend/README.md4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-basics.dtx50
-rw-r--r--macros/latex/contrib/l3backend/l3backend-box.dtx4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-code.pdfbin773062 -> 786373 bytes
-rw-r--r--macros/latex/contrib/l3backend/l3backend-color.dtx382
-rw-r--r--macros/latex/contrib/l3backend/l3backend-draw.dtx4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-graphics.dtx4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-header.dtx4
-rw-r--r--macros/latex/contrib/l3backend/l3backend-pdf.dtx46
-rw-r--r--macros/latex/contrib/l3backend/l3backend.ins4
11 files changed, 343 insertions, 172 deletions
diff --git a/macros/latex/contrib/l3backend/CHANGELOG.md b/macros/latex/contrib/l3backend/CHANGELOG.md
index 61b75641de..242cacf93a 100644
--- a/macros/latex/contrib/l3backend/CHANGELOG.md
+++ b/macros/latex/contrib/l3backend/CHANGELOG.md
@@ -6,6 +6,16 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+## [2021-01-09]
+
+### Added
+- Support for referencing last link with `(x)dvipdfmx` (requires an up-to-date
+ backend)
+
+### Changed
+- Implementation of color wtih (x)dvipdfmx (requires an up-to-date
+ backend)
+
## [2020-09-24]
### Fixed
@@ -125,7 +135,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/2020-09-24...HEAD
+[Unreleased]: https://github.com/latex3/latex3/compare/2021-01-09...HEAD
+[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
[2020-09-01]: https://github.com/latex3/latex3/compare/2020-08-07...2020-09-01
diff --git a/macros/latex/contrib/l3backend/README.md b/macros/latex/contrib/l3backend/README.md
index 0d40ed996b..21f57acd74 100644
--- a/macros/latex/contrib/l3backend/README.md
+++ b/macros/latex/contrib/l3backend/README.md
@@ -1,7 +1,7 @@
LaTeX3 Backend Drivers
======================
-Release 2020-09-24
+Release 2021-01-09
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,2020 The LaTeX3 Project <br />
+<p>Copyright (C) 2019-2021 The LaTeX3 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 8b01e543ce..9fad72c75d 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
@@ -70,27 +70,27 @@
% \begin{macrocode}
\ProvidesExplFile
%<*dvipdfmx>
- {l3backend-dvipdfmx.def}{2020-09-24}{}
+ {l3backend-dvipdfmx.def}{2021-01-09}{}
{L3 backend support: dvipdfmx}
%</dvipdfmx>
%<*dvips>
- {l3backend-dvips.def}{2020-09-24}{}
+ {l3backend-dvips.def}{2021-01-09}{}
{L3 backend support: dvips}
%</dvips>
%<*dvisvgm>
- {l3backend-dvisvgm.def}{2020-09-24}{}
+ {l3backend-dvisvgm.def}{2021-01-09}{}
{L3 backend support: dvisvgm}
%</dvisvgm>
%<*luatex>
- {l3backend-luatex.def}{2020-09-24}{}
+ {l3backend-luatex.def}{2021-01-09}{}
{L3 backend support: PDF output (LuaTeX)}
%</luatex>
%<*pdftex>
- {l3backend-pdftex.def}{2020-09-24}{}
+ {l3backend-pdftex.def}{2021-01-09}{}
{L3 backend support: PDF output (pdfTeX)}
%</pdftex>
%<*xetex>
- {l3backend-xetex.def}{2020-09-24}{}
+ {l3backend-xetex.def}{2021-01-09}{}
{L3 backend support: XeTeX}
%</xetex>
% \end{macrocode}
@@ -348,8 +348,9 @@
% required.
%
% \begin{macro}{\__kernel_backend_literal_pdf:n, \__kernel_backend_literal_pdf:x}
-% Equivalent to \texttt{pdf:content} but favored as the link to
-% the \pdfTeX{} primitive approach is clearer.
+% Undocumented but equivalent to \pdfTeX{}'s |literal| keyword. It's similar to
+% be not the same as the documented |contents| keyword as that adds a |q|/|Q|
+% pair.
% \begin{macrocode}
\cs_new_protected:Npn \__kernel_backend_literal_pdf:n #1
{ \__kernel_backend_literal:n { pdf:literal~ #1 } }
@@ -379,6 +380,35 @@
% \end{macro}
%
% \begin{macrocode}
+%<@@=sys>
+% \end{macrocode}
+%
+% \begin{macro}{\c__kernel_sys_dvipdfmx_version_int}
+% A short excursion into the |sys| module to set up the backend version
+% information.
+% \begin{macrocode}
+\group_begin:
+ \cs_set:Npn \@@_tmp:w #1 Version ~ #2 ~ #3 \q_stop {#2}
+ \sys_get_shell:nnNTF { extractbb~--version }
+ { \char_set_catcode_space:n { `\ } }
+ \l_@@_internal_tl
+ {
+ \int_const:Nn \c__kernel_sys_dvipdfmx_version_int
+ {
+ \exp_after:wN \@@_tmp:w \l_@@_internal_tl
+ \q_stop
+ }
+ }
+ { \int_const:Nn \c__kernel_sys_dvipdfmx_version_int { 0 } }
+\group_end:
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%<@@=>
+% \end{macrocode}
+%
+% \begin{macrocode}
%</dvipdfmx|xetex>
% \end{macrocode}
%
diff --git a/macros/latex/contrib/l3backend/l3backend-box.dtx b/macros/latex/contrib/l3backend/l3backend-box.dtx
index e233c729f3..9fd7b70694 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-code.pdf b/macros/latex/contrib/l3backend/l3backend-code.pdf
index 0be885472a..f0a28c396f 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-color.dtx b/macros/latex/contrib/l3backend/l3backend-color.dtx
index baefde5d3c..f3087b0904 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
@@ -60,59 +60,16 @@
%<@@=color>
% \end{macrocode}
%
-% Color support is split into parts: general color, separations, and color for
+% Color support is split into parts: collecting data from \LaTeXe{}, the color stack, general color, separations, and color for
% drawings. We have different approaches in each backend, and have some choices
% to make about \texttt{dvipdfmx}/\XeTeX{} in particular. Whilst it is in some ways
% convenient to use the same approach in multiple backends, the fact that
% \texttt{dvipdfmx}/\XeTeX{} is PDF-based means it (largely) sticks closer to
% direct PDF output.
%
-% \subsection{\texttt{dvipmdfx}/\XeTeX{}}
+% \subsection{Collecting information from \LaTeXe{}}
%
-% \begin{macrocode}
-%<*dvipdfmx|xetex>
-% \end{macrocode}
-%
-% These backends have the most possible approaches: it recognises both
-% \texttt{dvips}-based color specials and it's own format, plus one can
-% include PDF statements directly. The latter are not subject to the stack,
-% so are not suitable for general use. Of the two stack methods, the dedicated
-% one has been extended to cover color spaces, so it is used in preference to
-% the \texttt{dvips} one.
-%
-% The \LaTeXe{} backend code uses \texttt{dvips}-based code with
-% \texttt{dvipmdfx}/\XeTeX{}, and so we leave getting color from \LaTeXe{} to
-% a shared code path below.
-%
-% \begin{macro}
-% {
-% \@@_backend_select_cmyk:n ,
-% \@@_backend_select_gray:n ,
-% \@@_backend_select_rgb:n
-% }
-% \begin{macro}{\@@_backend_reset:}
-% \begin{macro}{color.sc, color.fc}
-% Push the data to the stack.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
- {
- \__kernel_backend_literal:n { pdf: bc ~ [#1] }
- \group_insert_after:N \@@_backend_reset:
- }
-\cs_new_eq:NN \@@_backend_select_gray:n \@@_backend_select_cmyk:n
-\cs_new_eq:NN \@@_backend_select_rgb:n \@@_backend_select_cmyk:n
-\cs_new_protected:Npn \@@_backend_reset:
- { \__kernel_backend_literal:n { pdf: ec } }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-%</dvipdfmx|xetex>
-% \end{macrocode}
-%
-% \subsection{\texttt{dvips}-style}
+% \subsubsection{\texttt{dvips}-style}
%
% \begin{macrocode}
%<*dvisvgm|dvipdfmx|dvips|xetex>
@@ -128,7 +85,7 @@
\cs_new_protected:Npn \@@_backend_pickup:N #1 { }
\cs_if_exist:cT { ver@color.sty }
{
- \cs_set_protected:Npn \@@_backend_pickup:N #1
+ \cs_set_protected:Npn \@@_backend_pickup:N #1
{
\exp_args:NV \tl_if_head_is_space:nTF \current@color
{
@@ -154,49 +111,7 @@
%</dvisvgm|dvipdfmx|dvips|xetex>
% \end{macrocode}
%
-% \begin{macrocode}
-%<*dvisvgm|dvips>
-% \end{macrocode}
-%
-% \begin{macro}
-% {
-% \@@_backend_select_cmyk:n ,
-% \@@_backend_select_gray:n ,
-% \@@_backend_select_rgb:n ,
-% \@@_backend_select:n
-% }
-% \begin{macro}{\@@_backend_reset:}
-% \begin{macro}{color.sc, color.fc}
-% Push the data to the stack. In the case of \texttt{dvips} also saves the
-% drawing color in raw PostScript.
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
- { \@@_backend_select:n { cmyk ~ #1 } }
-\cs_new_protected:Npn \@@_backend_select_gray:n #1
- { \@@_backend_select:n { gray ~ #1 } }
-\cs_new_protected:Npn \@@_backend_select_rgb:n #1
- { \@@_backend_select:n { rgb ~ #1 } }
-\cs_new_protected:Npn \@@_backend_select:n #1
- {
- \__kernel_backend_literal:n { color~push~ #1 }
-%<*dvips>
- \__kernel_backend_postscript:n { /color.sc~ { ~ } ~def }
- \__kernel_backend_postscript:n { /color.fc~ { ~ } ~def }
-%</dvips>
- \group_insert_after:N \@@_backend_reset:
- }
-\cs_new_protected:Npn \@@_backend_reset:
- { \__kernel_backend_literal:n { color~pop } }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macrocode}
-%</dvisvgm|dvips>
-% \end{macrocode}
-%
-% \subsection{\LuaTeX{} and \pdfTeX{}}
+% \subsubsection{\LuaTeX{} and \pdfTeX{}}
%
% \begin{macrocode}
%<*luatex|pdftex>
@@ -247,9 +162,192 @@
% \end{macro}
% \end{macro}
%
+% \begin{macrocode}
+%</luatex|pdftex>
+% \end{macrocode}
+%
+% \subsection{The color stack}
+%
+% For PDF-based engines, we have a color stack available inside the specials.
+% This is used for concepts beyond color itself: it is needed to manage th graphics
+% state generally. The exact form depends on the engine, and for
+% \texttt{dvipdfmx}/\XeTeX{} the backend version.
+%
+% \subsubsection{\texttt{dvipdfmx}/\XeTeX{}}
+%
+% \begin{macrocode}
+%<*dvipdfmx|xetex>
+% \end{macrocode}
+%
+% \begin{macro}{\__kernel_color_stack_init:Nnn}
+% \begin{variable}{\g__color_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_new:N \g__color_stack_int
+ \cs_new_protected:Npn \__kernel_color_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
+ {
+ pdfcolorstackinit ~
+ \int_use:N \g__color_stack_int \c_space_tl
+ \tl_if_blank:nF {#2} { #2 ~ }
+ (#3)
+ }
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+% \end{macro}
+%
+% \begin{macro}{\__kernel_color_stack_push:nn}
+% \begin{macro}{\__kernel_color_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
+ {
+ \__kernel_backend_literal:x
+ {
+ pdfcolorstack ~
+ \int_eval:n {#1} ~
+ push ~ (#2)
+ }
+ }
+ \cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+ {
+ \__kernel_backend_literal:x
+ {
+ pdfcolorstack ~
+ \int_eval:n {#1} ~
+ pop
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|xetex>
+% \end{macrocode}
+%
+% \subsubsection{\LuaTeX and \pdfTeX{}}
+%
+% \begin{macrocode}
+%<*luatex|pdftex>
+% \end{macrocode}
+%
+% \begin{macro}{\__kernel_color_stack_init:Nnn}
+% \begin{macrocode}
+\cs_new_protected:Npn \__kernel_color_stack_init:Nnn #1#2#3
+ {
+ \int_const:Nn #1
+ {
+%<*luatex>
+ \tex_pdffeedback:D colorstackinit ~
+%</luatex>
+%<*pdftex>
+ \tex_pdfcolorstackinit:D
+%</pdftex>
+ \tl_if_blank:nF {#2} { #2 ~ }
+ {#3}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\__kernel_color_stack_push:nn}
+% \begin{macro}{\__kernel_color_stack_pop:n}
+% \begin{macrocode}
+\cs_new_protected:Npn \__kernel_color_stack_push:nn #1#2
+ {
+%<*luatex>
+ \tex_pdfextension:D colorstack ~
+%</luatex>
+%<*pdftex>
+ \tex_pdfcolorstack:D
+%</pdftex>
+ \int_eval:n {#1} ~ push ~ {#2}
+ }
+\cs_new_protected:Npn \__kernel_color_stack_pop:n #1
+ {
+%<*luatex>
+ \tex_pdfextension:D colorstack ~
+%</luatex>
+%<*pdftex>
+ \tex_pdfcolorstack:D
+%</pdftex>
+ \int_eval:n {#1} ~ pop \scan_stop:
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</luatex|pdftex>
+% \end{macrocode}
+%
+% \subsection{General color}
+%
+% \subsubsection{\texttt{dvips}-style}
+%
+% \begin{macrocode}
+%<*dvips|dvisvgm>
+% \end{macrocode}
+%
+% \begin{macro}
+% {
+% \@@_backend_select_cmyk:n ,
+% \@@_backend_select_gray:n ,
+% \@@_backend_select_rgb:n ,
+% \@@_backend_select:n
+% }
+% \begin{macro}{\@@_backend_reset:}
+% \begin{macro}{color.sc, color.fc}
+% Push the data to the stack. In the case of \texttt{dvips} also saves the
+% drawing color in raw PostScript.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_select_cmyk:n #1
+ { \@@_backend_select:n { cmyk ~ #1 } }
+\cs_new_protected:Npn \@@_backend_select_gray:n #1
+ { \@@_backend_select:n { gray ~ #1 } }
+\cs_new_protected:Npn \@@_backend_select_rgb:n #1
+ { \@@_backend_select:n { rgb ~ #1 } }
+\cs_new_protected:Npn \@@_backend_select:n #1
+ {
+ \__kernel_backend_literal:n { color~push~ #1 }
+%<*dvips>
+ \__kernel_backend_postscript:n { /color.sc~ { ~ } ~def }
+ \__kernel_backend_postscript:n { /color.fc~ { ~ } ~def }
+%</dvips>
+ \group_insert_after:N \@@_backend_reset:
+ }
+\cs_new_protected:Npn \@@_backend_reset:
+ { \__kernel_backend_literal:n { color~pop } }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvips|dvisvgm>
+% \end{macrocode}
+%
+% \subsubsection{\LuaTeX{} and \pdfTeX{}}
+%
+% \begin{macrocode}
+%<*dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
% \begin{variable}{\l__kernel_color_stack_int}
-% \pdfTeX{} and \LuaTeX{} have multiple stacks available, and to track
-% which one is in use a variable is required.
+% \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__kernel_color_stack_int
% \end{macrocode}
@@ -272,31 +370,60 @@
{ \@@_backend_select:n { #1 ~ rg ~ #1 ~ RG } }
\cs_new_protected:Npn \@@_backend_select:n #1
{
-%<*luatex>
- \tex_pdfextension:D colorstack
-%</luatex>
-%<*pdftex>
- \tex_pdfcolorstack:D
-%</pdftex>
- \l__kernel_color_stack_int push {#1}
+ \__kernel_color_stack_push:nn \l__kernel_color_stack_int {#1}
\group_insert_after:N \@@_backend_reset:
}
\cs_new_protected:Npn \@@_backend_reset:
+ { \__kernel_color_stack_pop:n \l__kernel_color_stack_int }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</dvipdfmx|luatex|pdftex|xetex>
+% \end{macrocode}
+%
+% \subsubsection{\texttt{dvipmdfx}/\XeTeX{}}
+%
+% \begin{macrocode}
+%<*dvipdfmx|xetex>
+% \end{macrocode}
+%
+% These backends have the most possible approaches: it recognises both
+% \texttt{dvips}-based color specials and it's own format, plus one can
+% include PDF statements directly. Recent releases also have a color stack
+% approach similar to \pdfTeX{}. Of the stack methods, the dedicated
+% the most versatile is the latter as it can cover all of the use cases
+% we have. Thus it is used in preference to the \texttt{dvips}-style interface
+% or the \enquote{native} color specials (which have only one stack).
+%
+% \begin{macro}
+% {
+% \@@_backend_select_cmyk:n ,
+% \@@_backend_select_gray:n ,
+% \@@_backend_select_rgb:n
+% }
+% \begin{macro}{\@@_backend_reset:}
+% Push the data to the stack.
+% \begin{macrocode}
+\int_compare:nNnT \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
-%<*luatex>
- \tex_pdfextension:D colorstack
-%</luatex>
-%<*pdftex>
- \tex_pdfcolorstack:D
-%</pdftex>
- \l__kernel_color_stack_int pop \scan_stop:
+ \cs_gset_protected:Npn \@@_backend_select_cmyk:n #1
+ {
+ \__kernel_backend_literal:n { pdf: bc ~ [#1] }
+ \group_insert_after:N \@@_backend_reset:
+ }
+ \cs_gset_eq:NN \@@_backend_select_gray:n \@@_backend_select_cmyk:n
+ \cs_gset_eq:NN \@@_backend_select_rgb:n \@@_backend_select_cmyk:n
+ \cs_gset_protected:Npn \@@_backend_reset:
+ { \__kernel_backend_literal:n { pdf: ec } }
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
-%</luatex|pdftex>
+%</dvipdfmx|xetex>
% \end{macrocode}
%
% \subsection{Separations}
@@ -601,22 +728,12 @@
%
% \begin{macro}{\@@_backend_select_separation:nn, \@@_backend_select_devicen:nn}
% \begin{macro}{\@@_backend_select:n}
-% Different syntaxes here as the stacks are accessed very differently.
+% 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{}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_select_separation:nn #1#2
-%<*dvipdfmx|xetex>
- { \@@_backend_select:n { @#1 ~ [#2] } }
-%</dvipdfmx|xetex>
-%<*luatex|pdftex>
{ \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } }
-%</luatex|pdftex>
-%<*dvipdfmx|xetex>
-\cs_new_protected:Npn \@@_backend_select:n #1
- {
- \__kernel_backend_literal:n { pdf: bc ~ #1 }
- \group_insert_after:N \@@_backend_reset:
- }
-%</dvipdfmx|xetex>
\cs_new_eq:NN \@@_backend_select_devicen:nn \@@_backend_select_separation:nn
% \end{macrocode}
% \end{macro}
@@ -627,9 +744,7 @@
% \begin{macro}{\@@_backend_separation_init_CIELAB:nnn}
% Initialising the PDF structures needs two parts: creating an object
% containing the \enquote{real} name of the Separation, then adding a reference
-% to that to each page. The latter uses the internal name of the \texttt{cs}.
-% For \texttt{dvipdfmx}/\XeTeX{}, the backend does most of the work so we need a
-% simplified version. We use a separate object for the tint transformation
+% to that to each page. We use a separate object for the tint transformation
% following the model in the PDF reference.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_separation_init:nnnnn #1#2#3#4#5
@@ -648,30 +763,19 @@
/ \str_convert_pdfname:n {#1} ~ #2 ~
\pdf_object_last:
}
-%<*luatex|pdftex>
\use:x
{
- \pdfcoredict_gput:nnn
+ \pdfmanagement_add:nnn
{ Page / Resources / ColorSpace }
{ color \int_use:N \g_@@_model_int }
{ \pdf_object_last: }
}
-%</luatex|pdftex>
}
\cs_if_exist:NF \pdf_object_now:nn
{ \cs_gset_protected:Npn \@@_backend_separation_init:nnnnn #1#2#3#4#5 { } }
\cs_new_protected:Npn \@@_backend_separation_init:n #1
{
-%<*dvipdfmx|xetex>
- \__kernel_backend_literal:x
- {
- pdf:obj ~ @color \int_use:N \g_@@_model_int \c_space_tl
- [#1]
- }
-%</dvipdfmx|xetex>
-%<*luatex|pdftex>
\pdf_object_now:nx { array } {#1}
-%</luatex|pdftex>
}
% \end{macrocode}
% For CIELAB colors, we need one object per document for the illuminant,
@@ -746,15 +850,13 @@
#2 ~
\pdf_object_last:
}
-%<*luatex|pdftex>
\use:x
{
- \pdfcoredict_gput:nnn
+ \pdfmanagement_add:nnn
{ Page / Resources / ColorSpace }
{ color \int_use:N \g_@@_model_int }
{ \pdf_object_last: }
}
-%</luatex|pdftex>
}
\cs_if_exist:NF \pdf_object_now:nn
{ \cs_gset_protected:Npn \@@_backend_devicen_init:nnn #1#2#3 { } }
diff --git a/macros/latex/contrib/l3backend/l3backend-draw.dtx b/macros/latex/contrib/l3backend/l3backend-draw.dtx
index 8de6910edf..2951e21504 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-graphics.dtx b/macros/latex/contrib/l3backend/l3backend-graphics.dtx
index e72bbe9a58..7d288ac17d 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-header.dtx b/macros/latex/contrib/l3backend/l3backend-header.dtx
index e158491688..80dac57f72 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
diff --git a/macros/latex/contrib/l3backend/l3backend-pdf.dtx b/macros/latex/contrib/l3backend/l3backend-pdf.dtx
index 58c7da7f08..e74ac8286b 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,2020 The LaTeX3 Project
+% Copyright (C) 2019-2021 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2020-09-24}
+% \date{Released 2021-01-09}
%
% \maketitle
%
@@ -565,7 +565,6 @@
% question about the name of the hook: to be resolved at the \LaTeXe{}
% end.
% \begin{macrocode}
-%<*package>
\use_none:n
{
\cs_if_exist:NT \@makecol@hook
@@ -593,7 +592,6 @@
\cs_set_eq:NN \@@_breaklink_usebox:N \hbox_unpack:N
}
}
-%</package>
% \end{macrocode}
% \end{macro}
%
@@ -622,6 +620,7 @@
% 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.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_destination:nn #1#2
{
@@ -639,6 +638,7 @@
{ fitbv } { /FitBV ~ pdf.dest.x }
{ fith } { /FitH ~ pdf.dest.y }
{ fitv } { /FitV ~ pdf.dest.x }
+ { fitr } { /Fit }
}
{
/XYZ ~ pdf.dest.point ~ \fp_eval:n { (#2) / 100 }
@@ -883,6 +883,7 @@
{ fitbv } { fitbv }
{ fith } { fith }
{ fitv } { fitv }
+ { fitr } { fitr }
}
{ xyz ~ zoom \fp_eval:n { #2 * 10 } }
\scan_stop:
@@ -1406,6 +1407,13 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{variable}{\g_@@_backend_link_int}
+% To track annotations which are links.
+% \begin{macrocode}
+\int_new:N \g_@@_backend_link_int
+% \end{macrocode}
+% \end{variable}
+%
% \begin{macro}
% {\@@_backend_link_begin_goto:nnw, \@@_backend_link_begin_user:nnw}
% \begin{macro}{\@@_backend_link_begin:n}
@@ -1416,11 +1424,21 @@
{ \@@_backend_link_begin:n { #1 /Subtype /Link /A << /S /GoTo /D ( #2 ) >> } }
\cs_new_protected:Npn \@@_backend_link_begin_user:nnw #1#2
{ \@@_backend_link_begin:n {#1#2} }
-\cs_new_protected:Npn \@@_backend_link_begin:n #1
+\cs_new_protected:Npx \@@_backend_link_begin:n #1
{
- \@@_backend:n
+ \int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
- bann
+ \exp_not:N \int_gincr:N \exp_not:N \g_@@_backend_link_int
+ }
+ \@@_backend:x
+ {
+ bann ~
+ \int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ {
+ @pdf.lnk
+ \exp_not:N \int_use:N \exp_not:N \g_@@_backend_link_int
+ \c_space_tl
+ }
<<
/Type /Annot
#1
@@ -1435,9 +1453,17 @@
% \end{macro}
%
% \begin{macro}{\@@_backend_link_last:}
-% Data not available.
+% Available using the backend mechanism with a suitably-recent
+% version.
% \begin{macrocode}
-\cs_new:Npn \@@_backend_link_last: { }
+\cs_new:Npx \@@_backend_link_last:
+ {
+ \int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
+ {
+ @pdf.lnk
+ \exp_not:N \int_use:N \exp_not:N \g_@@_backend_link_int
+ }
+ }
% \end{macrocode}
% \end{macro}
%
@@ -1453,6 +1479,7 @@
% 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.
% \begin{macrocode}
\cs_new_protected:Npn \@@_backend_destination:nn #1#2
{
@@ -1470,6 +1497,7 @@
{ fitbv } { /FitBV ~ @xpos }
{ fith } { /FitH ~ @ypos }
{ fitv } { /FitV ~ @xpos }
+ { fitr } { /Fit }
}
{ /XYZ ~ @xpos ~ @ypos ~ \fp_eval:n { (#2) / 100 } }
]
diff --git a/macros/latex/contrib/l3backend/l3backend.ins b/macros/latex/contrib/l3backend/l3backend.ins
index 3babb97da1..ebce5ad026 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,2020 The LaTeX3 Project
+Copyright (C) 2019-2021 The LaTeX3 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-2020 The LaTeX3 Project
+Copyright (C) 1990-2021 The LaTeX3 Project
It may be distributed and/or modified under the conditions of
the LaTeX Project Public License (LPPL), either version 1.3c of