[latex3-commits] [git/LaTeX3-latex3-pdfresources] develop, textfields: added widget dictionaries (b892e60)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu May 6 19:26:40 CEST 2021


Repository : https://github.com/latex3/pdfresources
On branches: develop,textfields
Link       : https://github.com/latex3/pdfresources/commit/b892e60a3f70abfb6483a1a1e2586e402b0c92c3

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

commit b892e60a3f70abfb6483a1a1e2586e402b0c92c3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu May 6 19:26:40 2021 +0200

    added widget dictionaries


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

b892e60a3f70abfb6483a1a1e2586e402b0c92c3
 CHANGELOG.md   |  1 +
 l3pdfannot.dtx | 44 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 049def5..5784743 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ this project uses date-based 'snapshot' version identifiers.
 ### Added
  - generic command hooks have been added to \url, \href, \hrefurl,
    \hrefrun and \hrefpdf
+ - dictionaries widget/AA, widget/AP, widget/MK and widget/BS in l3pdfannot.  
       
 ## [2021-03-17]
 
diff --git a/l3pdfannot.dtx b/l3pdfannot.dtx
index 256e3e6..b0b6fd3 100644
--- a/l3pdfannot.dtx
+++ b/l3pdfannot.dtx
@@ -382,6 +382,11 @@
 %   is prefilled with  \texttt{/Subtype/Widget}).
 %   The hooks \texttt{pdfannot/widget/before} and \texttt{pdfannot/widget/after}
 %   are executed before and after the widget.
+%   The widget has four subdirectories, |widget/AA|, |widget/AP|, |widget/MK| and
+%   |widget/BS|
+%   which can be filled with \cs{pdfannot_dict_put:nnn} and will be used if not
+%   empty.
+%
 % \end{function}
 % \end{documentation}
 %
@@ -463,21 +468,52 @@
 % the subtype setting (the /Type is added by the backend).
 %    \begin{macrocode}
  \pdfdict_new:n   { l_@@/widget }
+ \pdfdict_new:n   { l_@@/widget/AA }
+ \pdfdict_new:n   { l_@@/widget/AP }
+ \pdfdict_new:n   { l_@@/widget/MK }
+ \pdfdict_new:n   { l_@@/widget/BS }
  \pdfdict_put:nnn { l_@@/widget }{ Subtype }{ /Widget }
  \hook_new_pair:nn
    {pdfannot/widget/before}
    {pdfannot/widget/after}
- \hook_new_pair:nn
-   {pdfannot/widget/begin}
-   {pdfannot/widget/end}
 \cs_new_protected:Npn \pdfannot_widget_box:nnn #1 #2 #3
   {
     \hook_use:n { pdfannot/widget/before }
+    \group_begin:
+    \pdfdict_if_empty:nF { l_@@/widget/AA }
+      {
+        \pdf_object_unnamed_write:nx {dict}{\pdfdict_use:n{l_@@/widget/AA}}
+        \pdfdict_put:nnx { l_@@/widget }
+             {AA}
+             {\pdf_object_ref_last:}
+      }
+    \pdfdict_if_empty:nF { l_@@/widget/AP }
+      {
+        \pdf_object_unnamed_write:nx {dict}{\pdfdict_use:n{l_@@/widget/AP}}
+        \pdfdict_put:nnx { l_@@/widget }
+             {AP}
+             {\pdf_object_ref_last:}
+      }
+    \pdfdict_if_empty:nF { l_@@/widget/MK }
+      {
+        \pdf_object_unnamed_write:nx {dict}{\pdfdict_use:n{l_@@/widget/MK}}
+        \pdfdict_put:nnx { l_@@/widget }
+             {MK}
+             {\pdf_object_ref_last:}
+      }
+    \pdfdict_if_empty:nF { l_@@/widget/BS }
+      {
+        \pdf_object_unnamed_write:nx {dict}{\pdfdict_use:n{l_@@/widget/BS}}
+        \pdfdict_put:nnx { l_@@/widget }
+             {BS}
+             {\pdf_object_ref_last:}
+      }
     \pdfannot_box:nnnx {#1}{#2}{#3}
       {
         \pdfdict_use:n { l_@@/widget}
       }
-    \hook_use:n { pdfannot/widget/after }
+    \hook_use:n { pdfannot/widget/end }
+    \group_end:
     \bool_gset_false:N\g_@@_use_lastlink_bool
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.