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

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


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

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

commit c4c5a8d239ca6dcb67d103ac379237f70d33269f
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.


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

c4c5a8d239ca6dcb67d103ac379237f70d33269f
 l3backend/l3backend-pdf.dtx | 10 +++-------
 l3kernel/l3pdf.dtx          | 21 ++++++++++++++++++++-
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index 6a653a3c8..cc4400142 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -1711,7 +1711,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
@@ -1743,15 +1742,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 f02362df3..22efc3be9 100644
--- a/l3kernel/l3pdf.dtx
+++ b/l3kernel/l3pdf.dtx
@@ -493,9 +493,28 @@
 %    \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}
+%
 % \subsection{Deprecated functions}
 %
-% \begin{variable}{\g_@@_object_prop}
+% \begin{variable}{\g_@@_obejct_prop}
 %   For tracking objects.
 %    \begin{macrocode}
 \prop_new:N \g_@@_object_prop





More information about the latex3-commits mailing list.