[latex3-commits] [git/LaTeX3-latex3-pdfresources] renamedict77: new-attachfile, currently broken (ba41b1b)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Apr 28 00:43:37 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : renamedict77
Link       : https://github.com/latex3/pdfresources/commit/ba41b1babbf55ad45c98849ce6c9780e190b1016

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

commit ba41b1babbf55ad45c98849ce6c9780e190b1016
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Apr 28 00:43:37 2020 +0200

    new-attachfile, currently broken


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

ba41b1babbf55ad45c98849ce6c9780e190b1016
 newpackages/atfi-generic.def   |  38 ++-----
 newpackages/new-attachfile.sty | 242 ++++++++++++++++++++---------------------
 newpackages/new-pdfescape.sty  |   8 +-
 3 files changed, 137 insertions(+), 151 deletions(-)

diff --git a/newpackages/atfi-generic.def b/newpackages/atfi-generic.def
index f55b0f6..f0450f4 100644
--- a/newpackages/atfi-generic.def
+++ b/newpackages/atfi-generic.def
@@ -46,35 +46,15 @@
   \edef\atfi at params{\atfi at params/Size #1}%
 }
 \ExplSyntaxOn
-\def\atfi at embedfile#1{%
-  \ltx at IfUndefined{atfi at fileobj@#1}{%
-    \begingroup
-      \let\atfi at params\ltx at empty
-      \expandafter\let\expandafter\atfi at temp
-          \csname atfi at file@#1\endcsname
-      \ifx\atfi at temp\ltx at empty
-        \let\atfi at temp\relax
-      \fi
-      \ifx\atfi at temp\relax
-        \atfi at pdftexdata{#1}%
-      \else
-        \edef\x{%
-          \noexpand\setkeys{AtFi at file}{\@nameuse{atfi at file@#1}}%
-        }%
-        \x
-      \fi
-      \ifx\atfi at params\ltx at empty
-      \else
-        \edef\atfi at params{/Params<<\atfi at params>>}%
-      \fi
-      \pdf_object_now:nx{fstream}{{/Type/EmbeddedFile\atfi at mimetype\atfi at params}{#1}}
-      \expandafter
-      \xdef\csname atfi at fileobj@#1\endcsname{\pdf_object_last:}%
-    \endgroup
-  }{%
-    % file already embedded
-  }%
-}
+\def\atfi at embedfile#1
+  {%
+  \pdfobject_if_exist:nF { atfi at fileobj@#1 }
+   {
+     %keys for dict entries ...
+     \pdffile_embed:nn {atfi at fileobj@#1 }{ #1 }
+   }
+  }
+
 % we probably need an xform by icon ...
 
 \def\atfi at xform{%
diff --git a/newpackages/new-attachfile.sty b/newpackages/new-attachfile.sty
index e0877d8..fda35cb 100644
--- a/newpackages/new-attachfile.sty
+++ b/newpackages/new-attachfile.sty
@@ -52,7 +52,7 @@
 \RequirePackage{pdfescape}[2007/11/11]
 \RequirePackage{hyperref}
 \RequirePackage{hycolor}[2008/07/29]
-\RequirePackage{l3color,l3draw}
+\RequirePackage{l3color,l3draw,l3pdffile}
 \ltx at IfUndefined{pdfmatch}{%
   \def\atfi at Match#1#2#3#4#5{}%
 }{%
@@ -306,7 +306,7 @@
 \input{atfi-generic.def}
 \ExplSyntaxOn
 
-\cs_new:Npn \__atfi_color_to_rgb_seq:nN #1 #2 % #1 name #2 seq
+\cs_new_protected:Npn \__atfi_color_to_rgb_seq:nN #1 #2 % #1 name #2 seq
  {
    \tl_set_eq:NN \l__color_ori_fixed_model_tl \l_color_fixed_model_tl
    \tl_set:Nn \l_color_fixed_model_tl {rgb}
@@ -319,47 +319,53 @@
 
 \color_set:nnn {__atfi_color_inline}{rgb}{1,0.9255,0.7765}
 
-\def\atfi at acroGraph@data{%
-   \__draw_backend_scope_begin:
-   \__draw_backend_color_fill_gray:n {0.5}
-   \__draw_backend_rectangle:nnnn {1.1133bp}{0bp}{20.7202bp}{18.2754bp}
-   \__draw_backend_fill:
-   \__draw_backend_literal:x {0~i} %???
-   \__draw_backend_linewidth:n {0.5bp}
-   \__draw_backend_miterlimit:n {4bp}
+\cs_new_protected:Npn \atfi at acroGraph@data
+  {
+    \__draw_backend_scope_begin:
+    \__draw_backend_color_fill_gray:n {0.5}
+    \__draw_backend_rectangle:nnnn {1.1133bp}{0bp}{20.7202bp}{18.2754bp}
+    \__draw_backend_fill:
+    \__draw_backend_literal:x {0~i} %???
+    \__draw_backend_linewidth:n {0.5bp}
+    \__draw_backend_miterlimit:n {4bp}
 
-   \__draw_backend_color_fill_gray:n {1}
-   \__draw_backend_color_stroke_gray:n {0}
-   \__draw_backend_rectangle:nnnn {0.25bp} {1.6453bp} {20.145bp} {17.7715bp}
-   \__draw_backend_fillstroke:
+    \__draw_backend_color_fill_gray:n {1}
+    \__draw_backend_color_stroke_gray:n {0}
+    \__draw_backend_rectangle:nnnn {0.25bp} {1.6453bp} {20.145bp} {17.7715bp}
+    \__draw_backend_fillstroke:
 
-   \__draw_backend_color_fill_gray:n {0}
-   \__draw_backend_rectangle:nnnn {2.7319bp}{4.1367bp}{3.9571bp}{13.8867bp}
-   \__draw_backend_fill:
-   \__draw_backend_rectangle:nnnn {8.7031bp}{4.1367bp}{3.9571bp}{9.8867bp}
-   \__draw_backend_fill:
-   \__draw_backend_rectangle:nnnn {14.7471bp}{4.1367bp}{3.9571bp}{11.8867bp}
-   \__draw_backend_fill:
+    \__draw_backend_color_fill_gray:n {0}
+    \__draw_backend_rectangle:nnnn {2.7319bp}{4.1367bp}{3.9571bp}{13.8867bp}
+    \__draw_backend_fill:
+    \__draw_backend_rectangle:nnnn {8.7031bp}{4.1367bp}{3.9571bp}{9.8867bp}
+    \__draw_backend_fill:
+    \__draw_backend_rectangle:nnnn {14.7471bp}{4.1367bp}{3.9571bp}{11.8867bp}
+    \__draw_backend_fill:
 
-   \__atfi_color_to_rgb_seq:nN {__atfi_color_inline} \l_tmpa_seq
-   \exp_last_unbraced:Ne \__draw_backend_color_fill_rgb:nnn
-     { \seq_map_function:NN \l_tmpa_seq \__atfi_arg_braced:n }
+    \__atfi_color_to_rgb_seq:nN {__atfi_color_inline} \l_tmpa_seq
+    \exp_last_unbraced:Ne \__draw_backend_color_fill_rgb:nnn
+      { \seq_map_function:NN \l_tmpa_seq \__atfi_arg_braced:n }
 
-   \__draw_backend_rectangle:nnnn {1.689bp}{3.0938bp}{3.9571bp}{13.8867bp}
-   \__draw_backend_fill:
-   \__draw_backend_rectangle:nnnn {7.6602bp}{3.0938bp}{3.9571bp}{9.8867bp}
-   \__draw_backend_fill:
-   \__draw_backend_rectangle:nnnn {13.7041bp}{3.0938bp}{3.9571bp}{11.8867bp}
-   \__draw_backend_fill:
-   \__draw_backend_scope_end:
-}
-\def\atfi at acroGraph{%
-  \raisebox{-1.5bp}{\parbox[b][20bp]{22bp}{%
-    \rule{0pt}{0pt}\atfi at acroGraph@data}%
-  }%
-}
+    \__draw_backend_rectangle:nnnn {1.689bp}{3.0938bp}{3.9571bp}{13.8867bp}
+    \__draw_backend_fill:
+    \__draw_backend_rectangle:nnnn {7.6602bp}{3.0938bp}{3.9571bp}{9.8867bp}
+    \__draw_backend_fill:
+    \__draw_backend_rectangle:nnnn {13.7041bp}{3.0938bp}{3.9571bp}{11.8867bp}
+    \__draw_backend_fill:
+    \__draw_backend_scope_end:
+  }
+\cs_new_protected:Npn \atfi at acroGraph
+  {
+    \raisebox{-1.5bp}
+      {
+        \parbox[b][20bp]{22bp}
+          {
+            \rule{0pt}{0pt}\atfi at acroGraph@data
+          }
+      }
+  }
 
-\newcommand{\atfi at acroPaperclip@data}
+\cs_new_protected:Npn {\atfi at acroPaperclip@data}
   {
     \__draw_backend_scope_begin:
     \__draw_backend_color_stroke_gray:n {0.75}
@@ -420,55 +426,68 @@
     \__draw_backend_scope_end:
     }
 
-\def\atfi at acroPaperclip{%
-  \raisebox{-1.25bp}{\parbox[b][21bp]{12bp}{%
-    \rule{0pt}{0pt}\atfi at acroPaperclip@data}%
-  }%
-}
-\def\atfi at acroPushPin@data{%
-  \__draw_backend_scope_begin:
-  \__draw_backend_linewidth:n {1bp}
-  \__draw_backend_moveto:nn {1bp} {6bp}
-  \__draw_backend_lineto:nn {11bp}{6bp}
-  \__draw_backend_lineto:nn {11bp}{13bp}
-  \__draw_backend_lineto:nn {12bp}{13bp}
-  \__draw_backend_lineto:nn {14bp}{11bp}
-  \__draw_backend_lineto:nn {21bp}{11bp}%
-  \__draw_backend_lineto:nn {22bp}{12bp}
-  \__draw_backend_lineto:nn {23bp}{12bp}
-  \__draw_backend_lineto:nn {23bp}{2bp}
-  \__draw_backend_lineto:nn {22bp}{2bp}
-  \__draw_backend_lineto:nn {21bp}{3bp}
-  \__draw_backend_lineto:nn {14bp}{3bp}
-  \__draw_backend_lineto:nn {12bp}{1bp}
-  \__draw_backend_lineto:nn {11bp}{1bp}
-  \__draw_backend_lineto:nn {11bp}{6bp}
-  \__atfi_color_to_rgb_seq:nN {__atfi_color_inline} \l_tmpa_seq
-     \exp_last_unbraced:Ne \__draw_backend_color_fill_rgb:nnn
-       { \seq_map_function:NN \l_tmpa_seq \__atfi_arg_braced:n }
-  \__draw_backend_color_stroke_gray:n {0}
-  \__draw_backend_fillstroke:
-  \__draw_backend_color_stroke_gray:n {0.5}
-  \__draw_backend_moveto:nn {0bp} {7bp}
-  \__draw_backend_lineto:nn {10bp}{7bp}
-  \__draw_backend_lineto:nn {10bp}{8bp}
-  \__draw_backend_lineto:nn {1bp}{8bp}
-  \__draw_backend_stroke:
-  \__draw_backend_color_stroke_gray:n {1}
-  \__draw_backend_moveto:nn {12bp} {12bp}
-  \__draw_backend_lineto:nn {14bp}{10bp}
-  \__draw_backend_lineto:nn {22bp}{10bp}
-  \__draw_backend_lineto:nn {22bp}{11bp}
-  \__draw_backend_stroke:
-  \__draw_backend_scope_end:
-}
-\def\atfi at acroPushPin{%
-  \raisebox{-1.25bp}{\parbox[b][14bp]{24bp}{%
-    \rule{0pt}{0pt}\atfi at acroPushPin@data}%
-  }%
-}
+\cs_new_protected:Npn \atfi at acroPaperclip
+  {
+    \raisebox{-1.25bp}
+      {
+        \parbox[b][21bp]{12bp}
+          {
+            \rule{0pt}{0pt}\atfi at acroPaperclip@data
+          }
+      }
+  }
+
+\cs_new_protected:Npn \atfi at acroPushPin@data
+  {
+     \__draw_backend_scope_begin:
+     \__draw_backend_linewidth:n {1bp}
+     \__draw_backend_moveto:nn {1bp} {6bp}
+     \__draw_backend_lineto:nn {11bp}{6bp}
+     \__draw_backend_lineto:nn {11bp}{13bp}
+     \__draw_backend_lineto:nn {12bp}{13bp}
+     \__draw_backend_lineto:nn {14bp}{11bp}
+     \__draw_backend_lineto:nn {21bp}{11bp}%
+     \__draw_backend_lineto:nn {22bp}{12bp}
+     \__draw_backend_lineto:nn {23bp}{12bp}
+     \__draw_backend_lineto:nn {23bp}{2bp}
+     \__draw_backend_lineto:nn {22bp}{2bp}
+     \__draw_backend_lineto:nn {21bp}{3bp}
+     \__draw_backend_lineto:nn {14bp}{3bp}
+     \__draw_backend_lineto:nn {12bp}{1bp}
+     \__draw_backend_lineto:nn {11bp}{1bp}
+     \__draw_backend_lineto:nn {11bp}{6bp}
+     \__atfi_color_to_rgb_seq:nN {__atfi_color_inline} \l_tmpa_seq
+        \exp_last_unbraced:Ne \__draw_backend_color_fill_rgb:nnn
+          { \seq_map_function:NN \l_tmpa_seq \__atfi_arg_braced:n }
+     \__draw_backend_color_stroke_gray:n {0}
+     \__draw_backend_fillstroke:
+     \__draw_backend_color_stroke_gray:n {0.5}
+     \__draw_backend_moveto:nn {0bp} {7bp}
+     \__draw_backend_lineto:nn {10bp}{7bp}
+     \__draw_backend_lineto:nn {10bp}{8bp}
+     \__draw_backend_lineto:nn {1bp}{8bp}
+     \__draw_backend_stroke:
+     \__draw_backend_color_stroke_gray:n {1}
+     \__draw_backend_moveto:nn {12bp} {12bp}
+     \__draw_backend_lineto:nn {14bp}{10bp}
+     \__draw_backend_lineto:nn {22bp}{10bp}
+     \__draw_backend_lineto:nn {22bp}{11bp}
+     \__draw_backend_stroke:
+     \__draw_backend_scope_end:
+  }
+\cs_new_protected:Npn \atfi at acroPushPin
+  {
+    \raisebox{-1.25bp}
+      {
+        \parbox[b][14bp]{24bp}
+          {
+            \rule{0pt}{0pt}\atfi at acroPushPin@data
+          }
+      }
+   }
 
-\def\atfi at acroTag@data{%
+\cs_new_protected:Npn \atfi at acroTag@data
+  {
     \__draw_backend_scope_begin:
     \__draw_backend_color_fill_gray:n {0.5}
     \__draw_backend_moveto:nn {10.0542bp} {14.9873bp}
@@ -532,13 +551,20 @@
     \__draw_backend_stroke:
     \__draw_backend_scope_end:
   }
-\ExplSyntaxOff
 
-\def\atfi at acroTag{%
-  \raisebox{-1.6bp}{\parbox[b][17bp]{25bp}{%
-    \rule{0pt}{0pt}\atfi at acroTag@data}%
-  }%
-}
+
+\cs_new_protected:Npn \atfi at acroTag
+  {
+    \raisebox{-1.6bp}
+      {
+        \parbox[b][17bp]{25bp}
+          {
+            \rule{0pt}{0pt}\atfi at acroTag@data
+          }
+      }
+   }
+
+\ExplSyntaxOff
 \def\attachfile at timezone#1{%
   \ifx\\#1\\%
     % no timezone information given
@@ -554,7 +580,7 @@
     \@namedef{atfi at file@\atfi at filename}{#1}%
   \fi
 }
-\InputIfFileExists{\jobname.atfi}{}{}%
+
 \newif\ifatfi at checksum
 \define at key{AtFi at file}{CheckSum}{%
   \atfi at checksumtrue
@@ -633,34 +659,8 @@
     \fi
   }%
 \fi
-\if at filesw
-\else
-  \atfi at nofilestrue
-\fi
-\ifatfi at nofiles
-  \PackageInfo{attachfile2}{%
-    File `\jobname.atfi' will not be written because of\MessageBreak
-    \string\nofiles\space or option `nofiles'%
-  }%
-  \let\atfi at writefile\ltx at gobble
-\else
-  \newwrite\atfi at stream
-  \immediate\openout\atfi at stream=\jobname.atfi\relax
-  \immediate\write\atfi at stream{%
-    \string\attachfile at timezone{\atfi at timezone}%
-  }%
-  \def\atfi at writefile#1{%
-    \begingroup
-      \EdefEscapeHex\atfi at temp{#1}%
-      \immediate\write\atfi at stream{%
-        \string\attachfile at file[%
-          \ltx at ifundefined{atfi at file@#1}{}{\@nameuse{atfi at file@#1}}%
-        ]{\atfi at temp}%
-      }%
-    \endgroup
-  }%
-\fi
-\atfi at DisableOption{nofiles}
+%atfi file unneeded
+%\atfi at DisableOption{nofiles}
 \def\atfi at attachfile#1#2{%
   \ltx at IfUndefined{atfi at fileobj@#2}{%
     \atfi at writefile{#2}%
diff --git a/newpackages/new-pdfescape.sty b/newpackages/new-pdfescape.sty
index 3e5fc15..3d5114e 100644
--- a/newpackages/new-pdfescape.sty
+++ b/newpackages/new-pdfescape.sty
@@ -1,6 +1,12 @@
 \ProvidesExplPackage {new-pdfescape} {2020-04-21} {0.1}
-  {escape command for PDF}
+  {temporary escape commands and tools for PDF}
 %very temporarly until this is in l3 properly!!!!
+
+
+\prg_new_eq_conditional:NNn \pdfobject_if_exist:n\__pdf_backend_object_if_exist:n
+  { TF , T , F , p }
+
+
 \cs_new:Npn \str_escape_pdfname:n #1
   {
     \exp_args:Ne \tl_to_str:n





More information about the latex3-commits mailing list.