[latex3-commits] [git/LaTeX3-latex3-latex3] master: Reorder dvips link creation specials (551e82d)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Apr 12 22:24:51 CEST 2019


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

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

commit 551e82d263b333304f37c8a04f32cb4375958f97
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Apr 12 21:24:51 2019 +0100

    Reorder dvips link creation specials
    
    This puts them around the content, which will be needed for link breaking.


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

551e82d263b333304f37c8a04f32cb4375958f97
 l3kernel/l3drivers-pdf.dtx |  135 +++++++++++++++++++++-----------------------
 1 file changed, 63 insertions(+), 72 deletions(-)

diff --git a/l3kernel/l3drivers-pdf.dtx b/l3kernel/l3drivers-pdf.dtx
index c80cf55..23c2b64 100644
--- a/l3kernel/l3drivers-pdf.dtx
+++ b/l3kernel/l3drivers-pdf.dtx
@@ -222,11 +222,17 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{variable}{\l_@@_tmpa_box, \l_@@_tmpb_box}
-%   A box for creating annotations.
+% \begin{variable}{\l_@@_pdf_content_box}
+%   The content of an annotation.
 %    \begin{macrocode}
-\box_new:N \l_@@_tmpa_box
-\box_new:N \l_@@_tmpb_box
+\box_new:N \l_@@_pdf_content_box
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_pdf_model_box]
+%   For creating model sizing for links.
+%    \begin{macrocode}
+\box_new:N \l_@@_pdf_model_box
 %    \end{macrocode}
 % \end{variable}
 %
@@ -238,7 +244,6 @@
 % \end{variable}
 %
 % \begin{macro}{\driver_pdf_annotation:nnnn}
-% \begin{macro}{\@@_pdf_annotation_corners:nn}
 % \begin{macro}{driver.llx, driver.lly, driver.urx, driver.ury}
 %   Annotations are objects, but we track them separately. Notably, they are
 %   not in the object data lists. Here, to get the co-ordinates of the
