[latex3-commits] [git/LaTeX3-latex3-pdfresources] textfields: start to split l3pdffields (513371a)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat May 1 00:38:17 CEST 2021


Repository : https://github.com/latex3/pdfresources
On branch  : textfields
Link       : https://github.com/latex3/pdfresources/commit/513371abc98bdedb83696153431012e8c8a88ede

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

commit 513371abc98bdedb83696153431012e8c8a88ede
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat May 1 00:38:17 2021 +0200

    start to split l3pdffields


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

513371abc98bdedb83696153431012e8c8a88ede
 l3pdffield.dtx => l3pdffield-checkbox.dtx | 58 +++---------------------------
 l3pdffield.dtx                            | 59 +++++++++++++++++++++++++------
 pdfmanagement-testphase.ins               |  1 +
 resave.bat                                | 14 ++++++++
 4 files changed, 68 insertions(+), 64 deletions(-)

diff --git a/l3pdffield.dtx b/l3pdffield-checkbox.dtx
similarity index 93%
copy from l3pdffield.dtx
copy to l3pdffield-checkbox.dtx
index dc3fcc3..6e84df6 100644
--- a/l3pdffield.dtx
+++ b/l3pdffield-checkbox.dtx
@@ -55,7 +55,7 @@
 %  }
 % \ExplSyntaxOff
 % \title{^^A
-%   The \pkg{l3pdffield} module\\ Commands to create form fields   ^^A
+%   The \pkg{l3pdffield-checkbox} module\\ Commands to create checkbox form fields   ^^A
 %   \\ \LaTeX{} PDF management testphase bundle
 % }
 %
@@ -72,22 +72,9 @@
 %
 % \maketitle
 % \begin{documentation}
