[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add fix for landscape pages and (x)dvipdfmx (fc51be1)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Apr 19 10:16:38 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/fc51be1ffb1c8282165526716cddf51086d64aaa

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

commit fc51be1ffb1c8282165526716cddf51086d64aaa
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Apr 19 09:16:38 2019 +0100

    Add fix for landscape pages and (x)dvipdfmx


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

fc51be1ffb1c8282165526716cddf51086d64aaa
 l3kernel/l3drivers-pdf.dtx             |   41 +++++++++++++++++++++++++++++---
 l3kernel/testfiles/m3expl001.ptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl001.uptex.tlg |    2 ++
 l3kernel/testfiles/m3expl001.xetex.tlg |    2 ++
 l3kernel/testfiles/m3expl003.ptex.tlg  |    2 ++
 l3kernel/testfiles/m3expl003.uptex.tlg |    2 ++
 l3kernel/testfiles/m3expl003.xetex.tlg |    2 ++
 7 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/l3kernel/l3drivers-pdf.dtx b/l3kernel/l3drivers-pdf.dtx
index a09a911..4bf3c5c 100644
--- a/l3kernel/l3drivers-pdf.dtx
+++ b/l3kernel/l3drivers-pdf.dtx
@@ -1397,6 +1397,26 @@
 %
 % \subsubsection{Annotations}
 %
+% \begin{variable}{\g_@@_landscape_bool}
+%   There is a bug in \texttt{(x)dvipdfmx} which means annotations do
+%   not rotate. As such, we need to know if landscape is active.
+%    \begin{macrocode}
+\bool_new:N \g_@@_landscape_bool
+%<*package>
+\AtBeginDocument
+  {
+    \cs_if_exist:NT \landscape
+      {
+        \tl_put_right:Nn \landscape
+          { \bool_gset_true:N \g_@@_landscape_bool }
+        \tl_put_left:Nn \endlandscape
+          { \bool_gset_false:N \g_@@_landscape_bool }
+      }
+  }
+%</package>
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{macro}{\@@_pdf_AR_fix:}
 %   The fix for the Adobe Reader bug: needed for generic annotations and links.
 %    \begin{macrocode}
@@ -1418,12 +1438,27 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\driver_pdf_annotation:nnnn}
-%   Annotations are objects, but we track them separately. Notably, they are
-%   not in the object data lists.
+% \begin{macro}{\driver_pdf_annotation:nnnn, \@@_pdf_annotation:nnnn}
+%   Simply pass the raw data through, just dealing with evaluation of dimensions.
+%   The only wrinkle is landscape: we have to adjust by hand.
 %    \begin{macrocode}
 \cs_new_protected:Npn \driver_pdf_annotation:nnnn #1#2#3#4
   {
+    \bool_if:NTF \g_@@_landscape_bool
+      {
+         \box_move_up:nn {#2}
+           {
+             \vbox:n
+               {
+                 \@@_pdf_annotation:nnnn
+                   { #2 + #3 } {#1} { 0pt } {#4}
+               }
+           }
+      }
+      { \@@_pdf_annotation:nnnn {#1} {#2} {#3} {#4} }
+  }
+\cs_new_protected:Npn \@@_pdf_annotation:nnnn #1#2#3#4
+  {
     \@@_pdf_AR_fix:
     \int_gincr:N \g_@@_pdf_object_int
     \int_gset_eq:NN \g_@@_pdf_annotation_int \g_@@_pdf_object_int
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 508d8a0..533a4b5 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -6519,10 +6519,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index bd9ac08..b1d2b68 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -6816,10 +6816,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 602bd16..f79b938 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -6495,10 +6495,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 508d8a0..533a4b5 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -6519,10 +6519,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index bd9ac08..b1d2b68 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -6816,10 +6816,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 602bd16..f79b938 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -6495,10 +6495,12 @@ Defining \__driver_pdf_object_write_dict:nn on line ...
 Defining \__driver_pdf_object_write_fstream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nn on line ...
 Defining \__driver_pdf_object_write_stream:nnnn on line ...
+Defining \g__driver_landscape_bool on line ...
 Defining \__driver_pdf_AR_fix: on line ...
 Defining \g__driver_pdf_annotation_int on line ...
 \g__driver_pdf_annotation_int=\count...
 Defining \driver_pdf_annotation:nnnn on line ...
+Defining \__driver_pdf_annotation:nnnn on line ...
 Defining \driver_pdf_link_begin_goto:nnw on line ...
 Defining \driver_pdf_link_begin_user:nnw on line ...
 Defining \__driver_pdf_link_begin:nnnw on line ...





More information about the latex3-commits mailing list