summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/forms16be
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-08-30 23:01:11 +0000
committerKarl Berry <karl@freefriends.org>2017-08-30 23:01:11 +0000
commit26fdf6e8d8d273185f664cfc3e4066b52a65797e (patch)
treecc77448f21d9e042dfcfedd593d2720095673d3d /Master/texmf-dist/source/latex/forms16be
parent96aac111c7824c49a05e48fdbb2a1eba6313d062 (diff)
forms16be (30aug17)
git-svn-id: svn://tug.org/texlive/trunk@45178 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/forms16be')
-rw-r--r--Master/texmf-dist/source/latex/forms16be/forms16be.dtx56
1 files changed, 44 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/forms16be/forms16be.dtx b/Master/texmf-dist/source/latex/forms16be/forms16be.dtx
index 0b7fc4c9280..99c3cc20ff3 100644
--- a/Master/texmf-dist/source/latex/forms16be/forms16be.dtx
+++ b/Master/texmf-dist/source/latex/forms16be/forms16be.dtx
@@ -15,7 +15,7 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{forms16be}
-%<package> [2017/08/11 v1.0 Provides UTF-16BE encoding for text strings (dps)]
+%<package> [2017/08/28 v1.2 Provides UTF-16BE encoding for text strings (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -75,11 +75,23 @@
% The code was originally designed to be used with the \pkg{eforms} package, but can be used with
% the form fields generated by \pkg{hyperref}, but requires some custom modification of the form field
% commands of \pkg{hyperref}.
+% \section{Code for the \textsf{forms16be} package}
+% We begin the definitions for this package with some utility commands, followed by some of
+% the main support command, then followed by the two major commands of this package \cs{unicodeStr}
+% and \cs{defUniStr}. The unicode lookup tables are listed last.
+% \subsection{Utility commands}
% \begin{macrocode}
\def\U@csarg#1#2{\expandafter#1\csname#2\endcsname}
-\let\U@Zero=0 \let\U@One=1
\providecommand\aeb@exiii{\expandafter\expandafter\expandafter}
% \end{macrocode}
+% Sanitize selected characters
+% \changes{v1.2}{2017/08/28}{Sanitize selected characters}
+% \begin{macrocode}
+\def\fbe@sanitize{\@makeother\"\@makeother\#\@makeother\$%
+ \@makeother\%\@makeother~%
+ \@for\x:=ABCDEFabcdef()\do{\@makeother\x}}
+% \end{macrocode}
+% \subsection{Main supporting commands}
% \begin{macro}{\convertChriiUnicode}\hskip-\marginparsep\darg{\ameta{char}}\darg{\ameta{unicode}}
% A simple command for mapping a character to its unicode. This command is used in the character-unicode tables
% below.
@@ -113,17 +125,34 @@
% processing.
% \begin{macrocode}
\providecommand{\@stringiiUnicode}[1]{\ifx#1\relax\else
- \ifx#1\u\aeb@exiii\getRawUnicode\else
+ \ifx#1\u\aeb@exiii\getRawUnicode@tp\else
\displayUnicode{#1}\aeb@exiii\@stringiiUnicode\fi\fi}
% \end{macrocode}
+% Allow parentheses around the value \cs{u}, this allows us to abut neighboring
+% characters without creating an unwanted space; eg., |\u(\BSLASH)LaTeX|. This is needed
+% in the case of when the hex digits are expanded from a command, such as \cs{EURO},
+% \cs{BSLASH}, \cs{LBRACE}, \cs{RBRACE}, and \cs{DQUOTE}.
+% The \DescribeMacro{\getRawUnicode@tp}\cs{getRawUnicode@tp} tests whether there is
+% a left parenthesis following \cs{u}.
+% \changes{v1.1}{2017/08/28}{Allow parentheses around the value of \string\cs{u}}
+% \begin{macrocode}
+\def\getRawUnicode@tp#1{\ifx#1(\aeb@exiii\getRawUnicode@p\else
+ \aeb@exiii\@getRawUnicode\fi#1}
+% \end{macrocode}
+% We come into \DescribeMacro{\getRawUnicode@p}\cs{getRawUnicode@p} if there is a left
+% parenthesis following \cs{u}. We extract the left and right parentheses and continue
+% on to \cs{@getRawUnicode}.
+% \begin{macrocode}
+\def\getRawUnicode@p(#1){\expandafter\@getRawUnicode#1}
+% \end{macrocode}
% When the \cs{u} is encountered by \cs{@stringiiUnicode} it is followed four hex digits
% or by macro (such as \cs{EURO}) that expands to four hex digits. \DescribeMacro{\getRawUnicode}\cs{getRawUnicode}
% grabs these four hex digits (adding them to the string built by \cs{@stringiiUnicode}). Flow continues
% to \cs{@stringiiUnicode}.
% \begin{macrocode}
-\providecommand{\getRawUnicode}{\expandafter\@getRawUnicode}
\providecommand{\@getRawUnicode}[4]{#1#2#3#4\@stringiiUnicode}
% \end{macrocode}
+% \subsection{The \texorpdfstring{\protect\cs{unicodeStr}}{\CMD{unicodeStr}} command}
%\leavevmode\DescribeMacro{\unicodeStr}\hskip-\marginparsep\texttt{(\ameta{name})}
% This command expands \ameta{name} to its big-endian character string. Its argument
% is delimited with \emph{parentheses}. Do not redefine this command as it is used by
@@ -138,6 +167,7 @@
% \begin{macrocode}
FEFF#1\else\aeb@exiii\stringiiUnicode\aref(#1)\relax\fi}
% \end{macrocode}
+% \subsection{The \texorpdfstring{\protect\cs{defUniStr}}{\CMD{defUniStr}} command}
% \leavevmode\DescribeMacro{\defUniStr}\hskip-\marginparsep\darg{\ameta{name}}\darg{\ameta{string}}
% The \cs{defUniStr} command is used to define a unicode string. The \ameta{name} should be an
% ASCII character string (used to retrieve the \ameta{string} later); \ameta{string} is a combination
@@ -145,18 +175,20 @@
% with the \opt{linktoattachments} option, \cs{labelName} expanded outside the
% \env{attachmentNames} environment expands \cs{defUniStr}, this is so to support legacy document that
% use \cs{labelName} for the purpose of initializing form fields with unicode.
+% \changes{v1.2}{2017/08/28}{Added parentheses to the \string\@for\space loop}
% \begin{macrocode}
-\def\defUniStr#1{\bgroup\@for\x:=ABCDEFabcdef\do{\@makeother\x}%
- \def\U@uniStrName{#1}\@ifnextchar\bgroup{\defUniStr@i}{}}
-\def\defUniStr@i{\obeyspaces\getUniDescript}%
-\def\U@NameUniStr{\global\U@csarg\let
- {aeb@aDescript@\U@uniStrName}\U@description\egroup}
+%\@for\x:=ABCDEFabcdef()\do{\@makeother\x}
+\def\defUniStr#1{\def\U@uniStrName{#1}\bgroup\fbe@sanitize
+ \obeyspaces\getUniDescript}
{\obeyspaces\gdef\getUniDescript#1{\gdef\U@description{#1}%
\U@NameUniStr}}
-% \end{macrocode}
-% \begin{macrocode}
+\def\U@NameUniStr{\global\U@csarg\let
+ {aeb@aDescript@\U@uniStrName}\U@description\egroup}
%</package>
%<*encoding>
+% \end{macrocode}
+% \subsection{Unicode for Basic Latin definitions}
+% \begin{macrocode}
\convertChriiUnicode\space{0020}
\convertChriiUnicode{!}{0021}
{\@makeother\"
@@ -261,7 +293,7 @@
%</encoding>
%<*package>
\InputIfFileExists{uni4basic-latin.def}{\PackageInfo{forms16be}
- {inputting uni4basic-latin.def\MessageBreak definitions}}
+ {Inputting uni4basic-latin.def\MessageBreak definitions}}
{\PackageError{forms16be}
{Cannot find the file uni4basic-latin.def}{}}
%</package>