[latex3-commits] [git/LaTeX3-latex3-pdfresources] testmetadata: luatex (33b367f)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Jan 2 18:58:52 CET 2022


Repository : https://github.com/latex3/pdfresources
On branch  : testmetadata
Link       : https://github.com/latex3/pdfresources/commit/33b367f7924634d78d6420a92a58ea19f6f1a3e2

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

commit 33b367f7924634d78d6420a92a58ea19f6f1a3e2
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Jan 2 18:58:52 2022 +0100

    luatex


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

33b367f7924634d78d6420a92a58ea19f6f1a3e2
 experiments/structure-destination-code.tex | 187 ++++++++++++++++++++++-------
 1 file changed, 141 insertions(+), 46 deletions(-)

diff --git a/experiments/structure-destination-code.tex b/experiments/structure-destination-code.tex
index 3e2993e..e10ca67 100644
--- a/experiments/structure-destination-code.tex
+++ b/experiments/structure-destination-code.tex
@@ -131,7 +131,7 @@
               \bool_lazy_and:nnT
                 {\l_pdf_struct_destination_bool}
                 {\exp_args:Ne \pdf_object_if_exist_p:n { \l_pdf_struct_destination_tl }}
-                {\tl_show:n{#2}
+                {
                   \__pdf_backend:x
                     {
                       obj ~ @pdf.SDest.\exp_not:n{#2}
@@ -187,30 +187,142 @@
              }
              { xyz ~ zoom \fp_eval:n { #2 * 10 } }
            \scan_stop:
-       \bool_if:NT\l_pdf_struct_destination_bool
-        {    
-          \tex_pdfdest:D
-              struct~
-              \int_use:c 
-                { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }~
-              name {#1}
-              \str_case:nnF {#2}
-                {
-                  { xyz }   { xyz }
-                  { fit }   { fit }
-                  { fitb }  { fitb }
-                  { fitbh } { fitbh }
-                  { fitbv } { fitbv }
-                  { fith }  { fith }
-                  { fitv }  { fitv }
-                  { fitr }  { fitr }
-                }
-                { xyz ~ zoom \fp_eval:n { #2 * 10 } }
-              \scan_stop:
-          } 
+       \bool_lazy_and:nnT
+         {\l_pdf_struct_destination_bool}
+         {\exp_args:Ne \pdf_object_if_exist_p:n { \l_pdf_struct_destination_tl }}
+         {
+           \tex_pdfdest:D
+               struct~
+               \int_use:c
+                 { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }~
+               name {#1}
+               \str_case:nnF {#2}
+                 {
+                   { xyz }   { xyz }
+                   { fit }   { fit }
+                   { fitb }  { fitb }
+                   { fitbh } { fitbh }
+                   { fitbv } { fitbv }
+                   { fith }  { fith }
+                   { fitv }  { fitv }
+                   { fitr }  { fitr }
+                 }
+                 { xyz ~ zoom \fp_eval:n { #2 * 10 } }
+               \scan_stop:
+           }
+     }
+   % boxed destination
+   \cs_set_protected:Npn \__pdf_backend_destination:nnnn #1#2#3#4
+     {
+       \tex_pdfdest:D
+        name {#1}
+        fitr ~
+        width  \dim_eval:n {#2} ~
+        height \dim_eval:n {#3} ~
+        depth  \dim_eval:n {#4} \scan_stop:
+      \bool_lazy_and:nnT
+         {\l_pdf_struct_destination_bool}
+         {\exp_args:Ne \pdf_object_if_exist_p:n { \l_pdf_struct_destination_tl }}
+         { 
+           \tex_pdfdest:D
+             struct~
+             \int_use:c
+               { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }~
+             name {#1}
+             fitr ~
+             width  \dim_eval:n {#2} ~
+             height \dim_eval:n {#3} ~
+             depth  \dim_eval:n {#4} \scan_stop:
+         } 
+     }  
+   \cs_set_protected:Npn \__pdf_backend_link_begin_goto:nnw #1#2
+     { 
+      \bool_if:NTF \l_pdf_struct_destination_bool
+        { \__pdf_backend_link_begin:nnnw {#1} { goto~struct~name~{#2}~name } {#2}}
+        { \__pdf_backend_link_begin:nnnw {#1} { goto~name } {#2}} 
      }     
   }
 
+%luatex. The trigger is the development id, if it is larger than 7468 we assume that structure destinations are there.
+\bool_lazy_all:nT
+  {
+    { \str_if_eq_p:Vn\c_sys_backend_str {luatex} }
+    { \int_compare_p:nNn {\directlua{tex.print(status.list()["development_id"])} } > {7468} }
+  }
+  {
+   %redefine here
+   \cs_set_protected:Npn \__pdf_backend_destination:nn #1#2
+     {
+       \tex_pdfextension:D dest ~
+           name {#1}
+           \str_case:nnF {#2}
+             {
+               { xyz }   { xyz }
+               { fit }   { fit }
+               { fitb }  { fitb }
+               { fitbh } { fitbh }
+               { fitbv } { fitbv }
+               { fith }  { fith }
+               { fitv }  { fitv }
+               { fitr }  { fitr }
+             }
+             { xyz ~ zoom \fp_eval:n { #2 * 10 } }
+           \scan_stop:
+       \bool_lazy_and:nnT
+         {\l_pdf_struct_destination_bool}
+         {\exp_args:Ne \pdf_object_if_exist_p:n { \l_pdf_struct_destination_tl }}
+         {
+           \tex_pdfextension:D dest ~
+               struct~
+               \int_use:c
+                 { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }~
+               name {#1}
+               \str_case:nnF {#2}
+                 {
+                   { xyz }   { xyz }
+                   { fit }   { fit }
+                   { fitb }  { fitb }
+                   { fitbh } { fitbh }
+                   { fitbv } { fitbv }
+                   { fith }  { fith }
+                   { fitv }  { fitv }
+                   { fitr }  { fitr }
+                 }
+                 { xyz ~ zoom \fp_eval:n { #2 * 10 } }
+               \scan_stop:
+           }
+     }
+   % boxed destination
+   \cs_set_protected:Npn \__pdf_backend_destination:nnnn #1#2#3#4
+     {
+       \tex_pdfextension:D dest ~
+        name {#1}
+        fitr ~
+        width  \dim_eval:n {#2} ~
+        height \dim_eval:n {#3} ~
+        depth  \dim_eval:n {#4} \scan_stop:
+      \bool_lazy_and:nnT
+         {\l_pdf_struct_destination_bool}
+         {\exp_args:Ne \pdf_object_if_exist_p:n { \l_pdf_struct_destination_tl }}
+         {
+           \tex_pdfextension:D dest ~
+             struct~
+             \int_use:c
+               { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }~
+             name {#1}
+             fitr ~
+             width  \dim_eval:n {#2} ~
+             height \dim_eval:n {#3} ~
+             depth  \dim_eval:n {#4} \scan_stop:
+         }
+     }
+   \cs_set_protected:Npn \__pdf_backend_link_begin_goto:nnw #1#2
+     {
+      \bool_if:NTF \l_pdf_struct_destination_bool
+        { \__pdf_backend_link_begin:nnnw {#1} { goto~struct~name~{#2}~name } {#2}}
+        { \__pdf_backend_link_begin:nnnw {#1} { goto~name } {#2}}
+     }     
+  }
   
 %for the tests ...
 \bool_set_true:N \l_pdf_struct_destination_bool
@@ -218,26 +330,9 @@
 
 \ExplSyntaxOff
 \begin{document}
-%\lipsum[1-6]
+
 \ExplSyntaxOn
-\tl_set:Nx 
-  \l_tmpa_tl
-   {
-     \bool_if:NT\l_pdf_struct_destination_bool {struct ~\int_use:c
-        { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }}
-   }
-\tl_show:N\l_tmpa_tl
-blub
-%\exp_last_unbraced:Ne
-\pdfdest %\l_tmpa_tl~ 
-  %{
-%   \bool_if:NT\l_pdf_struct_destination_bool
-%   {struct ~\int_use:c
-%        { c__pdf_backend_object_ \exp_args:Ne \tl_to_str:n {\l_pdf_struct_destination_tl} _int }
-%   }
-%  }
- struct~18~
-  ~ name~{blub}~fit
+xx\pdf_destination:nn{blub}{fit}
 %abc\pdf_destination:nnnn{xx}{1cm}{1cm}{1cm}
 %
 %\par x\__pdf_backend_link_begin:n
@@ -245,7 +340,7 @@ blub
 % blub
 % \__pdf_backend_link_end:
 \ExplSyntaxOff
-\end{document}
+%\end{document}
 \tagstructbegin{tag=H1}
 \ExplSyntaxOn\makeatletter
 %\__tag_prop_gput:cnx
@@ -270,10 +365,10 @@ blub
 % \__pdf_backend_link_end:
 %
 %
- \__pdf_backend_link_begin:n
-    { /Subtype /Link /A << /S /GoTo /D ( xx ) /SD~ @pdf.dest.xx >> }
- blub
- \__pdf_backend_link_end:
+% \__pdf_backend_link_begin:n
+%    { /Subtype /Link /A << /S /GoTo /D ( xx ) /SD~ @pdf.dest.xx >> }
+% blub
+% \__pdf_backend_link_end:
 %% \pdf_object_ref_last:
 \ExplSyntaxOff
 





More information about the latex3-commits mailing list.