\documentclass{article}
\usepackage[
    web={dvips,designv,forcolorpaper,nodirectory,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\u0020\u20AC.\u0020Story}
\labelName{myCoolIV}{\u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022}
\labelName{Reset myCoolIV}{Reset\u0020the\u0020\u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022\u0020field}


\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\u0020\u20AC.\u0020Story}
\end{verbatim}
The string can be a combination of characters from Basic Latin or
Latin-1 Supplement (latin1 option for AeB Pro required). 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\u0020\u20AC.\u0020Story! 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\u0020(Euro)}
\labelName{myYen}{\u00A5\u0020(Yen)}
\labelName{mySheqel}{\u20AA\u0020(Sheqel)}
\labelName{myPound}{\u00A3\u0020(Pound)}
\labelName{myFranc}{\u20A3\u0020(Franc)}
\end{verbatim}

\labelName{myEuro}{\u20AC\u0020(Euro)}
\labelName{myYen}{\u00A5\u0020(Yen)}
\labelName{mySheqel}{\u20AA\u0020(Sheqel)}
\labelName{myPound}{\u00A3\u0020(Pound)}
\labelName{myFranc}{\u20A3\u0020(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}
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{jj\_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}
