[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: storing, not completly right yet ... (012951b)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon Sep 2 00:05:53 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/012951be1bcb13b64c97c7a9872fdd263ce38237

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

commit 012951be1bcb13b64c97c7a9872fdd263ce38237
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon Sep 2 00:05:53 2019 +0200

    storing, not completly right yet ...


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

012951be1bcb13b64c97c7a9872fdd263ce38237
 hluatex-experimental.def                | 209 +++++++++++++++-----------------
 pdfresources.dtx                        |  21 +++-
 testfiles-pool/calculationsortorder.pvt |  65 ++++++++--
 3 files changed, 169 insertions(+), 126 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index ec02c94..7bf437a 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -845,78 +845,49 @@
 
 \ExplSyntaxOn
 \def\MakeFieldObject#1#2
- {
-  \hbox_set:Nn\l_tmpa_box {#1}
-  \pdf_xform_new:nnnN { #2 }{}{} \l_tmpa_box
+  {
+    \pdf_xform_new:nnnn { #2 }{}{} { #1 }
   }%
+
 \let\HyField at afields\ltx at empty
 \let\HyField at cofields\ltx at empty
 %% UF test for old pdftex removed
-  \let\HyField at AuxAddToFields\ltx at gobble
-  \let\HyField at AuxAddToCoFields\ltx at gobbletwo
-  \def\HyField at AfterAuxOpen{\Hy at AtBeginDocument}%
-
+%\let\HyField at AuxAddToFields\ltx at gobble
+%\let\HyField at AuxAddToCoFields\ltx at gobbletwo
+\def\HyField at AfterAuxOpen{\Hy at AtBeginDocument}%
 
-  \def\HyField at ABD@AuxAddToCoFields#1#2{%
-    \group_begin:
-      \Hy at safe@activestrue
-      \let\ltx at secondoftwo\relax
-      \ifx\HyField at cofields\ltx at empty
-        \xdef\HyField at cofields{%
-          \ltx at secondoftwo{#1}{~#2}%
-        }
-      \else
-        \let\ltx at secondoftwo\relax
-        \def\HyField at AddCoField##1##2##3{%
-          \ifx##1\ltx at empty
-            \ltx at secondoftwo{#1}{~#2}%
-            \expandafter\ltx at gobble
-          \else
-            \ifnum\pdf at strcmp{##2}{#1}>\ltx at zero
-              \ltx at secondoftwo{#1}{~#2}%
-              \ltx at secondoftwo{##2}{##3}%
-              \expandafter\expandafter\expandafter\ltx at gobble
-            \else
-              \ltx at secondoftwo{##2}{##3}%
-            \fi
-          \fi
-          \HyField at AddCoField
-        }%
-        \xdef\HyField at cofields{%
-          \expandafter\HyField at AddCoField
-          \HyField at cofields\ltx at empty\ltx at empty\ltx at empty
-        }%
-      \fi
-    \group_end:
+\prop_new:N   \g_hyp_AcroForm_CoFields_prop
+\prop_new:N   \g_hyp_AcroForm_Fields_prop
+\def\HyField at AuxAddToFields#1
+  {
+    %\pdf_catalog_gput:nx { AcroForm/Fields}{ #1 }
+    \prop_gput:Nnn \g_hyp_AcroForm_Fields_prop {#1}{F}
   }%
 
-  \Hy at AtBeginDocument{%
+\def\HyField at AuxAddToCoFields #1 #2
+  {
+    \prop_gput:Nnn \g_hyp_AcroForm_CoFields_prop {a#1}{#2}
+  }
+
+\Hy at AtBeginDocument
+  {
     \if at filesw
       \immediate\write\@mainaux{%
         \string\providecommand\string\HyField at AuxAddToFields[1]{}%
-      }%
+       }%
       \immediate\write\@mainaux{%
         \string\providecommand\string\HyField at AuxAddToCoFields[2]{}%
       }%
     \fi
     \let\HyField at AfterAuxOpen\@firstofone
-    \def\HyField at AuxAddToFields#1{%
-      \xdef\HyField at afields{%
-        \ifx\HyField at afields\@empty
-        \else
-          \HyField at afields
-          \space
-        \fi
-        #1
-      }%
-    }%
-    \let\HyField at AuxAddToCoFields\HyField at ABD@AuxAddToCoFields
   }%
-  \def\HyField at AddToFields{%
-     \exp_args:Nx\HyField@@AddToFields
-      {%
-       \pdf_link_last:
-      }%
+
+\def\HyField at AddToFields
+  {
+    \exp_args:Nx\HyField@@AddToFields
+      {
+        \pdf_link_last:
+      }
     \ifx\Fld at calculate@code\ltx at empty
     \else
       \begingroup
@@ -939,11 +910,12 @@
       \Hy at temp
     \fi
   }%
-  \def\HyField@@AddToFields#1{
-    \HyField at AfterAuxOpen{%
-      \if at filesw
-        \write\@mainaux{%
-          \string\HyField at AuxAddToFields{#1}%
+
+\def\HyField@@AddToFields#1{
+  \HyField at AfterAuxOpen{%
+    \if at filesw
+      \write\@mainaux{%
+        \string\HyField at AuxAddToFields{#1}%
         }%
       \fi
     }%
@@ -953,60 +925,71 @@
 \ExplSyntaxOn
 
 \def\@Form[#1]
- {
-  \@ifundefined{textcolor}{\let\textcolor\@gobble}{}
-  \kvsetkeys{Form}{#1}
-  \pdf at ifdraftmode{}
-   {
-    \Hy at FormObjects
-    \AtVeryEndDocument
-     {
-      \pdf_object_new:nn   { l__hyp_acroform_dict_obj } {dict}
-      \pdf_object_write:nx { l__hyp_acroform_dict_obj }
+  {
+    \@ifundefined{textcolor}{\let\textcolor\@gobble}{}
+    \kvsetkeys{Form}{#1}
+    \pdf at ifdraftmode{}
       {
-        /Fields[\HyField at afields]
-        \ifx\HyField at cofields\ltx at empty
-        \else
-           /CO[\romannumeral-`\Q\HyField at cofields]%
-         \fi
-        /DR<<
-            /Font<<
-              /ZaDb~\pdf_object_ref:n {l__hyp_font_zapfdingbats_obj}~
-              /Helv~\pdf_object_ref:n {l__hyp_font_helvetica_obj}
-            >>
-          >>
-          /DA(/Helv~10~Tf~0~g)
-          \ifHy at pdfa %???????
-          \else
-            \ifHyField at NeedAppearances
-              /NeedAppearances~true%
-            \fi
-          \fi
-      }
-      %%% Acroform management needs sorting out  ...
-   %!!!!   \pdf_DONTUSE_catalog_gput:nn{AcroForm}{\pdf_object_ref:n{l__hyp_acroform_dict_obj}}%
-    }
+        \Hy at FormObjects
+        \tl_if_empty:NF\HyField at cofields
+        {
+         \show\HyField at cofields
+         %\pdf_object_new:nn   { l__hyp_acroform/co_obj } {array}
+         %\pdf_catalog_gput:nn {AcroForm/CO}{ l__hyp_acroform/co_obj }
+        }
+
+       \pdf_object_new:nn   { l__hyp_acroform/dr/font_obj }{dict}
+       \pdf_catalog_gput:nx
+         { AcroForm/DR/Font }
+         { \pdf_object_ref:n {l__hyp_acroform/dr/font_obj} }
+       \pdf_catalog_gput:nn {AcroForm}{{DA}{(/Helv~10~Tf~0~g)}}
+       %\ifHy at pdfa %???????
+       \legacy_if:nF { Hy at pdfa }
+         {
+           \legacy_if:nT { HyField at NeedAppearances }
+             {
+               \pdf_catalog_gput:nn {AcroForm}{{NeedAppearances}{true}}
+             }
+         }
+        \AtEndDocument
+          {
+            \pdf_object_write:nx
+              { l__hyp_acroform/fields_obj }
+              { \HyField at afields }
+            \tl_if_empty:NF \HyField at cofields
+              {
+                %\pdf_object_write:nx { l__hyp_acroform/co_obj } {\romannumeral-`\Q\HyField at cofields}
+              }
+            \pdf_object_write:nx { l__hyp_acroform/dr/font_obj }
+              {
+                /ZaDb~\pdf_object_ref:n {l__hyp_font_zapfdingbats_obj}~
+                /Helv~\pdf_object_ref:n {l__hyp_font_helvetica_obj}
+              }
+          }
+       }
+     \MakeFieldObject
+       {
+         \group_begin:
+         \fontfamily{pzd}
+         \fontencoding{U}
+         \fontseries{m}
+         \fontshape{n}
+         \selectfont
+         \char123
+         \group_end:
+       }
+       {__hyp_xform_Ding}
+     \MakeFieldObject
+       {
+         \fbox{\textcolor{yellow}{\textsf{Submit}}} %color?
+       }
+       {__hyp_xform_Submit}
+     \MakeFieldObject
+       {
+         \fbox{\textcolor{yellow}{\textsf{SubmitP}}} %color?
+       }
+       {__hyp_xform_SubmitP}
   }
-  \MakeFieldObject
-   {
-    \group_begin:
-      \fontfamily{pzd}
-      \fontencoding{U}
-      \fontseries{m}
-      \fontshape{n}
-      \selectfont
-      \char123
-    \group_end:
-   }{__hyp_xform_Ding}
-  \MakeFieldObject
-   {
-    \fbox{\textcolor{yellow}{\textsf{Submit}}} %color?
-   }{__hyp_xform_Submit}
-  \MakeFieldObject
-   {
-    \fbox{\textcolor{yellow}{\textsf{SubmitP}}} %color?
-   }{__hyp_xform_SubmitP}
-}
 \ExplSyntaxOff
 \let\@endForm\ltx at empty
 \let\HyAnn at AbsPageLabel\ltx at empty
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 863ab7f..0f1bfda 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -1910,8 +1910,9 @@
 % \end{tabularx}
 %
 % The following keys are dictionaries to which multiple values can be
-% assigned which are then combined in an array. The value is \emph{always}
-% an object name of an object which must have been declared previously. E.g.
+% assigned which are then combined in an array. The value is -- with the exception
+% of AcroForm/Fields and AcroForm/CO an object name of an object
+% which must have been declared previously. E.g.
 %  \begin{verbatim}
 %  \pdf_object_new:nn   {pkg at intent}{dict}
 %  \pdf_object_write:nn {pkg at intent}{...}
@@ -1922,8 +1923,8 @@
 %   \noindent
 %   \begin{tabularx}{\linewidth}{ll>{\raggedright\arraybackslash}X}
 %    \bfseries Key        & \bfseries Value   & \bfseries Remark \\\midrule
-%    AcroForm/Fields      & object name\\
-%    AcroForm/CO          & object name\\
+%    AcroForm/Fields      & object reference\\
+%    AcroForm/CO          & object reference\\
 %    AF                   & object name\\
 %    OCProperties/OCGs    & object name  &if there are OCProperties, OCGs and D are required.\\
 %    OCProperties/Configs & object name \\
@@ -2018,8 +2019,6 @@
 \clist_const:Nn \c_@@_Catalog_seq_clist
   {
     AF,
-    AcroForm/Fields,
-    AcroForm/CO,
     OCProperties/OCGs,
     OCProperties/Configs,
     OutputIntents,
@@ -2034,6 +2033,16 @@
        \seq_gput_right:cx { g_@@_/Catalog/#1_seq } { \pdf_object_ref:n { ##1 } }
      }
  }
+%not from a named object 
+\clist_map_inline:nn { AcroForm/Fields, AcroForm/CO }
+  {
+    \seq_new:c { g_@@_/Catalog/#1_seq }
+    \cs_new_protected:cpn { @@_/Catalog/#1_gput:n } ##1
+      {
+        \seq_gput_right:cx { g_@@_/Catalog/#1_seq } { ##1 }
+      }
+ }
+
 
 \cs_new_protected:cpn { @@_/Catalog/OCProperties/D_gput:n } #1
   {
diff --git a/testfiles-pool/calculationsortorder.pvt b/testfiles-pool/calculationsortorder.pvt
index 08a584f..d2e6f58 100644
--- a/testfiles-pool/calculationsortorder.pvt
+++ b/testfiles-pool/calculationsortorder.pvt
@@ -1,9 +1,50 @@
-\input{regression-test}
+% !Mode:: "TeX:DE:UTF-8:Main"
+%\input{regression-test}
 \documentclass{article}
-\usepackage[customdriver=hluatex-experimental]{hyperref}
-
-
+\usepackage[customdriver=hluatex-experimental]
+{hyperref}
+\ExplSyntaxOn
+\pdf_uncompress:
+%\makeatletter\def\HyField at ABD@AuxAddToCoFields#1#2{%
+%    \group_begin:
+%      \Hy at safe@activestrue
+%      \let\ltx at secondoftwo\relax
+%      \ifx\HyField at cofields\ltx at empty
+%        \xdef\HyField at cofields{%
+%          \ltx at secondoftwo{#1}{~#2}%
+%        } \show\HyField at cofields
+%      \else
+%        \let\ltx at secondoftwo\relax
+%        \def\HyField at AddCoField##1##2##3{%
+%          \ifx##1\ltx at empty
+%            \ltx at secondoftwo{#1}{~#2}%
+%            \expandafter\ltx at gobble
+%          \else
+%            \ifnum\pdf at strcmp{##2}{#1}>\ltx at zero
+%              \ltx at secondoftwo{#1}{~#2}%
+%              \ltx at secondoftwo{##2}{##3}%
+%              \expandafter\expandafter\expandafter\ltx at gobble
+%            \else
+%              \ltx at secondoftwo{##2}{##3}%
+%            \fi
+%          \fi
+%          %\show\HyField at AddCoField
+%          \HyField at AddCoField
+%        }%
+%        \xdef\HyField at cofields{%
+%          \expandafter\HyField at AddCoField
+%          \HyField at cofields\ltx at empty\ltx at empty\ltx at empty
+%        }%
+%        \show\HyField at cofields
+%      \fi
+%    \group_end:
+%  }%
+%\makeatother
+\ExplSyntaxOff
 \begin{document}
+\ExplSyntaxOn
+\prop_show:N\g_hyp_AcroForm_CoFields_prop
+\ExplSyntaxOff
 \begin{Form}
 \TextField[
   maxlen=40,
@@ -13,9 +54,19 @@
     var f_gamma = this.getField("gamma2");
     event.value = f_alpha.value + f_beta.value +f_gamma.value;
   },
-   align=2,height=10pt,width=45pt,name=gamma,readonly=true,%calculatesortkey=b
+   align=2,height=10pt,width=45pt,name=gamma,readonly=true,calculatesortkey=c
    ]{Gamma}
 
+\TextField[
+  maxlen=40,
+  calculate={%
+    var f_alpha = this.getField("alpha");
+    var f_beta = this.getField("beta");
+    var f_gamma = this.getField("gamma2");
+    event.value = f_alpha.value + f_beta.value +f_gamma.value;
+  },
+   align=2,height=10pt,width=45pt,name=gamma,readonly=true,calculatesortkey=a
+   ]{Gamma}
 
 \TextField[
   maxlen=40,
@@ -24,8 +75,8 @@
     var f_beta = this.getField("beta");
     event.value = f_alpha.value + 2*f_beta.value;
   },
-   align=2,height=10pt,width=45pt,name=gamma2,readonly=true,%calculatesortkey=a
-   ]{Gamma}
+   align=2,height=10pt,width=45pt,name=gamma2,readonly=true,calculatesortkey=b
+   ]{Gamma2}
 
 \TextField[maxlen=40,align=2,height=10pt,width=45pt,name=alpha,value=0]{Alpha}
 





More information about the latex3-commits mailing list