@@ -249,11 +254,16 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \driver_pdf_annotation:nnnn #1#2#3#4
   {
+    \box_move_down:nn {#3}
+      { \@@_postscript:n { driver.annotation.ll } }
+    \hbox:n {#4}
+    \box_move_up:nn {#2}
+      {
+        \tex_kern:D \dim_eval:n {#1} \scan_stop:
+        \@@_postscript:n { driver.annotation.ur }
+      }
     \int_gincr:N \g_@@_pdf_object_int
     \int_gset_eq:NN \g_@@_pdf_annotation_int \g_@@_pdf_object_int
-    \@@_pdf_annotation_corners:nnnnn
-      {#1} {#2} {#3}
-      { driver.annotation.ll } { driver.annotation.ur }
     \@@_postscript:x
       {
           mark ~ /_objdef ~ { driver.obj \int_use:N \g_@@_pdf_object_int } ~
@@ -262,33 +272,9 @@
           /ANN ~ pdfmark
       }
   }
-\cs_new_protected:Npn \@@_pdf_annotation_corners:nnnnn #1#2#3#4#5
-  {
-    \group_begin:
-      \hbox_set_to_wd:Nnn \l_@@_tmpa_box { 0pt }
-        {
-          \box_move_down:nn {#3}
-            {
-              \hbox_overlap_right:n
-                { \@@_postscript:n {#4} }
-            }
-          \box_move_up:nn {#2}
-            {
-              \hbox_overlap_right:n
-                {
-                  \tex_kern:D \dim_eval:n {#1} \scan_stop:
-                  \@@_postscript:n {#5}
-                }
-            }
-        }
-      \box_set_ht:Nn \l_@@_tmpa_box { 0pt }
-      \box_use_drop:N \l_@@_tmpa_box
-    \group_end:
-  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \end{macro}
 %
 % \begin{macro}[EXP]{\driver_pdf_annotation_last:}
 %   Provide the last annotation we created: could get tricky of course if
@@ -307,7 +293,8 @@
 % \end{variable}
 %
 % \begin{macro}{\driver_pdf_link_goto:nnn, \driver_pdf_link_user:nnn}
-% \begin{macro}{\@@_pdf_link:nnnn, \@@_pdf_link_auxi:nnnn}
+% \begin{macro}{\@@_pdf_link:nnnn}
+% \begin{macro}{\@@_pdf_link_minima:}
 % \begin{macro}
 %   {
 %     driver.linkdp.min, driver.linkht.min,
@@ -335,58 +322,62 @@
   { \@@_pdf_link:nnnn {#1} { } {#2} {#3} }
 \cs_new_protected:Npn \@@_pdf_link:nnnn #1#2#3#4
   {
-    \group_begin:
-      \hbox_set:Nn \l_@@_tmpa_box {#4}
-      \hbox_set:Nn \l_@@_tmpb_box { Gg }
-      \@@_postscript:x
-        {
-          /driver.linkdp.min ~
-            \dim_to_decimal:n
-              {
-                \dim_max:nn
-                  { \box_dp:N \l_@@_tmpb_box - \box_dp:N \l_@@_tmpa_box }
-                  { 0pt }
-              } ~
-                driver.pt.dvi ~ def
-          /driver.linkht.min ~
-            \dim_to_decimal:n
-              {
-                \dim_max:nn
-                  { \box_ht:N \l_@@_tmpb_box - \box_ht:N \l_@@_tmpa_box }
-                  { 0pt }
-              } ~
-                driver.pt.dvi ~ def
-        }
-      \@@_pdf_link_auxi:nnnn
-        { \box_wd:N \l_@@_tmpa_box }
-        { \box_ht:N \l_@@_tmpa_box }
-        { \box_dp:N \l_@@_tmpa_box }
-        { /Subtype /Link #1 #2 #3 }
-      \box_use_drop:N \l_@@_tmpa_box
-      \int_gset_eq:NN \g_@@_pdf_link_int \g_@@_pdf_annotation_int
-    \group_end:
-  }
-\cs_new_protected:Npn \@@_pdf_link_auxi:nnnn #1#2#3#4
-  {
     \@@_postscript:n
       { /driver.linkdict ~ ( #4 ) ~ def }
+    \hbox_set:Nn \l_@@_pdf_content_box {#4}
+    \@@_pdf_link_minima:
+    \box_move_down:nn { \box_dp:N \l_@@_pdf_content_box }
+      { \hbox:n { \@@_postscript:n { driver.annotation.ll } } }
+    \box_use:N \l_@@_pdf_content_box
+    \box_move_up:nn { \box_ht:N \l_@@_pdf_content_box }
+      {
+        \hbox:n
+          { \@@_postscript:n { driver.annotation.ur } }
+      }
     \int_gincr:N \g_@@_pdf_object_int
-    \int_gset_eq:NN \g_@@_pdf_annotation_int \g_@@_pdf_object_int
-    \@@_pdf_annotation_corners:nnnnn
-      {#1} {#2} {#3}
-      { driver.link.ll } { driver.link.ur }
+    \int_gset_eq:NN \g_@@_pdf_link_int \g_@@_pdf_object_int
     \@@_postscript:x
       {
-        mark ~ /_objdef ~ { driver.obj \int_use:N \g_@@_pdf_object_int } ~
+        mark ~ /_objdef ~ { driver.obj \int_use:N \g_@@_pdf_link_int } ~
         driver.annotation.border ~
-        #4 ~
+        /Subtype /Link #1 #2 #3 ~
         /ANN ~ pdfmark
       }
   }
+\cs_new_protected:Npn \@@_pdf_link_minima:
+  {
+    \hbox_set:Nn \l_@@_pdf_model_box { Gg }
+    \@@_postscript:x
+      {
+        /driver.linkdp.min ~
+          \dim_to_decimal:n
+            {
+              \dim_max:nn
+                {
+                    \box_dp:N \l_@@_pdf_model_box
+                  - \box_dp:N \l_@@_pdf_content_box
+                }
+                { 0pt }
+            } ~
+              driver.pt.dvi ~ def
+        /driver.linkht.min ~
+          \dim_to_decimal:n
+            {
+              \dim_max:nn
+                {
+                    \box_ht:N \l_@@_pdf_model_box
+                  - \box_ht:N \l_@@_pdf_content_box
+                }
+                { 0pt }
+            } ~
+              driver.pt.dvi ~ def
+      }
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\driver_pdf_link_last:}
 %   The same as annotations, but with a custom integer.





More information about the latex3-commits mailing list