[latex3-commits] [git/LaTeX3-latex3-latex3] setpdfpagesize-alt: Enable media box setting if \DocumentMetadata is given (71cbefa19)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Jun 22 15:26:32 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : setpdfpagesize-alt
Link       : https://github.com/latex3/latex3/commit/71cbefa1951d40fe7008a443a408d994bae99326

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

commit 71cbefa1951d40fe7008a443a408d994bae99326
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Jun 22 14:26:32 2022 +0100

    Enable media box setting if \DocumentMetadata is given
    
    At present just using the basic data: work to do on other aspects.


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

71cbefa1951d40fe7008a443a408d994bae99326
 l3backend/l3backend-pdf.dtx | 10 +++-------
 l3kernel/l3pdf.dtx          | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index c0d366186..6e31c0120 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -1688,7 +1688,6 @@
 %
 % \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
@@ -1720,15 +1719,12 @@
 %    \end{macrocode}
 %
 % \begin{macro}{\@@_backend_pagesize_set:nn}
-%   Pass to the primitives, delaying until any preamble changes.
+%   Pass to the primitives.
 %    \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}
-      }
+    \dim_set:Nn \tex_pagewidth:D  {#1}
+    \dim_set:Nn \tex_pageheight:D {#2}
   }
 %    \end{macrocode}
 % \end{macro}
diff --git a/l3kernel/l3pdf.dtx b/l3kernel/l3pdf.dtx
index b168ef8e2..ae727774e 100644
--- a/l3kernel/l3pdf.dtx
+++ b/l3kernel/l3pdf.dtx
@@ -450,6 +450,26 @@
   }
 %    \end{macrocode}
 % \end{macro}
+%
+% \subsection{PDF Page size (media box)}
+%
+%  Everything here is delayed to the start of the document so that the
+%  backend will definitely be loaded.
+%    \begin{macrocode}
+\cs_if_exist:NT \IfDocumentMetadataTF
+  {
+    \IfDocumentMetadataTF
+      {
+        \tl_gput_right:Nn \@kernel at before@begindocument
+          {
+            \@@_backend_pagesize_set:nn
+              \paperwidth \paperheight
+          }
+      }
+      { }
+  }
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list.