-% \section{\pkg{l3pdffield} Introduction}
-% The implementation of form fields in hyperref has some bugs, see for example
-% \url{https://github.com/latex3/hyperref/issues/94}. This package is a first step
-% towards the goal to review and improve the code of form fields.
-%
-% Like the \pkg{pdfmanagement-testphase} package itself it is a temporary package:
-% the definite home of the code is not yet decided.
-%
-% It handles for now \emph{only} checkboxes, other form fields like pushbutton,
-% radio buttons or text fields will follow later. As currently no fonts are used,
-% it doesn't relies on the hyperref code
-% to initialize the form, but it can be used with hyperref.
-%
-% The code requires the new PDF management. The code makes use of
-% \pkg{l3pdfxform} to create the Xobjects. This code doesn't support yet the
-% the dvips backend.
+% \section{\pkg{l3pdffield-checkbox} Introduction}
+% This is the documentation for checkbox fields, for general information about form fields
+% check the documentation l3pdffield.
 %
 %
 %
@@ -99,23 +86,7 @@
 % itself
 % \item Standards like pdf/A disable form fields too (as you typically can't change the PDF).
 % \end{itemize}
-%
-% If \pkg{hyperref} is loaded before
-% the package will suppress the deprecated |/NeedAppearances| setting. If \pkg{hyperref}
-% is loaded later you should do it in the \cs{Form} options.
-%
-% So a typical use together with hyperref could look like this
-%
-% \begin{verbatim}
-% \RequirePackage{pdfmanagement-testphase}
-% \DeclareDocumentMetadata{uncompress}
-% \documentclass{article}
-% \usepackage{hyperref}
-% \usepackage{l3pdffield-testphase}
-% \begin{document}
-% \Form
-% \end{verbatim}
-% \section{Step 1: Checkboxes}
+% \section{Checkboxes}
 % Click me:
 % \ExplSyntaxOn\pdffield_checkbox:n{name=bear,appearance=bear,width=23pt,height=30pt,depth=10pt}\ExplSyntaxOff
 %
@@ -131,25 +102,6 @@
 % is a quadratic frame with a \cs{texttimes} in it for the checked case.
 % \end{function}
 %
-%\begin{function}{\pdffield_setup:nn}
-% \begin{syntax}
-%  \cs{pdffield_setup:nn}\Arg{field type}\Arg{key val list}
-% \end{syntax}
-% This allows to setup up values for following fields. \Arg{field type}
-% should be a field, currently the only allowed value is |checkbox|.
-% \end{function}
-%
-%\begin{function}{\pdffield_store_appearance:nn}
-% \begin{syntax}
-%  \cs{pdffield_store_appearance:nn}\Arg{name/state}\Arg{content}
-% \end{syntax}
-% This is a small wrapper around \cs{pdfxform_new:nn} and store appearances for the fields.
-% \meta{state} should be for checkboxes either |Yes| or |Off| (and typically
-% you should define both). \meta{name} is the name
-% that is used in the |appearance| key, |checkbox/default| is predefined and so can't be used.
-% \meta{content} is arbitrary content. The dimensions should fit to the planed size of the
-% checkbox.%
-% \end{function}
 % \subsection{Keys}
 %
 % The new checkbox commands accepts following keys:
diff --git a/l3pdffield.dtx b/l3pdffield.dtx
index dc3fcc3..764722e 100644
--- a/l3pdffield.dtx
+++ b/l3pdffield.dtx
@@ -43,6 +43,11 @@
 %   idxtype = {checkbox key},
 %   printtype= \textit{checkbox key}
 %    ]{Checkboxkey}{checkboxkey}
+%  \NewDocElement[
+%   idxgroup=field keys,
+%   idxtype = {field key},
+%   printtype= \textit{field key}
+%    ]{fieldkey}{fieldkey}
 % \providecommand\hook[1]{\texttt{#1}}
 % \ExplSyntaxOn
 % \pdffield_store_appearance:nn {bear/Yes}
@@ -89,11 +94,9 @@
 % \pkg{l3pdfxform} to create the Xobjects. This code doesn't support yet the
 % the dvips backend.
 %
-%
-%
 % Please keep in mind
 % \begin{itemize}
-% \item Not every PDF viewer supports checkboxes.
+% \item Not every PDF viewer supports checkboxes or form fields.
 % \item The handling can depend on settings in the PDF viewer. In adobe reader for
 % example I had to disable an option to avoid that it tries to create an appearance
 % itself
@@ -115,17 +118,51 @@
 % \begin{document}
 % \Form
 % \end{verbatim}
-% \section{Step 1: Checkboxes}
-% Click me:
-% \ExplSyntaxOn\pdffield_checkbox:n{name=bear,appearance=bear,width=23pt,height=30pt,depth=10pt}\ExplSyntaxOff
 %
-% \bigskip
-% \subsection{Commands}
-% \begin{function}{\pdffield_checkbox:n}
+% \section{Some background}
+%
+% A document can contain arbitrary number of fields which can be organized as a tree.
+% The leaf fields in such a tree, the \emph{terminal fields} typically have a
+% widget annotation as kid which determines the look of the field. I will call such a
+% tree a \emph{fieldset}. The node are \emph{fields}, the last node the \emph{field
+% annotation}.
+%
+% A simple example would look like this
+% \begin{tikzpicture}[level 2/.style={level distance=7mm}]
+% \node[draw] {week}
+% child {node[draw] {mon}
+%         child {node[draw,dashed] {annot}}
+%       }
+% child {node[draw] {tue}
+%        child {node[draw,dashed] {annot}}
+%       }
+% child {node[draw] {wen}
+%         child {node[draw,dashed] {annot}}
+%       }
+% ;
+% \end{tikzpicture}
+%
+% In many cases a fieldset only consists of one field along with its field annotation
+% but larger sets can be needed to build more complex interactions with javascript code,
+% for example a datepicker can be built as a fieldset with various fields to represent
+% the month and year choice and to select days.
+%
+% All fields in a fieldset must have a (partial) name. The full name of the field
+% is than built from it along with the names of the parents. In the example above
+% the one field has the partial name \texttt{mon} and the full name \texttt{week.mon}.
+% Partial names shouldn't contain periods. If two fields have the same name they will
+% work in unison.
+%
+% All terminal fields should also have a type, e.g. \texttt{Btn} for a button field,
+% or \texttt{Tx} for a textfield. The type can be set for the parent and then inherited.
+% The fields in a fieldset can have different types.
+%
+% \section{Commands}
+% \begin{function}{\pdffield_field_new:nn}
 % \begin{syntax}
-%  \cs{pdffield_checkbox:n}\Arg{key val list}
+%  \cs{pdffield_field_new:nn}\Arg{key val list}\Arg{object name}
 % \end{syntax}
-% This creates a checkbox to check and uncheck. The list of allowed keys is described below.
+% This creates a new field objectcheckbox to check and uncheck. The list of allowed keys is described below.
 % Typically the \meta{key val list} should at least set the name. Checkboxes with the same
 % name belong to the same field and are checked and unchecked together. The default appearance
 % is a quadratic frame with a \cs{texttimes} in it for the checked case.
diff --git a/pdfmanagement-testphase.ins b/pdfmanagement-testphase.ins
index 87ac62f..847c624 100644
--- a/pdfmanagement-testphase.ins
+++ b/pdfmanagement-testphase.ins
@@ -128,6 +128,7 @@ and all files in that bundle must be distributed together.
     \file{l3pdffield-testphase.sty}
       {%
         \from{l3pdffield.dtx}{package}
+        \from{l3pdffield-checkbox.dtx}{package}
       }%
   }
 
diff --git a/resave.bat b/resave.bat
index e7ab889..5fe1dcb 100644
--- a/resave.bat
+++ b/resave.bat
@@ -3,3 +3,17 @@ rem l3build save -e\2 \1
 rem l3build save -cconfig-dvips \1
 rem l3build save -cconfig-luatex -e\2 \1
 rem l3build save -cconfig-noxetex -e\2 \1
+
+REM   Check failed with difference files
+REM     - ./build/test/checkbox.xetex.pdf.fc 
+REM     - ./build/test/disable-links.xetex.pdf.fc
+REM     - ./build/test/linkbordercolor.xetex.pdf.fc
+REM     - ./build/test/linkhook.xetex.pdf.fc
+REM     - ./build/test/linkmargin.xetex.pdf.fc
+REM     - ./build/test/ocgcolorlinks.xetex.pdf.fc
+REM     - ./build/test/pgfpatches.xetex.pdf.fc
+REM
+REM   Failed tests for configuration config-dvips:
+REM
+REM     Check failed with difference files
+REM     - ./build/test-config-dvips/ismap.latexdvips.pdf.fc





More information about the latex3-commits mailing list.