[latex3-commits] [git/LaTeX3-latex3-latex3] main: Avoid setting media box if \mag is non-std (see #1138) (4b50c382b)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Oct 4 21:36:47 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/4b50c382bc2194649a971f9cb890f7c817e196cd

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

commit 4b50c382bc2194649a971f9cb890f7c817e196cd
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Oct 4 20:36:47 2022 +0100

    Avoid setting media box if \mag is non-std (see #1138)


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

4b50c382bc2194649a971f9cb890f7c817e196cd
 l3backend/CHANGELOG.md      |  2 ++
 l3backend/l3backend-pdf.dtx | 15 ++++-----------
 l3kernel/l3pdf.dtx          |  1 +
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 448e3d332..7273b455f 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,8 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+- Avoid setting media box is `\mag` is non-standard
+
 ## [2022-09-28]
 
 ### Changed
diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index ed2339cb0..c5acedcce 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -1710,10 +1710,8 @@
 %    \end{macrocode}
 %
 % \begin{macro}{\@@_backend_pagesize_set:nn}
-% \begin{macro}[EXP]{\@@_backend_pagesize_set:n}
 %   This is done as a backend literal, so we deal with it using the shipout
-%   hook. The inclusion of \cs{tex_mag:D} here is essentially to work with
-%   (u)p\LaTeX{}, where this is used to adjust apparent font size.
+%   hook.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_backend_pagesize_set:nn #1#2
   {
@@ -1723,22 +1721,17 @@
           {
 %<*dvipdfmx>
             pdf:pagesize ~
-              width  ~ \@@_backend_pagesize_set:n {#1} ~
-              height ~ \@@_backend_pagesize_set:n {#2}
+              width  ~ \dim_eval:n {#1} ~
+              height ~ \dim_eval:n {#2}
 %</dvipdfmx>
 %<*dvips>
-            papersize =
-              \@@_backend_pagesize_set:n {#1} ,
-              \@@_backend_pagesize_set:n {#2}
+            papersize = \dim_eval:n {#1} , \dim_eval:n {#2}
 %</dvips>
           }
       }
   }
-\cs_new:Npn \@@_backend_pagesize_set:n #1
-  { \fp_to_dim:n { \tex_mag:D / 1000 * (#1) } }
 %    \end{macrocode}
 % \end{macro}
-% \end{macro}
 %
 %    \begin{macrocode}
 %</dvipdfmx|dvips>
diff --git a/l3kernel/l3pdf.dtx b/l3kernel/l3pdf.dtx
index a3c6051ce..036db2a1f 100644
--- a/l3kernel/l3pdf.dtx
+++ b/l3kernel/l3pdf.dtx
@@ -508,6 +508,7 @@
             { \cs_if_exist_p:N \stockwidth }
             { \cs_if_exist_p:N \IfDocumentMetadataTF }
             { \IfDocumentMetadataTF { \c_true_bool } { \c_false_bool } }
+            { \int_compare_p:nNn \tex_mag:D = { 1000 } }
           }
           {
             \bool_lazy_and:nnTF





More information about the latex3-commits mailing list.