[latex3-commits] [git/LaTeX3-latex3-latex3] setpdfpagesize-alt: Backend part of PDD media box support (708002ebf)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Sep 27 22:06:54 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : setpdfpagesize-alt
Link       : https://github.com/latex3/latex3/commit/708002ebffc64c7a63b4a42ba9dfd854aa6d83e9

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

commit 708002ebffc64c7a63b4a42ba9dfd854aa6d83e9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Jun 22 12:56:58 2022 +0100

    Backend part of PDD media box support


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

708002ebffc64c7a63b4a42ba9dfd854aa6d83e9
 l3backend/l3backend-pdf.dtx | 76 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index b31805b0f..6a653a3c8 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -1699,6 +1699,82 @@
 %</dvisvgm>
 %    \end{macrocode}
 %
+% \subsection{PDF Page size (media box)}
+%
+% For setting the media box, the split between backends is somewhat different
+% to other areas, thus we approach this separately. The code here assumes a
+% recent \LaTeXe{}: that is ensured at the level above.
+%
+%    \begin{macrocode}
+%<*dvipdfmx|dvips>
+%    \end{macrocode}
+%
+% \begin{macro}{\@@_backend_pagesize_set:nn}
+%   This is done as a backend literal, so we deal with it using the shipout
+%   hook. As we don't evaluate now, there's no need for use of the \LaTeXe{}
+%   hook.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_pagesize_set:nn #1#2
+  {
+    \__kernel_backend_first_shipout:n
+      {
+        \__kernel_backend_literal:e
+          {
+%<*dvipdfmx>
+            pdf:pagesize ~
+              width  ~ \dim_eval:n {#1} ~
+              height ~ \dim_eval:n {#2}
+%</dvipdfmx>
+%<*dvips>
+            papersize = \dim_eval:n {#1} , \dim_eval:n {#2}
+%</dvips>
+          }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</dvipdfmx|dvips>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<*luatex|pdftex|xetex>
+%    \end{macrocode}
+%
+% \begin{macro}{\@@_backend_pagesize_set:nn}
+%   Pass to the primitives, delaying until any preamble changes.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_pagesize_set:nn #1#2
+  {
+    \tl_gput_right:Nn \@kernel at before@begindocument
+      {
+        \dim_set:Nn \tex_pagewidth:D  {#1}
+        \dim_set:Nn \tex_pageheight:D {#2}
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</luatex|pdftex|xetex>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<*dvisvgm>
+%    \end{macrocode}
+%
+% \begin{macro}{\@@_backend_pagesize_set:nn}
+%   A no-op.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_backend_pagesize_set:nn #1#2 { }
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</dvisvgm>
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list.