[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: working on form fields ... (a3a7d64)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Apr 30 11:16:28 CEST 2019


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

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

commit a3a7d6402068b10c47b10876c334e59f6a273299
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Apr 30 11:16:28 2019 +0200

    working on form fields ...


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

a3a7d6402068b10c47b10876c334e59f6a273299
 hluatex-experimental.def |  207 ++++++++++++++++++++++++----------------------
 pdfresources.dtx         |    3 +
 test-pdfresources.tex    |    7 +-
 3 files changed, 117 insertions(+), 100 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 85ea8a1..d6dd847 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -976,59 +976,60 @@
     }%
   }%
 \ExplSyntaxOn
-\def\@Form[#1]{%
-  \@ifundefined{textcolor}{\let\textcolor\@gobble}{}%
-  \kvsetkeys{Form}{#1}%
-  \pdf at ifdraftmode{}{%
+
+\def\@Form[#1]
+ {
+  \@ifundefined{textcolor}{\let\textcolor\@gobble}{}
+  \kvsetkeys{Form}{#1}
+  \pdf at ifdraftmode{}
+   {
     \Hy at FormObjects
-      \pdfrefobj\OBJ at pdfdocencoding
-      \pdfrefobj\OBJ at ZaDb
-      \pdfrefobj\OBJ at Helv
-    \AtVeryEndDocument{%
-     %\driver_pdf_object_new:nn  { l_hyp_form_dict_obj } {dict}
-     %\driver_pdf_object_write:nn
-      \immediate\pdfobj{%
-        <<%
-          /Fields[\HyField at afields]%
-          \ifx\HyField at cofields\ltx at empty
-          \else
-            /CO[\romannumeral-`\Q\HyField at cofields]%
-          \fi
-          /DR<<%
-            /Font<<%
-              /ZaDb~\OBJ at ZaDb\space 0~R%
-              /Helv~\OBJ at Helv\space 0~R%
-            >>%
-          >>%
-          /DA(/Helv~10~Tf~0~g)%
-          \ifHy at pdfa
+    \AtVeryEndDocument
+     {
+      \driver_pdf_object_new:nn   { l__hyp_acroform_dict_obj } {dict}
+      \driver_pdf_object_write:nx { l__hyp_acroform_dict_obj }
+      {
+        /Fields[\HyField at afields]
+        \ifx\HyField at cofields\ltx at empty
+        \else
+           /CO[\romannumeral-`\Q\HyField at cofields]%
+         \fi
+        /DR<<
+            /Font<<
+              /ZaDb~\driver_pdf_object_ref:n {l__hyp_font_zapfdingbats_obj}~
+              /Helv~\driver_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
-        >>%
-      }%
-      \edef\OBJ at acroform{\the\pdflastobj}%
-      \driver_pdf_catalog_gput:nn{AcroForm}{\OBJ at acroform\c_space_tl 0~R}%
-    }%
-  }%
-  \MakeFieldObject{%
-    \begingroup
-      \fontfamily{pzd}%
-      \fontencoding{U}%
-      \fontseries{m}%
-      \fontshape{n}%
+      }
+      \driver_pdf_catalog_gput:nn{AcroForm}{\driver_pdf_object_ref:n{l__hyp_acroform_dict_obj}}%
+    }
+  }
+  \MakeFieldObject
+   {
+    \group_begin:
+      \fontfamily{pzd}
+      \fontencoding{U}
+      \fontseries{m}
+      \fontshape{n}
       \selectfont
-      \char123 %
-    \endgroup
-  }{Ding}%
-  \MakeFieldObject{%
-    \fbox{\textcolor{yellow}{\textsf{Submit}}}%
-  }{Submit}%
-  \MakeFieldObject{%
-    \fbox{\textcolor{yellow}{\textsf{SubmitP}}}%
-  }{SubmitP}%
+      \char123
+    \group_end:
+   }{Ding}
+  \MakeFieldObject
+   {
+    \fbox{\textcolor{yellow}{\textsf{Submit}}} %color?
+   }{Submit}
+  \MakeFieldObject
+   {
+    \fbox{\textcolor{yellow}{\textsf{SubmitP}}} %color?
+   }{SubmitP}
 }
 \ExplSyntaxOff
 \let\@endForm\ltx at empty
@@ -1296,62 +1297,72 @@
     }%
   \endgroup
 }
