summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3backend/l3backend-pdf.dtx
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/l3backend-pdf.dtx
parentbc31a53b31d92ddf5db3e7df811734a0141f8b3f (diff)
CTAN sync 202101300300
Diffstat (limited to 'macros/latex/contrib/l3backend/l3backend-pdf.dtx')
-rw-r--r--macros/latex/contrib/l3backend/l3backend-pdf.dtx163
1 files changed, 91 insertions, 72 deletions
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}
%