[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: working on the driver... (bffdbf2)

Ulrike Fischer fischer at troubleshooting-tex.de
Fri Apr 19 23:34:35 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/bffdbf21e2abe038592850c4beb7d9a9b8fe37ed

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

commit bffdbf21e2abe038592850c4beb7d9a9b8fe37ed
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri Apr 19 23:34:35 2019 +0200

    working on the driver...


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

bffdbf21e2abe038592850c4beb7d9a9b8fe37ed
 bdc.tex                  |   53 +++++++++++++++++++++++++++
 hluatex-experimental.def |   89 +++++++++++++++++++++++++++++-----------------
 test-pdfresources.tex    |    4 +--
 3 files changed, 112 insertions(+), 34 deletions(-)

diff --git a/bdc.tex b/bdc.tex
new file mode 100644
index 0000000..f6d5c62
--- /dev/null
+++ b/bdc.tex
@@ -0,0 +1,53 @@
+
+
+%pdfmode
+% output of #1 as /#1?
+\cs_new_protected:Npx \driver_pdf_bmc:n #1
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{#1~BMC} }
+      { \tex_pdfliteral:D~page~{#1~BMC}  }
+  }
+
+\cs_new_protected:Npx \driver_pdf_bdc:nn #1 #2
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{#1~#2~BDC} }
+      { \tex_pdfliteral:D~page~{#1~#2~BDC}  }
+  }
+    
+  
+\cs_new_protected:Npx \driver_pdf_emc:
+  {
+    \cs_if_exist:NTF \tex_pdfextension:D
+      { \tex_pdfextension:D literal~page~{EMC} }
+      { \tex_pdfliteral:D~page~{EMC}  }
+  }
+
+
+%dvipdfmx
+\cs_new_protected:Npn \driver_pdf_bmc:n #1
+  {
+    \special{pdf:code~#1~BMC}
+    %\special{pdf:content~#1~BMC}% 
+  }
+
+\cs_new_protected:Npn \driver_pdf_bdc:nn #1 #2
+  {
+    \special{pdf:code~#1~#2~BDC}
+    %\special{pdf:content~#1~#2~BDC}%accsupp 
+  }
+
+\cs_new_protected:Npn \driver_pdf_emc:
+  {
+    \special{pdf:code~EMC}
+    %\special{pdf:content EMC}%accsupp
+  }
+  
+
+%dvips
+\cs_new_protected:Npn \driver_pdf_emc:
+ {
+  \special{ps:~mark~/EMC~pdfmark}
+  %\special{ps:[/EMC pdfmark} %accsupp?
+ }
\ No newline at end of file
diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 38ef141..41e92bb 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -28,10 +28,16 @@
    {\msg_error:nn {hyp}{missing-bookmark-package}}
  }}
 
-%this need sorting out later. pdf standards should outside the driver.
+% this need sorting out later. pdf standards should be handled outside the driver.
+% pdfa forces the flag /F 4 in some places.
+\bool_new:N\l__hyp_pdfa_bool
+\ifHy at pdfa
+ \bool_set_true:N \l__hyp_pdfa_bool
+\fi
 \AtBeginDocument
 {
-   \ifHy at pdfa
+  \bool_if:NT \l__hyp_pdfa_bool
+  {
     \hook_put:nnnn
      { pdf }
      { startlink_url_attr }
@@ -46,13 +52,19 @@
      { pdf }
      { startlink_file_attr }
      { /F } { 4 }
-   \fi
+
+     \hook_put:nnnn
+     { pdf }
+     { startlink_menu_attr }
+     { /F } { 4 }
+   }
 }
-%these are commands to fill various attributes (color, border style) in
-% the hooks for links.
+
+% these are (temporary) commands to fill various attributes (color, border style) in
+% the hooks for links from the hyperref keys.
 \def\Hy at EXPsetpdfborder
  {
- \clist_map_inline:nn { url , file , run , link}
+ \clist_map_inline:nn { url , file , run , link, menu}
    {
     \tl_if_empty:NTF \@pdfborder
      {
@@ -81,7 +93,7 @@
 
 \def\Hy at EXPsetpdfhighlight
  {
-  \clist_map_inline:nn { url , file , run , link}
+  \clist_map_inline:nn { url , file , run , link , menu}
    {
     \tl_if_empty:NTF \@pdfhighlight
      {
@@ -127,6 +139,20 @@
     }
   }
 
+\def\Hy at EXPsetmenubordercolor
+  {
+   \cs_if_exist:NTF \@menuordercolor
+    {
+     \hook_put:nnnn
+      { pdf }
+      { startlink_menu_attr }
+      { /C }
+      { [\@menubordercolor] }
+    }
+    {
+     \hook_remove:nnn { pdf } { startlink_menu_attr }{ /C }
+    }
+  }
 
 % for now we are updating the attribute manually after \hypersetup
 % some better method must be found
@@ -136,6 +162,7 @@
  \Hy at EXPsetpdfhighlight
  \Hy at EXPseturlbordercolor
  \Hy at EXPsetfilebordercolor
+ \Hy at EXPsetmenubordercolor
 }
 \ExplSyntaxOff
 
@@ -271,6 +298,7 @@
             not~supported~in~requested~PDF~version %
             1.\Hy at pdfversion
           }%
+        \fi
         \driver_pdf_objects_disable:
       %
     \fi
@@ -429,14 +457,16 @@
       \ifHy at ocgcolorlinks
         \color at endgroup\egroup
         \mbox{
-          \pdfliteral~page{/OC/OCPrint BDC}
+          %this uses a named object, we really need to sort this ...
+          \pdfliteral~page{/OC/OCPrint~BDC}
           \rlap{\copy0}
-          \pdfliteral~page{EMC/OC/OCView BDC}
+          \driver_pdf_emc:
+          \pdfliteral~page{/OC/OCView~BDC}
           \begingroup
             \expandafter\HyColor at UseColor\Hy at ocgcolor
             \box0~
           \endgroup
-          \pdfliteral~page{EMC}
+          \driver_pdf_emc:
         }
       \fi
       \endgroup
@@ -869,34 +899,29 @@
 }
 
 %%% UF removed setpagesize code, should be done by kernel/graphicx
-
+\ExplSyntaxOn
 \def\Acrobatmenu#1#2{%
   \Hy at Acrobatmenu{#1}{#2}{%
-    \leavevmode
+    \mode_leave_vertical:
     \EdefEscapeName\Hy at temp@menu{#1}%
-    \pdfstartlink
-      attr{%
-        \Hy at setpdfborder
-        \Hy at setpdfhighlight
-        \ifx\@menubordercolor\relax
-        \else
-          /C[\@menubordercolor]%
-        \fi
-      }%
-      user{%
-        /Subtype/Link%
-        \ifHy at pdfa /F 4\fi
-        /A<<%
-          /S/Named%
+    \pdf_link_user:nnn { menu }
+      {
+       /A<<
+          /S/Named
           /N/\Hy at temp@menu
           \Hy at href@nextactionraw
-        >>%
-      }%
-      \relax
-    \Hy at colorlink\@menucolor#2%
-    \close at pdflink
-  }%
+        >>
+
+      }
+      {
+       \Hy at colorlink\@menucolor#2
+       \Hy at xspace@end
+       \Hy at endcolorlink
+       \Hy at VerboseLinkStop
+      }
+  }
 }
+\ExplSyntaxOff
 %%% UF removed old atbegshi fix
 
 \def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index e719c0e..d554291 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -15,7 +15,7 @@
 \usepackage{xcolor}
 
 
-\usepackage[customdriver=hluatex-experimental,ocgcolorlinks,pdfa,pdfversion=1.4]{hyperref}
+\usepackage[customdriver=hluatex-experimental,ocgcolorlinks,pdfversion=1.5]{hyperref}
 
 %%\tracingmacros=1
 \hypersetup{urlcolor=blue,linkbordercolor=blue,pdfborder={1 1 1},pdfprintpagerange=0}
@@ -51,7 +51,7 @@ xxx
 \section{a}\label{a}
 \ref{a}
 \ExplSyntaxOff
-
+\Acrobatmenu{Find}{Find}
 %\hyperlink{blblb}{yabc\\xye\\abc}
 \end{document}
 \section{a}\label{a}





More information about the latex3-commits mailing list