[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: simplified/tested border colors (7fc291c)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Apr 28 15:38:57 CEST 2019


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

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

commit 7fc291cfa2af193ec0613096fad61c6d6cd8bf5e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Apr 28 15:38:57 2019 +0200

    simplified/tested border colors


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

7fc291cfa2af193ec0613096fad61c6d6cd8bf5e
 hluatex-experimental.def      |   60 ++------
 pdfresources.dtx              |   23 +--
 test-bordercolor.tex          |   31 ++++
 testfiles/linkbordercolor.pvt |   27 ++++
 testfiles/linkbordercolor.tpf |  325 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 413 insertions(+), 53 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 135d86b..fde7ff5 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -8,11 +8,10 @@
 \ProvidesFile{hluatex-experimental.def}
   [2019/04/07 v0.2 %
   Hyperref driver for luaTeX]
-%%\Hy at VersionCheck{hluatex.def}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% variants of hyperref commands to get attributes in the prop
 \RequirePackage{xparse}
 
+%%\Hy at VersionCheck{hluatex.def}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \ExplSyntaxOn
 %% messages, should later (with more drivers) go somewhere more generic ...
 \prop_gput:Nnn \g_msg_module_name_prop { hyp }{ hyperref }
@@ -71,12 +70,14 @@
      { /F } { 4 }
    }
 }
-
+% variants of hyperref commands to get attributes in the prop
 % these are (temporary) commands to fill various attributes (color, border style) in
 % the hooks for links from the hyperref keys.
