summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/aeb-pro/examples/aebpro_ex8.tex
blob: 3565c239220ffe6c42b18a1abd9c0fad5282a4ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
% Acrobat required
% use useacrobat option with pdftex and xetex if you have acrobat
\documentclass{article}
\usepackage[
    web={designv,forcolorpaper,pro,tight,usesf},
    eforms,
    linktoattachments,
    attachsource={tex},
    aebxmp,
]{aeb_pro}

\DeclareDocInfo
{
    university={Acro\negthinspace\TeX.Net},
    title={A Note on Entering Unicode into a Form Field},
    author={D. P. Story},
    email={dpstory@acrotex.net},
    subject={White Paper that discusses how to use AeB Pro to create form fields with unicode strings},
    talksite={\url{www.acrotex.net}},
    version={1.0},
    keywords={AeB, AcroForm, unicode, AcroTeX, AcroTeX.Net},
    copyrightStatus=True,
    copyrightNotice={Copyright (C) \the\year, D. P. Story},
    copyrightInfoURL={http://www.acrotex.net}
}
\nocopyright


\newcommand{\cs}[1]{\texttt{\char`\\#1}}
\newcommand{\cS}[2]{\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\uDV{FEFF#2}\uV{FEFF#2}\BC{}]{#1}{20bp}{11bp}}

\parskip6pt
\parindent0pt

\labelName{coolDPS}{Donald \u20AC. Story}
\labelName{myCoolIV}{\u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022}
\labelName{Reset myCoolIV}{Reset the \u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022 field}

\begin{document}

\makeinlinetitle
%\maketitle

\section{The Basics}

This document demonstrates how to use some of the new commands that
come with AeB Pro, and some of the new keys in the eforms package
that are designed to enter unicode hex encoding. In all cases, you must have
the font that contains the glyph represented by the unicode hex.

You need AeB Pro with the \texttt{linktoattachments} and the eforms package, see
preamble above.

The first step is to use the \cs{labelName} command to define your unicode string
and associate a label with it. In the preamble, the following definition can be found.
\begin{verbatim}
\labelName{coolDPS}{Donald \u20AC. Story}
\end{verbatim}
The string can be a combination of characters from Basic Latin. As
described in the AeB Pro manual, the string can be entered using
keyboard keystrokes, or unicode notation \cs{uXXXX}, as above.
Spaces are eaten up, so you must enter the unicode for a space
\cs{u0020}. The command \cs{labelName} creates a macro that contains
the pure encoding of the string. You can use \cs{aref} to access
this encoding.
The Unicode for the string \verb!Donald \u20AC. Story! is
\begin{quote}
\unicodeStr(coolDPS)
\end{quote}
The hex code is computed from a table of unicodes defined in AeB Pro, with allowances for enter
a ``raw unicode'' using a \cs{u} escape sequence.

Next, create an AcroForm field, a text field, in this example, and
use the command \cs{unicodeStr} to reference the label enclosed
in matching parentheses, like so
\begin{verbatim}
\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\W0
    \uDV{\unicodeStr(coolDPS)}\uV{\unicodeStr(coolDPS)}\BC{}
]{dps}{1in}{11bp}
\end{verbatim}
The result of the above code is

\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\W0
    \uDV{\unicodeStr(coolDPS)}\uV{\unicodeStr(coolDPS)}\BC{}
]{dps}{1in}{11bp}


The technique uses some of the code brought in by the the
\texttt{linktoattachments} option of AeB Pro, and a new command,
named \cs{unicodeStr}, designed to make it simple to enter unicode
encoded strings into a form field.

The above field is set to read only, the one below is not:

\textField[\textSize{10}\textFont{Arial}
    \uDV{\unicodeStr(myCoolIV)}\uV{\unicodeStr(myCoolIV)}
]{myCoolIV}{1.5in}{12bp}\pushButton[\textSize{10}\textFont{Arial}\uCA{FEFF20AC}
    \uAC{FEFF20AA}\uRC{FEFF00A5}\uTU{\unicodeStr(Reset myCoolIV)}\A{\JS{this.resetForm(["myCoolIV"])}}]{reset}{.5in}{12bp}

Edit the box above, then click on the reset button. (Notice the
tooltip for the reset button.)

The eforms uses an optional first argument to change the appearance
of a form field, add in action (usually JavaScript action) or to
initialize the field value. In the above form fields, several
unicode counterparts to the standard keys were used.
\begin{itemize}
    \item \cs{uV} and \cs{uDV} were used instead of \cs{V} and
    \cs{DV} for giving the field a value and a default value,
    respectively. The ``u'' versions are used when the string is in
    unicode.

    \item Button face text for the reset button was entered with
    \cs{uCA}, \cs{uAC} and \cs{uRC} rather than \cs{CA}, \cs{AC} and
    \cs{RC}. You can mix these two types together. The normal face
    caption could be defined by \cs{uCA} and the others defined by
    \cs{AC} and \cs{RC}.

    \item The ``tooltip'', as used in the reset button, normally uses
    the \cs{TU} key. When the string is meant to be unicode, use the
    \cs{uTU} key.
\end{itemize}

\section{More Advanced}

For combo boxes and list boxes, things are slightly more
complicated. In the example below, we define a combo box. First,
define the appearance values of the combo box (the string that is
seen listed in the combo box).
\begin{verbatim}
\labelName{myEuro}{\u20AC (Euro)}
\labelName{myYen}{\u00A5 (Yen)}
\labelName{mySheqel}{\u20AA (Sheqel)}
\labelName{myPound}{\u00A3 (Pound)}
\labelName{myFranc}{\u20A3 (Franc)}
\end{verbatim}

\labelName{myEuro}{\u20AC (Euro)}
\labelName{myYen}{\u00A5 (Yen)}
\labelName{mySheqel}{\u20AA (Sheqel)}
\labelName{myPound}{\u00A3 (Pound)}
\labelName{myFranc}{\u20A3 (Franc)}

Then we can define our combo box.  According to the PDF file format,
unicode strings should be enclosed in angle brackets
\verb!<XXXXXXXXXXXX>!. In initializing the combo box below, the
\cs{unicodeStr} command is used, but this time it is enclosed in
angle brackets. (That is all the ``u'' versions of the keys do above
is to automatically insert the angle brackets for you. Here we have
to do it ourselves. (I suppose one could have a helper command, but
you can handle it.)
\begin{verbatim}
\comboBox[\Ff\FfEdit\DV{1}\V{Euro}\textFont{Arial}
\BG{0.98 0.92 0.73}\BC{0 .6 0}]{myCombo}{1in}{11bp}
{*{[(Euro)<\unicodeStr(myEuro)>]%
    [(Yen)<\unicodeStr(myYen)>]%
    [(Sheqel)<\unicodeStr(mySheqel)>]%
    [(Pound)<\unicodeStr(myPound)>]%
    [(Franc)<\unicodeStr(myFranc)>]}
}
\end{verbatim}
where the \texttt{*} in the position shown above is a token that signals the
passing of a raw form of the value options of a combo or list box; it is
defined in \textsf{eforms}.

The result is
\comboBox[\Ff\FfEdit\DV{1}\V{Euro}\textFont{Arial}
\BG{0.98 0.92 0.73}\BC{0 .6 0}]{myCombo}{1in}{11bp}
{*{[(Euro)<\unicodeStr(myEuro)>]%
    [(Yen)<\unicodeStr(myYen)>]%
    [(Sheqel)<\unicodeStr(mySheqel)>]%
    [(Pound)<\unicodeStr(myPound)>]%
    [(Franc)<\unicodeStr(myFranc)>]}
}

Very swave!

\section{More Advanced Still}

You can also enter raw hex yourself (without using \cs{labelName}) if you have the patience to do
it, and  in some cases, it is the easiest.

For the purpose of the table below, the following definition was given in the preamble:

\begin{verbatim}
\newcommand{\cS}[2]{%
    \textField[
        \Ff\FfReadOnly\BC{}\textSize{10}\textFont{Arial}
        \uDV{FEFF#2}\uV{FEFF#2}
    ]{#1}{20bp}{11bp}}
\end{verbatim}
Again the \cs{uDV} and \cs{uV} keys are used but without
\cs{unicodeStr}. In this case, we must do it ourselves. As was
mentioned earlier, the ``u'' versions of these keys automatically
insert the angle brackets. Inside the angle brackets is the raw
unicode hex code. What wasn't mentioned before is that the first
four hex digits must be \texttt{FEFF} to signal the beginning of
unicode. Here, we insert these digits ourselves, followed, through
parameter replacement, by the unicode hex digits of the characters
desired. The result is the table you see below. (Again the field is
readonly, the table is the one that appears in manual of usage for the
JJ\_Game class (\texttt{jjg\_man.pdf}).

\begin{center}
\begin{tabular}{lll||lll}
Description     & Unicode   & Symbol &  Description     & Unicode  & Symbol \\\hline
Dollar Sign     & \cs{u0024}& \cS{Dollar}{0024} & Lira Sign    & \cs{u20A4} &\cS{Lira}{20A4}\\
Pound Sign      & \cs{u00A3}& \cS{Pound}{00A3} & Peseta Sign     & \cs{u20A7} &\cS{Pesta}{20A7}\\
Currency Sign   & \cs{u00A4}& \cS{Currency}{00A4} &  New Sheqel Sign & \cs{u20AA} &\cS{Sheqel}{20AA}\\
Yen Sign        & \cs{u00A5}& \cS{Yen}{00A5} & Dong Sign       & \cs{u20AB} & \cS{Dong}{20AB}\\
French Franc    & \cs{u20A3}& \cS{Franc}{20A3} & Euro Sign       & \cs{u20AC} &\cS{Euro}{20AC}\\
\end{tabular}
\end{center}

FYI: See \url{http://jrgraphix.net/research/unicode_blocks.php?block=0} for a display of unicode characters.


\end{document}