+%hm. Should a luatex driver use type1 fonts in fields????
+\ExplSyntaxOn
 \def\Hy at FormObjects{%
-  \pdfobj {%
-    <<%
-      /Type/Encoding%
-      /Differences[%
-        24/breve/caron/circumflex/dotaccent/hungarumlaut/ogonek%
-          /ring/tilde %
-        39/quotesingle %
+  \driver_pdf_object_new:nn   {l__hyp_encoding_pdfdoc_obj } { dict }
+  \driver_pdf_object_new:nn   {l__hyp_font_zapfdingbats_obj } { dict }
+  \driver_pdf_object_new:nn   {l__hyp_font_helvetica_obj } { dict }
+  \driver_pdf_object_write:nx {l__hyp_encoding_pdfdoc_obj }
+   {
+      /Type/Encoding
+      /Differences[
+        24/breve/caron/circumflex/dotaccent/hungarumlaut/ogonek
+          /ring/tilde
+        \c_space_tl
+        39/quotesingle
+        \c_space_tl
         96/grave %
-        128/bullet/dagger/daggerdbl/ellipsis/emdash/endash/florin%
-           /fraction/guilsinglleft/guilsinglright/minus/perthousand%
-           /quotedblbase/quotedblleft/quotedblright/quoteleft%
-           /quoteright/quotesinglbase/trademark/fi/fl/Lslash/OE%
-           /Scaron/Ydieresis/Zcaron/dotlessi/lslash/oe/scaron/zcaron %
-        164/currency %
-        166/brokenbar %
-        168/dieresis/copyright/ordfeminine %
-        172/logicalnot/.notdef/registered/macron/degree/plusminus%
-           /twosuperior/threesuperior/acute/mu %
-        183/periodcentered/cedilla/onesuperior/ordmasculine %
-        188/onequarter/onehalf/threequarters %
-        192/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE%
-           /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave%
-           /Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute%
-           /Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave%
-           /Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls%
-           /agrave/aacute/acircumflex/atilde/adieresis/aring/ae%
-           /ccedilla/egrave/eacute/ecircumflex/edieresis/igrave%
-           /iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute%
-           /ocircumflex/otilde/odieresis/divide/oslash/ugrave%
-           /uacute/ucircumflex/udieresis/yacute/thorn/ydieresis%
-      ]%
-    >>%
-  }%
-  \xdef\OBJ at pdfdocencoding{\the\pdflastobj}%
-  \pdfobj{%
-    <<%
-      /Type/Font%
-      /Subtype/Type1%
-      /Name/ZaDb%
-      /BaseFont/ZapfDingbats%
-    >>%
-  }%
-  \xdef\OBJ at ZaDb{\the\pdflastobj}%
-  \pdfobj{%
-    <<%
-      /Type/Font%
-      /Subtype/Type1%
-      /Name/Helv%
-      /BaseFont/Helvetica%
-      /Encoding \OBJ at pdfdocencoding\space 0 R%
-    >>%
-  }%
-  \xdef\OBJ at Helv{\the\pdflastobj}%
+        \iow_newline:
+        128/bullet/dagger/daggerdbl/ellipsis/emdash/endash/florin
+           /fraction/guilsinglleft/guilsinglright/minus/perthousand
+           /quotedblbase/quotedblleft/quotedblright/quoteleft
+           /quoteright/quotesinglbase/trademark/fi/fl/Lslash/OE
+           /Scaron/Ydieresis/Zcaron/dotlessi/lslash/oe/scaron/zcaron
+        \iow_newline:
+        164/currency
+        \c_space_tl
+        166/brokenbar
+        \c_space_tl
+        168/dieresis/copyright/ordfeminine
+        \c_space_tl
+        172/logicalnot/.notdef/registered/macron/degree/plusminus
+           /twosuperior/threesuperior/acute/mu
+        \c_space_tl
+        183/periodcentered/cedilla/onesuperior/ordmasculine
+        \c_space_tl
+        188/onequarter/onehalf/threequarters
+        \iow_newline:
+        192/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+           /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave
+           /Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute
+           /Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave
+           /Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
+           /agrave/aacute/acircumflex/atilde/adieresis/aring/ae
+           /ccedilla/egrave/eacute/ecircumflex/edieresis/igrave
+           /iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute
+           /ocircumflex/otilde/odieresis/divide/oslash/ugrave
+           /uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
+      ]
+  }
+  \driver_pdf_object_write:nn {l__hyp_font_zapfdingbats_obj }
+   {
+      /Type/Font
+      /Subtype/Type1
+      /Name/ZaDb
+      /BaseFont/ZapfDingbats
+   }
+  \driver_pdf_object_write:nx {l__hyp_font_helvetica_obj }
+   {
+      /Type/Font
+      /Subtype/Type1
+      /Name/Helv
+      /BaseFont/Helvetica
+      /Encoding~\driver_pdf_object_ref:n { l__hyp_encoding_pdfdoc_obj }
+   }
   \global\let\Hy at FormObjects\relax
 }
+\ExplSyntaxOff
 \providecommand*{\Fld at pageobjref}{}
 \begingroup\expandafter\expandafter\expandafter\endgroup
 \expandafter\ifx\csname pdf at escapestring\endcsname\relax
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 9041fbf..a0b555d 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -124,6 +124,9 @@
 % implemented in all drivers.
 %    \begin{macrocode}
 %<*package>
+%some variants
+\cs_generate_variant:Nn\driver_pdf_object_write:nn {nx}
+
 \sys_if_engine_pdftex:T
 {
 
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index b4ad29e..747f67b 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -25,7 +25,9 @@
 \textwidth=5cm
 \begin{document}
 \makeatletter%\show\Hy at pstringdef
-
+\begin{Form}
+\TextField{abc}
+\TextField{cde}
 abc%\end{document}
 
 \pdfextension obj reserveobjnum
@@ -36,13 +38,14 @@ abc%\end{document}
 
 \ExplSyntaxOn
 
-\cs_show:N\driver_pdf_object_new:nn
+%\cs_show:N\driver_pdf_object_new:nn
 
 \driver_pdf_object_new:nn {testobjA}{dict}
 \driver_pdf_object_new:nn {testobjB}{dict}
 \driver_pdf_object_ref:n {testobjA}
 \driver_pdf_object_ref:n {testobjB}
 \ExplSyntaxOff
+\end{Form}
 \end{document}
 \newpage
 





More information about the latex3-commits mailing list