+\clist_const:Nn \c__hyp_link_types_clist { url , file , run , link, menu }
+
 \def\Hy at EXPsetpdfborder
  {
- \clist_map_inline:nn { url , file , run , link, menu }
+ \clist_map_inline:Nn \c__hyp_link_types_clist
    {
     \tl_if_empty:NTF \@pdfborder
      {
@@ -105,7 +106,7 @@
 
 \def\Hy at EXPsetpdfhighlight
  {
-  \clist_map_inline:nn { url , file , run , link , menu}
+  \clist_map_inline:nn \c__hyp_link_types_clist
    {
     \tl_if_empty:NTF \@pdfhighlight
      {
@@ -121,49 +122,22 @@
   }
  }
 
-\def\Hy at EXPseturlbordercolor
+\def\Hy at EXPsetbordercolor
   {
-   \cs_if_exist:NTF\@urlbordercolor
+   \clist_map_inline:Nn \c__hyp_link_types_clist
    {
-    \hook_put:nnnn
-     { pdf }
-     { link_begin_url_attr }
-     { /C }
-     { [\@urlbordercolor] }
-   }
-   {
-    \hook_remove:nnn { pdf } { link_begin_url_attr } { /C }
-   }
-  }
-
-\def\Hy at EXPsetfilebordercolor
-  {
-   \cs_if_exist:NTF \@filebordercolor
+    \tl_if_exist:cTF { @##1bordercolor }
     {
      \hook_put:nnnn
       { pdf }
-      { link_begin_file_attr }
-      { /C }
-      { [\@filebordercolor] }
-    }
-    {
-     \hook_remove:nnn { pdf } { link_begin_file_attr }{ /C }
-    }
-  }
-
-\def\Hy at EXPsetmenubordercolor
-  {
-   \cs_if_exist:NTF \@menuordercolor
-    {
-     \hook_put:nnnn
-      { pdf }
-      { link_begin_menu_attr }
+      { link_begin_##1_attr }
       { /C }
-      { [\@menubordercolor] }
+      { [\tl_use:c {@##1bordercolor}] }
     }
     {
-     \hook_remove:nnn { pdf } { link_begin_menu_attr }{ /C }
+     \hook_remove:nnn { pdf } { link_begin_##1_attr } { /C }
     }
+   }
   }
 
 % for now we are updating the attribute manually after \hypersetup
@@ -172,9 +146,7 @@
 {
  \Hy at EXPsetpdfborder
  \Hy at EXPsetpdfhighlight
- \Hy at EXPseturlbordercolor
- \Hy at EXPsetfilebordercolor
- \Hy at EXPsetmenubordercolor
+ \Hy at EXPsetbordercolor
 }
 \ExplSyntaxOff
 
@@ -481,7 +453,7 @@
 \ExplSyntaxOn
 \def\Hy at DestName#1#2
  {
-  \driver_pdf_dest_name:nn {#1}{#2}
+  \pdf_destination:nf {#1}{#2}
  }
 \ExplSyntaxOff
 \providecommand*\@pdfborder{0 0 1}
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 575339f..6701328 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -137,10 +137,7 @@
   \pdfinfo { #1 }
  }
 
-\cs_new_protected:Nn \driver_pdf_dest_name:nn %#1 name, #2 dest type (e.g. fitbh)
- {
-  \pdfdest~{#1}#2\scan_stop:
- }
+
 
 % this needs refinement, probably is should create named objects and add
 % them to the properties, see discussion
@@ -177,10 +174,7 @@
   \pdfextension info { #1 }
  }
 
-\cs_new_protected:Nn \driver_pdf_dest_name:nn %#1 name, #2 dest type (e.g. fitbh)
- {
-  \pdfextension~dest~name~{#1}#2 \scan_stop:
- }
+
 
 \cs_new_protected:Npx \driver_pdf_bdc:nn #1 #2
   {
@@ -413,7 +407,18 @@
 }
 %</package>
 %    \end{macrocode}
-%
+% \subsection{Destinations}
+%    \begin{macrocode}
+%<*package>
+% perhaps some manipulation of the argument will be needed to map the current
+% hyperref syntax
+\cs_new_protected:Npn \pdf_destination:nn #1 #2
+ {
+  \exp_args:Nnx\driver_pdf_destination:nn {#1}{\str_lower_case:n{#2}}
+ }
+\cs_generate_variant:Nn\pdf_destination:nn {no,nf}
+%</package>
+%    \end{macrocode}
 % \subsubsection{Endlink}
 % tagpdf needs to execute code at the end of the link to store the object reference etc.
 % So we need a hook. For now the hook is a seq: This will perhaps allows a system to
diff --git a/test-bordercolor.tex b/test-bordercolor.tex
new file mode 100644
index 0000000..091bc73
--- /dev/null
+++ b/test-bordercolor.tex
@@ -0,0 +1,31 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+
+
+
+\documentclass{article}
+\usepackage{pdfresources}
+
+%don't compress pdf:
+\ExplSyntaxOn
+\driver_pdf_compresslevel:n {0}
+\driver_pdf_objects_disable:
+\ExplSyntaxOff
+\usepackage{xcolor}
+\usepackage[customdriver=hluatex-experimental]{hyperref}
+
+\hypersetup{
+ urlbordercolor=blue,
+ linkbordercolor=green,
+ menubordercolor=brown,
+ filebordercolor=yellow,
+ pdfborder={1 1 1}}
+ 
+\hypupdateattribute
+\begin{document}
+
+\section{a}\label{a}
+link: \ref{a} \\
+url:  \url{www.blub.de}\\
+file: \href{test-pdfresources.pdf}{test file}\\
+menu: \Acrobatmenu{Find}{Find}
+\end{document}
diff --git a/testfiles/linkbordercolor.pvt b/testfiles/linkbordercolor.pvt
new file mode 100644
index 0000000..de2dfa7
--- /dev/null
+++ b/testfiles/linkbordercolor.pvt
@@ -0,0 +1,27 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+
+
+
+\input{regression-test}
+\documentclass{article}
+\usepackage{pdfresources}
+
+\usepackage{xcolor}
+\usepackage[customdriver=hluatex-experimental]{hyperref}
+
+\hypersetup{
+ urlbordercolor=blue,
+ linkbordercolor=green,
+ menubordercolor=brown,
+ filebordercolor=yellow,
+ pdfborder={1 1 1}}
+ 
+\hypupdateattribute
+\begin{document}
+\START 
+\section{a}\label{a}
+link: \ref{a} \\
+url:  \url{www.blub.de}\\
+file: \href{test-pdfresources.pdf}{test file}\\
+menu: \Acrobatmenu{Find}{Find}
+\end{document}
diff --git a/testfiles/linkbordercolor.tpf b/testfiles/linkbordercolor.tpf
new file mode 100644
index 0000000..6466af3
--- /dev/null
+++ b/testfiles/linkbordercolor.tpf
@@ -0,0 +1,325 @@
+%PDF-1.5
+%ÐÔÅØ
+9 0 obj
+<<
+/Length 521       
+>>
+stream
+0 g 0 G
+0 g 0 G
+0 g 0 G
+BT
+/F8 9.9626 Tf 148.712 657.235 Td [(catalog)-333(/P)27(ageMo)-27(de/UseOutlinesop)-28(enaction)-333(goto)-334(page1/Fitcatalog)]TJ/F26 14.3462 Tf -14.944 -32.946 Td [(1)-1125(a)]TJ/F8 9.9626 Tf 0 -21.82 Td [(link:)]TJ/F27 9.9626 Tf 23.523 0 Td [(??)]TJ/F8 9.9626 Tf -23.523 -11.956 Td [(url:)]TJ/F28 9.9626 Tf 19.4 0 Td [(www.blub.de)]TJ/F8 9.9626 Tf -19.4 -11.955 Td [(\014le:)-444(tes)-1(t)-333(\014le)]TJ 0 -11.955 Td [(men)28(u:)-445(Find)]TJ
+0 g 0 G
+ 169.365 -477.238 Td [(1)]TJ
+0 g 0 G
+ET
+endstream
+endobj
+8 0 obj
+<<
+/Type /Page
+/Contents 9 0 R
+/Resources 7 0 R
+/MediaBox [0 0 612 792]
+/Parent 17 0 R
+/Annots [ 1 0 R 3 0 R 5 0 R 2 0 R 4 0 R 6 0 R ]
+>>
+endobj
+1 0 obj
+<<
+/Type /Annot
+/Ff 65537/FT/Btn/Subtype/Widget
+/Rect [153.168 590.513 156.157 593.502]
+>>
+endobj
+3 0 obj
+<<
+/Type /Annot
+/Ff 65537/FT/Btn/Subtype/Widget
+/Rect [153.694 578.558 156.682 581.547]
+>>
+endobj
+5 0 obj
+<<
+/Type /Annot
+/Ff 65537/FT/Btn/Subtype/Widget
+/Rect [164.487 566.603 167.475 569.592]
+>>
+endobj
+2 0 obj
+<<
+/Type /Annot
+/Border [1 1 1] /C [0 0 1] 
+/Rect [152.172 589.517 211.698 598.428]
+/Subtype/Link/A<</Type/Action /S/URI /URI(www.blub.de) >>
+>>
+endobj
+4 0 obj
+<<
+/Type /Annot
+/Border [1 1 1] /C [1 1 0] 
+/Rect [152.697 577.562 186.847 586.473]
+/Subtype/Link/A<</F(test-pdfresources.pdf)/S/GoToR/D[0/Fit]>>
+>>
+endobj
+6 0 obj
+<<
+/Type /Annot
+/Border [1 1 1] /C [.75 .5 .25] 
+/Rect [163.49 565.607 185.823 574.518]
+/Subtype/Link/A<</S/Named/N/Find>>
+>>
+endobj
+10 0 obj
+<<
+/D [8 0 R /XYZ 132.768 705.06 null]
+>>
+endobj
+12 0 obj
+<<
+/D [8 0 R /XYZ 440.784 657.235 null]
+>>
+endobj
+13 0 obj
+<<
+/D [8 0 R /XYZ 133.768 639.732 null]
+>>
+endobj
+7 0 obj
+<<
+/Font << /F8 11 0 R /F26 14 0 R /F27 15 0 R /F28 16 0 R >>
+/ProcSet [ /PDF /Text ]
+>>
+endobj
+18 0 obj
+[525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525]
+endobj
+19 0 obj
+[543.1]
+endobj
+20 0 obj
+[562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 312.5 312.5 342.6 875 531.2 531.2 875 849.5 799.8 812.5 862.3 738.4 707.2 884.3 879.6 419 581 880.8 675.9 1067.1 879.6 844.9 768.5 844.9 839.1 625 782.4 864.6 849.5 1162 849.5 849.5 687.5 312.5 581 312.5 562.5 312.5 312.5 546.9]
+endobj
+21 0 obj
+[555.6 555.6 833.3 833.3 277.8 305.6 500 500 500 500 500 750 444.4 500 722.2 777.8 500 902.8 1013.9 777.8 277.8 277.8 500 833.3 500 833.3 777.8 277.8 388.9 388.9 500 777.8 277.8 333.3 277.8 500 500 500 500 500 500 500 500 500 500 500 277.8 277.8 277.8 777.8 472.2 472.2 777.8 750 708.3 722.2 763.9 680.6 652.8 784.7 750 361.1 513.9 777.8 625 916.7 750 777.8 680.6 777.8 736.1 555.6 722.2 750 750 1027.8 750 750 611.1 277.8 500 277.8 500 277.8 277.8 500 555.6 444.4 555.6 444.4 305.6 500 555.6 277.8 305.6 527.8 277.8 833.3 555.6 500 555.6 527.8 391.7 394.4 388.9 555.6]
+endobj
+22 0 obj
+<<
+/Length1 1376
+/Length2 7685
+/Length3 0
+/Length 9061      
+>>
+[BINARY STREAM]
+endobj
+23 0 obj
+<<
+/Type /FontDescriptor
+/FontName /XOSQUH+CMBX10
+/Flags 4
+/FontBBox [-56 -250 1164 750]
+/Ascent 694
+/CapHeight 686
+/Descent -194
+/ItalicAngle 0
+/StemV 114
+/XHeight 444
+/CharSet (/question)
+/FontFile 22 0 R
+>>
+endobj
+24 0 obj
+<<
+/Length1 1385
+/Length2 6103
+/Length3 0
+/Length 7488      
+>>
+[BINARY STREAM]
+endobj
+25 0 obj
+<<
+/Type /FontDescriptor
+/FontName /BPRHGW+CMBX12
+/Flags 4
+/FontBBox [-53 -251 1139 750]
+/Ascent 694
+/CapHeight 686
+/Descent -194
+/ItalicAngle 0
+/StemV 109
+/XHeight 444
+/CharSet (/a/one)
+/FontFile 24 0 R
+>>
+endobj
+26 0 obj
+<<
+/Length1 1724
+/Length2 12531
+/Length3 0
+/Length 14255     
+>>
+[BINARY STREAM]
+endobj
+27 0 obj
+<<
+/Type /FontDescriptor
+/FontName /HPJFJG+CMR10
+/Flags 4
+/FontBBox [-40 -250 1009 750]
+/Ascent 694
+/CapHeight 683
+/Descent -194
+/ItalicAngle 0
+/StemV 69
+/XHeight 431
+/CharSet (/F/M/O/P/U/a/c/colon/d/e/fi/g/i/k/l/m/n/o/one/p/r/s/slash/t/u)
+/FontFile 26 0 R
+>>
+endobj
+28 0 obj
+<<
+/Length1 1462
+/Length2 8249
+/Length3 0
+/Length 9711      
+>>
+[BINARY STREAM]
+endobj
+29 0 obj
+<<
+/Type /FontDescriptor
+/FontName /WGRNZC+CMTT10
+/Flags 4
+/FontBBox [-4 -233 537 696]
+/Ascent 611
+/CapHeight 611
+/Descent -222
+/ItalicAngle 0
+/StemV 69
+/XHeight 431
+/CharSet (/b/d/e/l/period/u/w)
+/FontFile 28 0 R
+>>
+endobj
+15 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/BaseFont /XOSQUH+CMBX10
+/FontDescriptor 23 0 R
+/FirstChar 63
+/LastChar 63
+/Widths 19 0 R
+>>
+endobj
+14 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/BaseFont /BPRHGW+CMBX12
+/FontDescriptor 25 0 R
+/FirstChar 49
+/LastChar 97
+/Widths 20 0 R
+>>
+endobj
+11 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/BaseFont /HPJFJG+CMR10
+/FontDescriptor 27 0 R
+/FirstChar 12
+/LastChar 117
+/Widths 21 0 R
+>>
+endobj
+16 0 obj
+<<
+/Type /Font
+/Subtype /Type1
+/BaseFont /WGRNZC+CMTT10
+/FontDescriptor 29 0 R
+/FirstChar 46
+/LastChar 119
+/Widths 18 0 R
+>>
+endobj
+17 0 obj
+<<
+/Type /Pages
+/Count 1
+/Kids [8 0 R]
+>>
+endobj
+30 0 obj
+<<
+/Names [(Doc-Start) 12 0 R (page.1) 10 0 R (section.1) 13 0 R]
+/Limits [(Doc-Start) (section.1)]
+>>
+endobj
+31 0 obj
+<<
+/Dests 30 0 R
+>>
+endobj
+32 0 obj
+<<
+/Type /Catalog
+/Pages 17 0 R
+/Names 31 0 R
+>>
+endobj
+33 0 obj
+<<
+/Producer (pdfTeX)/Author()/Title()/Subject()/Creator(LaTeX with hyperref)/Producer(\@pdfproducer )/Keywords()
+/Trapped /False
+>>
+endobj
+xref
+0 34
+0000000000 65535 f 
+0000000747 00000 n 
+0000001065 00000 n 
+0000000853 00000 n 
+0000001225 00000 n 
+0000000959 00000 n 
+0000001389 00000 n 
+0000001706 00000 n 
+0000000594 00000 n 
+0000000015 00000 n 
+0000001530 00000 n 
+0000045180 00000 n 
+0000001588 00000 n 
+0000001647 00000 n 
+0000045040 00000 n 
+0000044900 00000 n 
+0000045320 00000 n 
+0000045461 00000 n 
+0000001810 00000 n 
+0000002124 00000 n 
+0000002148 00000 n 
+0000002448 00000 n 
+0000003034 00000 n 
+0000012193 00000 n 
+0000012419 00000 n 
+0000020005 00000 n 
+0000020228 00000 n 
+0000034582 00000 n 
+0000034858 00000 n 
+0000044667 00000 n 
+0000045519 00000 n 
+0000045638 00000 n 
+0000045674 00000 n 
+0000045739 00000 n 
+trailer
+<< /Size 34
+/Root 32 0 R
+/Info 33 0 R
+ >>
+startxref
+45888
+%%EOF





More information about the latex3-commits mailing list