| 1 |
\documentclass[fleqn]{article} |
| 2 |
\usepackage[T1]{fontenc} |
| 3 |
|
| 4 |
\newcommand{\OMEGA}{$\Omega$} |
| 5 |
\newcommand{\LAMBDA}{$\Lambda$} |
| 6 |
\newcommand{\OTP}{\OMEGA TP} |
| 7 |
\newcommand{\OCP}{\OMEGA CP} |
| 8 |
\newcommand{\mymathtt}[1]{\mbox{\texttt{#1}}} |
| 9 |
\newcommand{\mymathit}[1]{\mbox{\emph{#1}}} |
| 10 |
\newcommand{\myit}[1]{\mbox{\emph{#1}}} |
| 11 |
\newcommand{\OFM}{\OMEGA FM} |
| 12 |
\newcommand{\TFM}{TFM} |
| 13 |
\newcommand{\PL}{PL} |
| 14 |
\newcommand{\VF}{VF} |
| 15 |
\newcommand{\VP}{VP} |
| 16 |
\newcommand{\OPL}{\OMEGA PL} |
| 17 |
\newcommand{\OVF}{\OMEGA VF} |
| 18 |
\newcommand{\OVP}{\OMEGA VP} |
| 19 |
\newcommand{\bits}[1]{\langle\mbox{\emph{#1-bit number}}\rangle} |
| 20 |
\newcommand{\showfile}{\langle\mbox{\emph{file}}\rangle} |
| 21 |
\newcommand{\showmode}{\langle\mbox{\emph{mode}}\rangle} |
| 22 |
\newcommand{\showdir}{\langle\mbox{\emph{direction}}\rangle} |
| 23 |
\newcommand{\showcs}{\langle\mbox{\emph{control-sequence}}\rangle} |
| 24 |
\newcommand{\showtext}{\langle\mbox{\emph{typeset-material}}\rangle} |
| 25 |
\newcommand{\showpenalty}{\langle\mbox{\emph{penalty}}\rangle} |
| 26 |
\newcommand{\showtno}{\langle\mbox{\emph{table-no}}\rangle} |
| 27 |
\newcommand{\showeno}{\langle\mbox{\emph{entry-no}}\rangle} |
| 28 |
\newcommand{\showtable}{\langle\mbox{\emph{table-definition}}\rangle} |
| 29 |
\newcommand{\showrule}{\langle\mbox{\emph{rule-definition}}\rangle} |
| 30 |
\newcommand{\showglue}{\langle\mbox{\emph{glue-definition}}\rangle} |
| 31 |
\newcommand{\showivalue}{\langle\mbox{\emph{ivalue-definition}}\rangle} |
| 32 |
\newcommand{\showfvalue}{\langle\mbox{\emph{fvalue-definition}}\rangle} |
| 33 |
\newcommand{\showmvalue}{\langle\mbox{\emph{mvalue-definition}}\rangle} |
| 34 |
\newcommand{\showpenaltydef}{\langle\mbox{\emph{penalty-definition}}\rangle} |
| 35 |
\newcommand{\showinteger}{\langle\mbox{\emph{integer}}\rangle} |
| 36 |
\newcommand{\showfixword}{\langle\mbox{\emph{real}}\rangle} |
| 37 |
\newcommand{\showorder}{\langle\mbox{\emph{order}}\rangle} |
| 38 |
\newcommand{\showkind}{\langle\mbox{\emph{kind}}\rangle} |
| 39 |
\newcommand{\showchardefn}{\langle\mbox{\emph{character-definition}}\rangle} |
| 40 |
\newcommand{\showligocp}{\langle\mbox{\emph{ocp-file-name}}\rangle} |
| 41 |
|
| 42 |
\begin{document} |
| 43 |
\title{Draft documentation for the \OMEGA\ system} |
| 44 |
\author{John Plaice\thanks{School of Computer Science |
| 45 |
and Engineering, University of New South Wales, |
| 46 |
Sydney 2052, Australia. \texttt{[email protected]}} |
| 47 |
\and Yannis Haralambous\thanks{Atelier Fluxus Virus, |
| 48 |
187,~rue Nationale, F-59800 Lille, France. |
| 49 |
\texttt{[email protected]}}} |
| 50 |
\date{March 1999} |
| 51 |
\maketitle |
| 52 |
|
| 53 |
\section{Introduction} |
| 54 |
The \OMEGA\ (Omega) typesetting system, an extension of Donald Knuth's \TeX, |
| 55 |
is designed for the typesetting of all the world's languages. It |
| 56 |
normally uses the Unicode character encoding standard |
| 57 |
as internal representation, although it can |
| 58 |
accept any other character set for input or output. Since it allows |
| 59 |
one to dynamically define finite state automata to translate from |
| 60 |
one encoding to another, it is possible to define complex contextual |
| 61 |
analysis for ligature choice, character cluster building or diacritic |
| 62 |
placement, as required for scripts such as Arabic, Devanagari, |
| 63 |
Hebrew or Khmer. It also allows any number of transliterations, |
| 64 |
allowing anyone to type texts for any script, using any other script. |
| 65 |
\OMEGA\ currently supports multidirectional writing, therefore |
| 66 |
allowing typesetting of Hebrew, Arabic, Chinese, Japanese, Mongolian |
| 67 |
and many other scripts. |
| 68 |
|
| 69 |
A Unicode-based font is also being designed for the alphabetic |
| 70 |
scripts. This font is made up of four subfonts: (1)~Latin, Greek, |
| 71 |
Cyrillic, Armenian, Georgian, punctuation; (2)~Hebrew, Arabic, Syriac; |
| 72 |
(3)~Dingbats and non-letterlike symbols; (4)~Indic and South-East |
| 73 |
Asian scripts. This font consists of all the glyphs required to |
| 74 |
properly typeset each of the scripts, which means much more than |
| 75 |
designing one glyph for each Unicode position. |
| 76 |
|
| 77 |
This document is the draft documentation for the \OMEGA\ typesetting |
| 78 |
system, designed and developed by the authors. This draft document |
| 79 |
accompanies the 1.8~release of~\OMEGA, which is available~at: |
| 80 |
\begin{verbatim} |
| 81 |
ftp://ftp.cse.unsw.edu.au/users/plaice/Omega |
| 82 |
\end{verbatim} |
| 83 |
or at any of the CTAN sites. |
| 84 |
|
| 85 |
This documentation should be considered cursory. |
| 86 |
In particular, it only describes the drivers that |
| 87 |
have been developed for typesetting and viewing, |
| 88 |
and only presents the tools that are |
| 89 |
based on \texttt{web2c}. |
| 90 |
|
| 91 |
For more information, see our Web page, currently~at: |
| 92 |
\begin{verbatim} |
| 93 |
http://www.ens.fr/omega |
| 94 |
\end{verbatim} |
| 95 |
|
| 96 |
\section{Implementation} |
| 97 |
|
| 98 |
The canonical \OMEGA\ implementation is based on the standard |
| 99 |
\texttt{web2c} \TeX\ distribution. Currently, \OMEGA\ is based |
| 100 |
on \texttt{web2c-7.3}. This means that the following standard |
| 101 |
distributions automatically include~\OMEGA: |
| 102 |
\begin{itemize} |
| 103 |
\item |
| 104 |
Thomas Esser's Te\TeX\ (Unix).\\ |
| 105 |
Look up \verb|http://www.tug.org/tetex/|\\ |
| 106 |
or \verb|mailto:[email protected]|~. |
| 107 |
\item |
| 108 |
Fabrice Popineau's \TeX Win32 (Windows95/NT).\\ |
| 109 |
Look up \verb|ftp://ftp.ese-metz.fr/pub/TeX/win32|\\ |
| 110 |
or \verb|mailto:[email protected]|~. |
| 111 |
\item |
| 112 |
Sebastian Rahtz's \TeX Live (CD-ROM).\\ |
| 113 |
Look up \verb|http://www.tug.org/texlive.html|\\ |
| 114 |
or \verb|mailto:[email protected]|~. |
| 115 |
\end{itemize} |
| 116 |
|
| 117 |
In addition, there are currently two other prepackaged |
| 118 |
\TeX\ environments that support~\OMEGA: |
| 119 |
\begin{itemize} |
| 120 |
\item |
| 121 |
Tom Kiffe's CMac\OMEGA\ (MacIntosh).\\ |
| 122 |
Look up \verb|http://www.kiffe.com/cmacomega.html|\\ |
| 123 |
or \verb|mailto:[email protected]|~. |
| 124 |
\item |
| 125 |
Christian Schenk's MiK\TeX\ (Windows95/NT).\\ |
| 126 |
Look up \verb|http://www.inx.de/~cschenk/miktex|\\ |
| 127 |
or \verb|mailto:[email protected]|~. |
| 128 |
\end{itemize} |
| 129 |
|
| 130 |
The three files distributed with the \OMEGA\ implementation are |
| 131 |
\begin{verbatim} |
| 132 |
web2c-7.3-omega-1.8.tar.gz |
| 133 |
omegalib-1.8.tar.gz |
| 134 |
omegadoc-1.8.tar.gz |
| 135 |
\end{verbatim} |
| 136 |
To install \OMEGA, you will require the standard \TeX\ distribution |
| 137 |
as well. These files include |
| 138 |
\begin{verbatim} |
| 139 |
web-7.3.tar.gz |
| 140 |
web2c-7.3.tar.gz |
| 141 |
\end{verbatim} |
| 142 |
as well as a standard \texttt{texmf} tree. |
| 143 |
In addition to these files, the following drivers are needed: |
| 144 |
\begin{verbatim} |
| 145 |
dvipsk.tar.gz |
| 146 |
odvipsk.tar.gz |
| 147 |
gsftopk.tar.gz |
| 148 |
xdvik.tar.gz |
| 149 |
oxdvik.tar.gz |
| 150 |
libwww.tar.gz |
| 151 |
\end{verbatim} |
| 152 |
These files are all made available in the above \texttt{ftp} sites. |
| 153 |
|
| 154 |
The installation procedure is described below. Assume that |
| 155 |
\begin{itemize} |
| 156 |
\item \verb|/usr/local/ftp| contains your downloaded files; |
| 157 |
\item \verb|/usr/local/src| is where you place source files; and |
| 158 |
\item \verb|/usr/local/share| is where the \texttt{texmf} tree is |
| 159 |
to be placed; |
| 160 |
\end{itemize} |
| 161 |
\begin{verbatim} |
| 162 |
FTP=/usr/local/ftp |
| 163 |
SHARE=/usr/local/share |
| 164 |
SRC=/usr/local/src |
| 165 |
cd $SHARE |
| 166 |
tar xzf $FTP/texmflib.tar.gz |
| 167 |
tar xzf $FTP/omegalib-1.8.tar.gz |
| 168 |
cd $SRC |
| 169 |
tar xzf $FTP/web-7.3.tar.gz |
| 170 |
tar xzf $FTP/web2c-7.3.tar.gz |
| 171 |
tar xzf $FTP/web2c-7.3-omega-1.8.tar.gz |
| 172 |
cd web2c-7.3 |
| 173 |
tar xzf $FTP/dvipsk.tar.gz |
| 174 |
tar xzf $FTP/odvipsk.tar.gz |
| 175 |
tar xzf $FTP/gsftopk.tar.gz |
| 176 |
tar xzf $FTP/xdvik.tar.gz |
| 177 |
tar xzf $FTP/oxdvik.tar.gz |
| 178 |
tar xzf $FTP/libwww.tar.gz |
| 179 |
configure |
| 180 |
make |
| 181 |
\end{verbatim} |
| 182 |
You will have to choose whether your call to \texttt{configure} |
| 183 |
needs any arguments. Note that the files may not look exactly |
| 184 |
like this, but you should be able to figure out what is happening. |
| 185 |
|
| 186 |
\section{What does \OMEGA\ offer?} |
| 187 |
|
| 188 |
The \OMEGA\ system is a derivative of Donald Knuth's \TeX. As such, |
| 189 |
all of the \TeX\ file types can be used by \OMEGA\ as well. In |
| 190 |
addition there are six new file types. They are: |
| 191 |
\vspace*{.2cm} |
| 192 |
|
| 193 |
\begin{tabular}{lll} |
| 194 |
Suffix & Replaces & Description\\ |
| 195 |
\hline |
| 196 |
\texttt{.opl} & \texttt{.pl} & Font property list (text)\\ |
| 197 |
\texttt{.ofm} & \texttt{.tfm} & Font metric (binary)\\ |
| 198 |
\texttt{.ovp} & \texttt{.vpl} & Virtual property list (text)\\ |
| 199 |
\texttt{.ovf} & \texttt{.vf} & Virtual font (binary)\\ |
| 200 |
\texttt{.otp} & ------ & \OMEGA\ Translation Process (text)\\ |
| 201 |
\texttt{.ocp} & ------ & \OMEGA\ Compiled Process (binary)\\ |
| 202 |
\end{tabular} |
| 203 |
\vspace*{.2cm} |
| 204 |
|
| 205 |
\noindent These different file types are described in future sections. |
| 206 |
|
| 207 |
\noindent |
| 208 |
The \OMEGA\ distribution contains several binaries, described below: |
| 209 |
\vspace*{.2cm} |
| 210 |
|
| 211 |
\begin{tabular}{lll} |
| 212 |
Binary & Replaces & Description\\ |
| 213 |
\hline |
| 214 |
\texttt{omega} (\OMEGA) & \TeX & Typesetting engine |
| 215 |
($\texttt{.tex} \rightarrow \texttt{.dvi}$) \\ |
| 216 |
\texttt{lambda} (\LAMBDA) & \LaTeX & For structured documents |
| 217 |
($\texttt{.tex} \rightarrow \texttt{.dvi}$) \\ |
| 218 |
\texttt{odvips} & \texttt{dvips} & PostScript driver |
| 219 |
($\texttt{.dvi} \rightarrow \texttt{.ps}$) \\ |
| 220 |
\texttt{oxdvi} & \texttt{xdvi} & Screen previewer for \texttt{.dvi} |
| 221 |
($\texttt{.dvi} \rightarrow \textrm{screen}$) \\ |
| 222 |
\texttt{odvicopy} & \texttt{dvicopy} & De-virtualizes \texttt{.dvi} |
| 223 |
($\texttt{.dvi} \rightarrow \texttt{.dvi}$) \\ |
| 224 |
\texttt{odvitype} & \texttt{dvitype} & Debugging for \texttt{.dvi} |
| 225 |
($\texttt{.dvi} \rightarrow \textrm{text}$) \\ |
| 226 |
\texttt{opl2ofm} & \texttt{pltotf} & Build font metric |
| 227 |
($\texttt{.opl} \rightarrow \texttt{.ofm}$) \\ |
| 228 |
\texttt{ofm2opl} & \texttt{tftopl} & Debugging for \texttt{.ofm} |
| 229 |
($\texttt{.ofm} \rightarrow \texttt{.opl}$) \\ |
| 230 |
\texttt{ovp2ovf} & \texttt{vptovf} & Build virtual font |
| 231 |
($\texttt{.ovp} \rightarrow \texttt{.ofm}\times\texttt{.ovf}$) \\ |
| 232 |
\texttt{ovf2ovp} & \texttt{vftovp} & Debugging for \texttt{.ovf} |
| 233 |
($\texttt{.ofm}\times\texttt{.ovf} \rightarrow \texttt{.ovp}$) \\ |
| 234 |
\texttt{otp2ocp} & ------ & Compile \OTP{} |
| 235 |
($\texttt{.otp} \rightarrow \texttt{.ocp}$) \\ |
| 236 |
\texttt{outocp} & ------ & Debugging for \texttt{.ocp} |
| 237 |
($\texttt{.ocp} \rightarrow \textrm{text}$)\\ |
| 238 |
\texttt{mkofm} & \texttt{mktextfm} & Generate \texttt{.ofm} file if needed\\ |
| 239 |
\texttt{mkocp} & ------ & Generate \texttt{.ocp} file if needed\\ |
| 240 |
\end{tabular} |
| 241 |
|
| 242 |
\section{Sixteen-bit fonts, registers, etc.} |
| 243 |
|
| 244 |
One of the fundamental limitations of \TeX3 is that most quantities can |
| 245 |
only range between 0~and~255. Fonts are limited to~256 characters each, |
| 246 |
only 256 fonts are allowed simultaneously, only 256 of any given kind of |
| 247 |
can be used simultaneously, etc. \OMEGA\ loosens these restrictions, |
| 248 |
allowing 65~536 (0--65~535) of each of these entities. |
| 249 |
|
| 250 |
\subsection{Characters} |
| 251 |
|
| 252 |
Each font can allow up to 65~536 characters, ranging between |
| 253 |
0~and~65~535. Unless other means are provided, using \OMEGA\ |
| 254 |
Translation Processes (see section~\ref{lab:otps}), the input |
| 255 |
and output mechanisms for characters between 256 (hex~100) |
| 256 |
and 65~535 (hex~ffff) use four circumflexes. For example, |
| 257 |
\verb|^^^^cab0| means hex value \verb|cab0| and \verb|^^^^0020| |
| 258 |
is the space character. |
| 259 |
|
| 260 |
\subsection{Fonts} |
| 261 |
|
| 262 |
Up to 65~536 fonts may be used. This is handled automatically, |
| 263 |
and space is allocated as needed. |
| 264 |
|
| 265 |
\subsection{Registers} |
| 266 |
|
| 267 |
Up to 65~536 registers of each kind may be used. The only case to |
| 268 |
be noted is that \verb|\box255| remains the box used by the output |
| 269 |
routine. |
| 270 |
|
| 271 |
\subsection{Math codes} |
| 272 |
|
| 273 |
\TeX\ allows the use of 16 ($2^4$) font families, each font |
| 274 |
of 256 ($2^8$) characters. |
| 275 |
To access the characters in the math fonts, and to define how |
| 276 |
they are to be used, there are several basic primitives: |
| 277 |
|
| 278 |
\begin{itemize} |
| 279 |
\item \verb|\mathcode| $\bits{8}=\bits{15}$:\\ |
| 280 |
Defines 15-bit math code for character; |
| 281 |
\item \verb|\mathcode| $\bits{8}$:\\ |
| 282 |
Outputs 15-bit math code associated with character; |
| 283 |
\item \verb|\mathchar| $\bits{15}$:\\ |
| 284 |
Generates a math character with 15-bit math code; |
| 285 |
\item \verb|\mathaccent| $\bits{15}$:\\ |
| 286 |
Generates a math accent with 15-bit math code; |
| 287 |
\item \verb|\mathchardef| $\showcs=\bits{15}$:\\ |
| 288 |
Defines a control sequence with a 15-bit math code; |
| 289 |
\item \verb|\delcode| $\bits{8}=\bits{27}$:\\ |
| 290 |
Defines 27-bit delimiter code for character; |
| 291 |
\item \verb|\delcode| $\bits{8}$:\\ |
| 292 |
Outputs 27-bit delimiter code associated with character; |
| 293 |
\item \verb|\delimiter| $\bits{27}$:\\ |
| 294 |
Generates a math delimiter with 27-bit delimiter code; |
| 295 |
\item \verb|\radical| $\bits{27}$:\\ |
| 296 |
Generates a math radical with 27-bit delimiter code; |
| 297 |
\end{itemize} |
| 298 |
where |
| 299 |
\begin{itemize} |
| 300 |
\item $\bits{8}$ refers to an 8-bit character; |
| 301 |
\item $\bits{15}$ refers to value \texttt{0x8000} or a triple |
| 302 |
\begin{itemize} |
| 303 |
\item 3 bits for math category, |
| 304 |
\item 4 bits for font family, |
| 305 |
\item 8 bits for character in font, |
| 306 |
\end{itemize} |
| 307 |
called a \emph{math code}; |
| 308 |
\item $\bits{27}$ refers to a negative number or a quintuple |
| 309 |
\begin{itemize} |
| 310 |
\item 3 bits for math category, |
| 311 |
\item 4 bits for first font family, |
| 312 |
\item 8 bits for first character in font, |
| 313 |
\item 4 bits for second font family, |
| 314 |
\item 8 bits for second character in font, |
| 315 |
\end{itemize} |
| 316 |
called a \emph{delimiter code}. |
| 317 |
\end{itemize} |
| 318 |
|
| 319 |
\OMEGA, on the other hand, allows 256 ($2^8$) |
| 320 |
font families, each font of 65~536 ($2^{16}$) characters. |
| 321 |
So, in addition to the \TeX\ math font primitives, which continue to work, |
| 322 |
there are 16-bit versions: |
| 323 |
|
| 324 |
\begin{itemize} |
| 325 |
\item \verb|\omathcode| $\bits{16}=\bits{27}$:\\ |
| 326 |
Defines 27-bit math code for character; |
| 327 |
\item \verb|\omathcode| $\bits{16}$:\\ |
| 328 |
Outputs 27-bit math code associated with character; |
| 329 |
\item \verb|\omathchar| $\bits{27}$:\\ |
| 330 |
Generates a math character with 27-bit math code; |
| 331 |
\item \verb|\omathaccent| $\bits{27}$:\\ |
| 332 |
Generates a math accent with 27-bit math code; |
| 333 |
\item \verb|\omathchardef| $\showcs=\bits{27}$:\\ |
| 334 |
Defines a control sequence with a 27-bit math code; |
| 335 |
\item \verb|\odelcode| $\bits{16}=\bits{51}$:\\ |
| 336 |
Defines 51-bit delimiter code for character; |
| 337 |
\item \verb|\odelcode| $\bits{16}$:\\ |
| 338 |
Outputs 51-bit delimiter code associated with character; |
| 339 |
\item \verb|\odelimiter| $\bits{51}$:\\ |
| 340 |
Generates a math delimiter with 51-bit delimiter code; |
| 341 |
\item \verb|\oradical| $\bits{51}$:\\ |
| 342 |
Generates a math radical with 51-bit delimiter code; |
| 343 |
\end{itemize} |
| 344 |
where |
| 345 |
\begin{itemize} |
| 346 |
\item $\bits{16}$ refers to a 16-bit character; |
| 347 |
\item $\bits{27}$ refers to value \texttt{0x8000000} or a triple |
| 348 |
\begin{itemize} |
| 349 |
\item 3 bits for math category, |
| 350 |
\item 8 bits for font family, |
| 351 |
\item 16 bits for character in font, |
| 352 |
\end{itemize} |
| 353 |
called a \emph{math code}; |
| 354 |
\item $\bits{51}$ refers to a pair of numbers, either both negative |
| 355 |
or arranged as $\bits{27}\;\bits{24}$, with the first number being: |
| 356 |
\begin{itemize} |
| 357 |
\item 3 bits for math category, |
| 358 |
\item 8 bits for first font family, |
| 359 |
\item 16 bits for first character in font, |
| 360 |
\end{itemize} |
| 361 |
and the second number being: |
| 362 |
\begin{itemize} |
| 363 |
\item 8 bits for second font family, |
| 364 |
\item 16 bits for second character in font, |
| 365 |
\end{itemize} |
| 366 |
called a \emph{delimiter code}. |
| 367 |
\end{itemize} |
| 368 |
|
| 369 |
Since \OMEGA\ is upwardly compatible with \TeX, the older primitives |
| 370 |
still continue to function as expected. Internally, math codes are |
| 371 |
27-bit numbers and delimiter codes are 51-bit numbers. However, |
| 372 |
if \verb|\mathcode|$\bits{15}$ appears in text mode, it |
| 373 |
continues to generate a 15-bit number, to remain upwardly compatible |
| 374 |
with \TeX: Donald Knuth defines several numerical constants through |
| 375 |
\verb|\mathcode|. |
| 376 |
|
| 377 |
\section{New typesetting routines} |
| 378 |
|
| 379 |
Most of the development in \OMEGA\ has dealt with different means |
| 380 |
for manipulating character streams. Nevertheless, there are new |
| 381 |
typesetting routines. |
| 382 |
|
| 383 |
\subsection{New infinity level} |
| 384 |
|
| 385 |
A new infinity level \texttt{fi} has been added. It is smaller than |
| 386 |
\texttt{fil} but bigger than any finite quantity. Its original intention |
| 387 |
was for inter-letter stretching: either \emph{filling-in-the-black}, |
| 388 |
as is done for calligraphic scripts such as Arabic; or for emphasis, |
| 389 |
as in Russian; all this without having to rewrite existing macro packages. |
| 390 |
There is therefore a new keyword, \texttt{fi}, and two new primitives, |
| 391 |
\verb|\hfi| and~\verb|\vfi|. |
| 392 |
|
| 393 |
\subsection{Local paragraph parametrization} |
| 394 |
|
| 395 |
The \OMEGA\ system allows the finetuning of layout, using |
| 396 |
\emph{local} paragraph primitives. The first two, |
| 397 |
\verb|\localinterlinepenalty| and \verb|\localbrokenpenalty|, are |
| 398 |
generalizations of \verb|\interlinepenalty| and \verb|\brokenpenalty|. |
| 399 |
|
| 400 |
When, say, \verb|\localinterlinepenalty=200| appears, a \emph{whatsit} node |
| 401 |
is deposited into the token list for the current paragraph. If the |
| 402 |
value is changed again, another whatsit node is deposited. When |
| 403 |
\OMEGA\ cuts the paragraph into lines, it will add the current value |
| 404 |
of the local penalty to the penalty node that is placed after every line |
| 405 |
in the vertical list. Similarly for \verb|\localbrokenpenalty| when a |
| 406 |
discretionary hyphen is placed at the end of a line. With these primitives, |
| 407 |
it becomes possible to discourage or encourage page breaks at more |
| 408 |
specific parts of a paragraph. |
| 409 |
|
| 410 |
This same local approach is taken for a completely different task: placing |
| 411 |
fixed-width typeset material at the beginning (or the end) of every |
| 412 |
line in a paragraph. |
| 413 |
|
| 414 |
{<<~\localleftbox{<<~}The original problem to be solved |
| 415 |
was for fine French typesetting, in which guillemets |
| 416 |
are placed running down the left side of a paragraph, |
| 417 |
as in this paragraph, so long as material is being |
| 418 |
quoted.~>>} Since \TeX\ breaks paragraphs in arbitrary |
| 419 |
places, it was impossible to develop a robust macro |
| 420 |
package that could, in a single pass, place the |
| 421 |
guillemets in the right positions. |
| 422 |
|
| 423 |
The original text for the previous paragraph was: |
| 424 |
\begin{verbatim} |
| 425 |
{<<~\localleftbox{<<~}The original problem to be solved |
| 426 |
was for fine French typesetting, in which guillemets |
| 427 |
are placed running down the left side of a paragraph, |
| 428 |
as in this paragraph, so long as material is being |
| 429 |
quoted.~>>} Since \TeX\ breaks paragraphs in arbitrary |
| 430 |
places, it was impossible to develop a robust macro |
| 431 |
package that could, in a single pass, place the |
| 432 |
guillemets in the right positions. |
| 433 |
\end{verbatim} |
| 434 |
There are currently four local primitives: |
| 435 |
\begin{itemize} |
| 436 |
\item \verb|\localleftbox{|$\showtext$\verb|}|:\\ |
| 437 |
Until this primitive is redefined, then the typeset material |
| 438 |
will be placed at the beginning of every line that follows |
| 439 |
the occurrence of this primitive in the text. |
| 440 |
\item \verb|\localrightbox{|$\showtext$\verb|}|:\\ |
| 441 |
Until this primitive is redefined, then the typeset material |
| 442 |
will be placed at the end of every line that follows |
| 443 |
the occurrence of this primitive in the text. |
| 444 |
\item \verb|\localinterlinepenalty|$\;=\showpenalty$:\\ |
| 445 |
Until this primitive is redefined, then the given penalty |
| 446 |
value will be added to the penalty node placed between |
| 447 |
successive lines in a paragraph. |
| 448 |
\item \verb|\localbrokenpenalty|$\;=\showpenalty$:\\ |
| 449 |
Until this primitive is redefined, then each time that a |
| 450 |
line ends with a discretionary node, then the given penalty |
| 451 |
value will be added to the penalty node following that line. |
| 452 |
\end{itemize} |
| 453 |
Grouping is respected by all of the local paragraph primitives. |
| 454 |
|
| 455 |
\section{Multiple directions} |
| 456 |
|
| 457 |
Below is what is available in the experimental versions of~\OMEGA. |
| 458 |
Unfortunately we did not consider it to be sufficiently stable |
| 459 |
for it to be released generally. Therefore, \OMEGA\ continues |
| 460 |
to support the bidirectionality functions of \verb|TeX--XeT|. |
| 461 |
In addition, with the \verb|\pagedirHR| and \verb|\pagedirHL|, |
| 462 |
primitives, it is possible to transform the entire page into |
| 463 |
a right-to-left page or a left-to-right page. Similarly, |
| 464 |
\verb|\pardirHR| and \verb|\pardirHL| allow the paragraph |
| 465 |
direction to change. The page direction changes should occur |
| 466 |
in empty pages, and the paragraph direction changes should |
| 467 |
occur outside of horizontal mode. To ensure that tables |
| 468 |
are used properly, there is a primitive \verb|nextfakemath|, |
| 469 |
which, put in front of math mode, ignores that the mathematics |
| 470 |
is supposed to be typeset from left-to-right. This is used |
| 471 |
in~\LAMBDA, which goes into math mode to do \verb|tabular| |
| 472 |
environments. |
| 473 |
|
| 474 |
\bigskip |
| 475 |
|
| 476 |
{\em |
| 477 |
Since \TeX\ was originally designed for English, it only supports |
| 478 |
left-to-right typesetting. This situation was improved somewhat |
| 479 |
with Knuth and MacKay's \verb|TeX-XeT|, modified into Breitenlohner's |
| 480 |
\verb|TeX--XeT|. However, these modifications to \TeX\ only |
| 481 |
allow the use of right-to-left typesetting, and even then, only |
| 482 |
within a particular paragraph. In other words, these systems do |
| 483 |
not support the typesetting of a full text in the different writing |
| 484 |
directions. |
| 485 |
|
| 486 |
The \OMEGA\ system distinguishes sixteen different directions, |
| 487 |
which are designated by three parameters: |
| 488 |
\begin{enumerate} |
| 489 |
\item The \emph{beginning of the page} is one of \texttt{T}~(top), |
| 490 |
\texttt{L}~(left), \texttt{R}~(right) or~\texttt{B}~(bottom). |
| 491 |
For English and Arabic, the beginning of the page is~\texttt{T}; |
| 492 |
for Japanese it is~\texttt{R}; for Mongolian it is~\texttt{L}. |
| 493 |
\item The \emph{beginning of the line} defines where each line begins. |
| 494 |
For English, it is~\texttt{L}; for Arabic, it is~\texttt{R}; for Japanese |
| 495 |
and Mongolian, it is~\texttt{T}. |
| 496 |
\item The \emph{top of the line} corresponds to the notion |
| 497 |
of `up' within a line. Normally, this will be the same as for the |
| 498 |
beginning of the page, as in \texttt{TLT} for English, \texttt{TRT} |
| 499 |
for Arabic, \texttt{RTR} for Japanese, or \texttt{LTL} for Mongolian. |
| 500 |
However, for English included in Mongolian text, successive lines |
| 501 |
move `up' the page, which gives direction~\texttt{LTR}. |
| 502 |
\end{enumerate} |
| 503 |
|
| 504 |
The \OMEGA\ system distinguishes three levels of different writing |
| 505 |
direction: page (\verb|\pagedir|), text (\verb|\textdir|) and |
| 506 |
mathematics (\verb|\mathdir|). Each of these primitives takes |
| 507 |
as primitive one of the above sixteen writing directions. |
| 508 |
\begin{itemize} |
| 509 |
\item \verb|\pagedir| $\showdir$:\quad |
| 510 |
The page direction can only be changed if the current vlist |
| 511 |
is empty. This decision avoids ambiguous situations. |
| 512 |
\item \verb|\textdir| $\showdir$:\quad |
| 513 |
This primitive can appear anywhere in a text, and \OMEGA\ will |
| 514 |
allow for the moment only mixed horizontal combinations. |
| 515 |
Future versions will allow many different combinations, with |
| 516 |
parametrization. |
| 517 |
Grouping is respected, so it is possible to have inserts |
| 518 |
within a paragraph: these are implemented using the local paragraph |
| 519 |
mechanism described in the previous section. |
| 520 |
\item \verb|\mathdir| $\showdir$:\quad |
| 521 |
Normally mathematics is done in the same direction as English, |
| 522 |
namely~\texttt{TLT}. There have been situations where it has been |
| 523 |
written~\texttt{TRT}. \OMEGA\ allows only eight directions for |
| 524 |
mathematics, namely those in which |
| 525 |
the first and third direction parameters are identical. |
| 526 |
\end{itemize} |
| 527 |
|
| 528 |
In addition, \OMEGA\ allows one to designate the direction of a box. |
| 529 |
For example \verb|\hbox dir TRT{...}| creates a horizontal box, |
| 530 |
and uses direction~\texttt{TRT} while building that box. |
| 531 |
|
| 532 |
Finally, fonts can be stored either naturally or not. In the unnatural |
| 533 |
situation, called with primitive \verb|\unnaturaldir|, it is understood |
| 534 |
that glyphs in the current font will always appear to the right of the |
| 535 |
current point, above the baseline. In the natural situation, called |
| 536 |
with \verb|\naturaldir|, glyphs appear in the `correct' direction. So a |
| 537 |
natural Arabic font would have the glyphs appear to the left of the |
| 538 |
current point, and a natural Japanese font would make the glyphs appear |
| 539 |
below the current point. |
| 540 |
} |
| 541 |
|
| 542 |
\section{Fonts for \OMEGA} |
| 543 |
|
| 544 |
The \TeX\ system takes the following approach to fonts. The \TeX\ driver |
| 545 |
reads \TeX\ documents and generates \texttt{.dvi} files. The driver |
| 546 |
uses font metric files (suffix \texttt{.tfm}, text version \texttt{.pl}) |
| 547 |
to determine how to lay out boxes on a pages. The screen |
| 548 |
driver or printer driver transforms the \texttt{.dvi} file in the |
| 549 |
appropriate format, using bitmap fonts (\texttt{.pk}), scaled fonts |
| 550 |
(\texttt{.pfa} or \texttt{.pfb}), or virtual fonts (\texttt{.vf}, |
| 551 |
text version \texttt{.vp}). |
| 552 |
|
| 553 |
In the \OMEGA\ system, we make no attempt, for the moment, to change the |
| 554 |
definition of bitmaps or scaled fonts. We have focused on the font |
| 555 |
metrics (\texttt{.ofm}, text version \texttt{.opl}), and the |
| 556 |
virtual fonts (\texttt{.ovf}, text version \texttt{.ovp}). |
| 557 |
|
| 558 |
Currently, these new font file formats come in two versions. The first, |
| 559 |
called level~0, corresponds to the 16-bit version of \TFM\ files, with |
| 560 |
no new functionality. Level~1 fonts are more ambitious, and provide |
| 561 |
for more powerful features, including compression methods and additional |
| 562 |
parameters. |
| 563 |
|
| 564 |
\subsection{Level-0 \OFM\ files} |
| 565 |
|
| 566 |
The level-0 \OFM\ files are simply 16-bit versions of \TFM\ files, and have |
| 567 |
corresponding entries. |
| 568 |
Below is a description of the first 14 words of a level-0 \OFM\ file. |
| 569 |
Each entry is a 32-bit integer, non-negative and less than~$2^{31}$: |
| 570 |
\begin{eqnarray*} |
| 571 |
\myit{ofm-level} & = & 0; \\ |
| 572 |
\myit{lf} & = & \mbox{length of the file, in words}; \\ |
| 573 |
\myit{lh} & = & \mbox{length of the header data, in words}; \\ |
| 574 |
\myit{bc} & = & \mbox{smallest character code in the font}; \\ |
| 575 |
\myit{ec} & = & \mbox{largest character code in the font}; \\ |
| 576 |
\myit{nw} & = & \mbox{number of entries in the width table}; \\ |
| 577 |
\myit{nh} & = & \mbox{number of entries in the height table}; \\ |
| 578 |
\myit{nd} & = & \mbox{number of entries in the depth table}; \\ |
| 579 |
\myit{ni} & = & \mbox{number of entries in the italic correction table}; \\ |
| 580 |
\myit{nl} & = & \mbox{number of entries in the lig-kern table}; \\ |
| 581 |
\myit{nk} & = & \mbox{number of entries in the kern table}; \\ |
| 582 |
\myit{ne} & = & \mbox{number of entries in the extensible character table}; \\ |
| 583 |
\myit{np} & = & \mbox{number of font parameter words}; \\ |
| 584 |
\myit{font-dir} & = & \mbox{direction of font}. |
| 585 |
\end{eqnarray*} |
| 586 |
We must have that $\myit{bc}-1\leq \myit{ec}\leq 65535$. |
| 587 |
Furthermore, the following identity must hold: |
| 588 |
\begin{eqnarray*} |
| 589 |
\myit{lf} & = & |
| 590 |
14 + \myit{lh} + 2*(\myit{ec}-\myit{bc}+1) + |
| 591 |
\myit{nw} + \myit{nh} + \myit{nd} + \myit{ni} +\\ |
| 592 |
& & 2*\myit{nl} + \myit{nk} + 2*\myit{ne} + \myit{np}. |
| 593 |
\end{eqnarray*} |
| 594 |
Note that a font may contain as many as 65536 characters (if $\myit{bc}=0$ |
| 595 |
and $\myit{ec}=65535$), and as few as 0~characters |
| 596 |
(if $\myit{bc}=\myit{ec}-1$). |
| 597 |
|
| 598 |
As with \TFM\ files, if two or more octexts are combined to form an integer |
| 599 |
of 16~or more bits, the most significant octets appear first in the file. |
| 600 |
This is called BigEndian order. |
| 601 |
|
| 602 |
Also as with \TFM\ files, the rest of the file is a sequence of ten data arrays having the informal specification |
| 603 |
\begin{eqnarray*} |
| 604 |
\myit{header} & : & |
| 605 |
\mathbf{array}\;[0..\myit{lh}-1]\;\mathbf{of}\;\myit{stuff}\\ |
| 606 |
\myit{char-info} & : & |
| 607 |
\mathbf{array}\;[\myit{bc}..\myit{ec}]\;\mathbf{of}\; |
| 608 |
\myit{char-info-word}\\ |
| 609 |
\myit{width} & : & |
| 610 |
\mathbf{array}\;[0..\myit{nw}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 611 |
\myit{height} & : & |
| 612 |
\mathbf{array}\;[0..\myit{nh}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 613 |
\myit{depth} & : & |
| 614 |
\mathbf{array}\;[0..\myit{nd}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 615 |
\myit{italic} & : & |
| 616 |
\mathbf{array}\;[0..\myit{ni}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 617 |
\myit{lig-kern} & : & |
| 618 |
\mathbf{array}\;[0..\myit{nl}-1]\;\mathbf{of}\; |
| 619 |
\myit{lig-kern-command}\\ |
| 620 |
\myit{kern} & : & |
| 621 |
\mathbf{array}\;[0..\myit{nk}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 622 |
\myit{exten} & : & |
| 623 |
\mathbf{array}\;[0..\myit{ne}-1]\;\mathbf{of}\; |
| 624 |
\myit{extensible-recipe}\\ |
| 625 |
\myit{param} & : & |
| 626 |
\mathbf{array}\;[1..\myit{np}]\;\mathbf{of}\;\myit{fix-word} |
| 627 |
\end{eqnarray*} |
| 628 |
|
| 629 |
There is no need to describe the entire file, only those parts that differ |
| 630 |
from \TFM\ files: $\myit{char-info-word}$, |
| 631 |
$\myit{lig-kern-command}$ and $\myit{extensible-recipe}$. |
| 632 |
Here is a summary of those differences. |
| 633 |
\begin{itemize} |
| 634 |
\item $\myit{char-info-word}$ (8 octets): |
| 635 |
|
| 636 |
\begin{tabular}{lr} |
| 637 |
$\myit{width}$ & 16 bits\\ |
| 638 |
$\myit{height}$ & 8 bits\\ |
| 639 |
$\myit{depth}$ & 8 bits\\ |
| 640 |
$\myit{italic}$ & 8 bits\\ |
| 641 |
$\myit{RFU}$ & 6 bits\\ |
| 642 |
$\myit{tag}$ & 2 bits\\ |
| 643 |
$\myit{remainder}$ & 16 bits\\ |
| 644 |
\end{tabular} |
| 645 |
|
| 646 |
The meaning is as in \TFM\ files, so there are 65536 possible widths, |
| 647 |
256 possible widths, 256 possible heights and 256 possible italic corrections. |
| 648 |
|
| 649 |
\item $\myit{lig-kern-command}$ (8 octets): |
| 650 |
|
| 651 |
\begin{tabular}{lr} |
| 652 |
$\myit{skip-byte}$ & 16 bits\\ |
| 653 |
$\myit{next-char}$ & 16 bits\\ |
| 654 |
$\myit{op-byte}$ & 16 bits\\ |
| 655 |
$\myit{remainder}$ & 16 bits\\ |
| 656 |
\end{tabular} |
| 657 |
|
| 658 |
The meaning is as in \TFM\ files, with every entry doubling in size. |
| 659 |
|
| 660 |
\item $\myit{extensible-recipe}$ (8 octets): |
| 661 |
|
| 662 |
\begin{tabular}{lr} |
| 663 |
$\myit{ext-top}$ & 16 bits\\ |
| 664 |
$\myit{ext-mid}$ & 16 bits\\ |
| 665 |
$\myit{ext-bot}$ & 16 bits\\ |
| 666 |
$\myit{ext-rep}$ & 16 bits\\ |
| 667 |
\end{tabular} |
| 668 |
|
| 669 |
Once again, the meaning is as in \TFM\ files, but every entry has |
| 670 |
been doubled. |
| 671 |
\end{itemize} |
| 672 |
|
| 673 |
\subsection{Level-0 \OPL\ files} |
| 674 |
|
| 675 |
The level-0 \OPL\ files are the same as \PL\ files, with the exception |
| 676 |
that values restricted to 8~bits can now be 16~bits. |
| 677 |
|
| 678 |
\subsection{Level-0 \OVF\ files} |
| 679 |
|
| 680 |
The \OVF\ files are indistinguishable from \VF\ files, |
| 681 |
except for the file suffix. They exist only because |
| 682 |
the vast majority of drivers balk when they see |
| 683 |
characters that are not 8~bits. |
| 684 |
|
| 685 |
\subsection{Level-0 \OVP\ files} |
| 686 |
|
| 687 |
The level-0 \OVP\ files are the same as \VP\ files, with the exception |
| 688 |
that values restricted to 8~bits can now be 16~bits. |
| 689 |
|
| 690 |
\subsection{Level-1 \OFM\ files} |
| 691 |
|
| 692 |
The level-1 fonts take a different approach to level-0 fonts. They do |
| 693 |
not make the assumption that typesetting means simply placing |
| 694 |
placing glyphs on the baseline, one after another. Example |
| 695 |
applications include the automatic placement of glue between characters |
| 696 |
in East Asian scripts, the building of consonental clusters for |
| 697 |
South-Asian and South-East-Asian scripts, as well as the placing of |
| 698 |
diacritics in Arabic and Hebrew. |
| 699 |
|
| 700 |
Level-1 fonts are different from level-0 fonts at three levels. First, they |
| 701 |
allow the definition of six new kinds of table: |
| 702 |
\begin{itemize} |
| 703 |
\item \textsc{ivalue} tables contain integers. |
| 704 |
\item \textsc{fvalue} tables contain fixword values that do not grow with |
| 705 |
magnification. |
| 706 |
\item \textsc{mvalue} tables contain fixword values that do grow with |
| 707 |
magnification. |
| 708 |
\item \textsc{rule} tables contain \TeX\ rule definitions. |
| 709 |
\item \textsc{glue} tables contain \TeX\ glue definitions. |
| 710 |
\item \textsc{penalty} tables contain \TeX\ penalty definitions. |
| 711 |
\end{itemize} |
| 712 |
There can be several copies of each kind of table, but for the moment, |
| 713 |
there is a maximum of 32~new tables in all. |
| 714 |
|
| 715 |
These new tables can be used as global tables, or can be indexed |
| 716 |
on a character-by-character basis in the $\myit{char-info-word}$ entries, |
| 717 |
which define character parameters. So, in addition to the standard |
| 718 |
parameters of width, height, depth and italic correction, additional |
| 719 |
parameters (of the six kinds outlined above) can be given for the |
| 720 |
characters. |
| 721 |
|
| 722 |
To allow these new tables to be used, changes have also been made |
| 723 |
to the lig-kern table. |
| 724 |
\begin{itemize} |
| 725 |
\item Characters can be put into equivalence classes, where all |
| 726 |
characters in the same class will act the same in the lig-kern table; |
| 727 |
\item Glue nodes, rule nodes and penalty nodes can be inserted |
| 728 |
automatically into the stream, exactly as for kern nodes in~\TeX. |
| 729 |
\item The lig-kern program can be completely replaced by an \OTP\ (see |
| 730 |
section~\ref{lab:otps}). |
| 731 |
\end{itemize} |
| 732 |
|
| 733 |
Now we begin with the first part of the header of a level-1 \OFM\ file. |
| 734 |
Here are the first 17~words of a level-1 \OFM\ file. |
| 735 |
Each entry below is a 32-bit integer, non-negative and less |
| 736 |
than~$2^{31}$. |
| 737 |
\begin{eqnarray*} |
| 738 |
\myit{ofm-level} & = & 1; \\ |
| 739 |
\myit{lf} & = & \mbox{length of the file, in words}; \\ |
| 740 |
\myit{lh} & = & \mbox{length of the header data, in words}; \\ |
| 741 |
\myit{bc} & = & \mbox{smallest character code in the font}; \\ |
| 742 |
\myit{ec} & = & \mbox{largest character code in the font}; \\ |
| 743 |
\myit{nw} & = & \mbox{number of entries in the width table}; \\ |
| 744 |
\myit{nh} & = & \mbox{number of entries in the height table}; \\ |
| 745 |
\myit{nd} & = & \mbox{number of entries in the depth table}; \\ |
| 746 |
\myit{ni} & = & \mbox{number of entries in the italic correction table}; \\ |
| 747 |
\myit{nl} & = & \mbox{number of entries in the lig-kern table}; \\ |
| 748 |
\myit{nk} & = & \mbox{number of entries in the kern table}; \\ |
| 749 |
\myit{ne} & = & \mbox{number of entries in the extensible character table}; \\ |
| 750 |
\myit{np} & = & \mbox{number of font parameter words}; \\ |
| 751 |
\myit{font-dir} & = & \mbox{direction of font}; \\ |
| 752 |
\myit{nco} & = & \mbox{offset of the character entries, in words}; \\ |
| 753 |
\myit{ncw} & = & \mbox{number of character info words}; \\ |
| 754 |
\myit{npc} & = & \mbox{number of parameters per character}. |
| 755 |
\end{eqnarray*} |
| 756 |
Most of the entries in the first part are as for level-0 fonts. The new |
| 757 |
entries pertain to how the $\myit{char-info-word}$ entries are stored. |
| 758 |
\begin{itemize} |
| 759 |
\item $\myit{nco}$:\quad This value gives the offset into the file |
| 760 |
for the first word of the $\myit{char-info-word}$ table. The |
| 761 |
$\myit{nco}$ value is required by output drivers, which need quick |
| 762 |
access to the characters, even if the total length |
| 763 |
of the tables preceding them is not easily computed,. |
| 764 |
\item $\myit{ncw}$:\quad Since many large fonts have large numbers |
| 765 |
of consecutive characters with identical metrics. These are compressed |
| 766 |
in level-1 fonts, and so the number of $\myit{char-info-word}$ |
| 767 |
entries is not simply $\myit{ec}-\myit{bc}+1$. The $\myit{ncw}$ |
| 768 |
value gives the number of words used for character information, |
| 769 |
not the number of entries. |
| 770 |
\item $\myit{npc}$:\quad This is the number of extra parameters per character. |
| 771 |
\item $\myit{real-lf}$:\quad This would be the length of |
| 772 |
the file, were there no compression. |
| 773 |
\end{itemize} |
| 774 |
|
| 775 |
The next twelve entries come in pairs. |
| 776 |
For each kind of parameter (\textsc{ivalue}, \textsc{fvalue}, |
| 777 |
\textsc{mvalue}, \textsc{rule}, \textsc{glue}, \textsc{penalty}), |
| 778 |
the first entry states how many tables of that kind there are, |
| 779 |
and the second states how many words these tables require. |
| 780 |
\begin{eqnarray*} |
| 781 |
\myit{nki} & = & \mbox{number of \textsc{ivalue} tables}; \\ |
| 782 |
\myit{nwi} & = & \mbox{number of words for \textsc{ivalue} tables}; \\ |
| 783 |
\myit{nkf} & = & \mbox{number of \textsc{fvalue} tables}; \\ |
| 784 |
\myit{nwf} & = & \mbox{number of words for \textsc{fvalue} tables}; \\ |
| 785 |
\myit{nkm} & = & \mbox{number of \textsc{mvalue} tables}; \\ |
| 786 |
\myit{nwm} & = & \mbox{number of words for \textsc{mvalue} tables}; \\ |
| 787 |
\myit{nkr} & = & \mbox{number of \textsc{rule} tables}; \\ |
| 788 |
\myit{nwr} & = & \mbox{number of words for \textsc{rule} tables}; \\ |
| 789 |
\myit{nkg} & = & \mbox{number of \textsc{glue} tables}; \\ |
| 790 |
\myit{nwg} & = & \mbox{number of words for \textsc{glue} tables}; \\ |
| 791 |
\myit{nkp} & = & \mbox{number of \textsc{penalty} tables}; \\ |
| 792 |
\myit{nwp} & = & \mbox{number of words for \textsc{penalty} tables}. |
| 793 |
\end{eqnarray*} |
| 794 |
|
| 795 |
We must have that $\myit{bc}-1\leq \myit{ec}\leq 65535$. |
| 796 |
Furthermore, the following identity must hold: |
| 797 |
\begin{eqnarray*} |
| 798 |
\myit{lf} & = & |
| 799 |
29 + \myit{lh} + \myit{ncw} + |
| 800 |
\myit{nw} + \myit{nh} + \myit{nd} + \myit{ni} +\\ |
| 801 |
& & 2*\myit{nl} + \myit{nk} + 2*\myit{ne} + \myit{np} +\\ |
| 802 |
& & \myit{nki} + \myit{nwi} + |
| 803 |
\myit{nkf} + \myit{nwf} + |
| 804 |
\myit{nkm} + \myit{nwm} +\\ |
| 805 |
& & \myit{nkr} + \myit{nwr} + |
| 806 |
\myit{nkg} + \myit{nwg} + |
| 807 |
\myit{nkp} + \myit{nwp}. |
| 808 |
\end{eqnarray*} |
| 809 |
Finally, the sum |
| 810 |
$\myit{nki}+ \myit{nkf}+ \myit{nkm}+ |
| 811 |
\myit{nkr}+ \myit{nkg}+ \myit{nkp}$ |
| 812 |
must be less than 32. |
| 813 |
|
| 814 |
The rest of the file is composed of a number of arrays. The new parameter |
| 815 |
tables are placed before the standard dimension tables, as it is difficult |
| 816 |
to estimate space requirements without having read the new tables. |
| 817 |
Furthermore, the character parameter indices in the $\myit{char-info-word}$ |
| 818 |
entries are relative and must be translated into an absolute reference |
| 819 |
into the tables. |
| 820 |
|
| 821 |
\begin{eqnarray*} |
| 822 |
\myit{header} & : & |
| 823 |
\mathbf{array}\;[0..\myit{lh}-1]\;\mathbf{of}\;\myit{stuff}\\ |
| 824 |
\myit{ivalue-no} & : & |
| 825 |
\mathbf{array}\;[0..\myit{nki}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 826 |
\myit{fvalue-no} & : & |
| 827 |
\mathbf{array}\;[0..\myit{nkf}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 828 |
\myit{mvalue-no} & : & |
| 829 |
\mathbf{array}\;[0..\myit{nkm}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 830 |
\myit{rule-no} & : & |
| 831 |
\mathbf{array}\;[0..\myit{nkr}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 832 |
\myit{glue-no} & : & |
| 833 |
\mathbf{array}\;[0..\myit{nkg}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 834 |
\myit{pen-no} & : & |
| 835 |
\mathbf{array}\;[0..\myit{nkp}-1]\;\mathbf{of}\;\myit{integer}\\ |
| 836 |
\myit{ivalue-table}[0] & : & |
| 837 |
\mathbf{array}\;[0..\myit{ivalue-no}[0]-1]\; |
| 838 |
\mathbf{of}\;\myit{integer}\\ |
| 839 |
& \vdots\\ |
| 840 |
\myit{ivalue-table}[\myit{nki}-1] & : & |
| 841 |
\mathbf{array}\;[0..\myit{ivalue-no}[\myit{nki}-1]-1]\; |
| 842 |
\mathbf{of}\;\myit{integer}\\ |
| 843 |
\myit{fvalue-table}[0] & : & |
| 844 |
\mathbf{array}\;[0..\myit{fvalue-no}[0]-1]\; |
| 845 |
\mathbf{of}\;\myit{fix-word}\\ |
| 846 |
& \vdots\\ |
| 847 |
\myit{fvalue-table}[\textit{nkf}-1] & : & |
| 848 |
\mathbf{array}\;[0..\myit{fvalue-no}[\textit{nkf}-1]-1]\; |
| 849 |
\mathbf{of}\;\myit{fix-word}\\ |
| 850 |
\myit{mvalue-table}[0] & : & |
| 851 |
\mathbf{array}\;[0..\myit{mvalue-no}[0]-1]\; |
| 852 |
\mathbf{of}\;\myit{fix-word}\\ |
| 853 |
& \vdots\\ |
| 854 |
\myit{mvalue-table}[\textit{nkm}-1] & : & |
| 855 |
\mathbf{array}\;[0..\myit{mvalue-no}[\textit{nkm}-1]-1]\; |
| 856 |
\mathbf{of}\;\myit{fix-word}\\ |
| 857 |
\myit{rule-table}[0] & : & |
| 858 |
\mathbf{array}\;[0..\myit{rule-no}[0]-1]\; |
| 859 |
\mathbf{of}\;\myit{rule-entry}\\ |
| 860 |
& \vdots\\ |
| 861 |
\myit{rule-table}[\textit{nkr}-1] & : & |
| 862 |
\mathbf{array}\;[0..\myit{rule-no}[\textit{nkr}-1]-1]\; |
| 863 |
\mathbf{of}\;\myit{rule-entry}\\ |
| 864 |
\myit{glue-table}[0] & : & |
| 865 |
\mathbf{array}\;[0..\myit{glue-no}[0]-1]\; |
| 866 |
\mathbf{of}\;\myit{glue-entry}\\ |
| 867 |
& \vdots\\ |
| 868 |
\myit{glue-table}[\textit{nkg}-1] & : & |
| 869 |
\mathbf{array}\;[0..\myit{glue-no}[\textit{nkg}-1]-1]\; |
| 870 |
\mathbf{of}\;\myit{glue-entry}\\ |
| 871 |
\myit{pen-table}[0] & : & |
| 872 |
\mathbf{array}\;[0..\myit{pen-no}[0]-1]\; |
| 873 |
\mathbf{of}\;\myit{integer}\\ |
| 874 |
& \vdots\\ |
| 875 |
\myit{pen-table}[\textit{nkp}-1] & : & |
| 876 |
\mathbf{array}\;[0..\myit{pen-no}[\textit{nkp}-1]-1]\; |
| 877 |
\mathbf{of}\;\myit{integer}\\ |
| 878 |
\myit{char-info} & : & |
| 879 |
\mathbf{array}\;[0..\myit{ncw}-1]\;\mathbf{of}\; |
| 880 |
\myit{char-info-word}\\ |
| 881 |
\myit{width} & : & |
| 882 |
\mathbf{array}\;[0..\myit{nw}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 883 |
\myit{height} & : & |
| 884 |
\mathbf{array}\;[0..\myit{nh}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 885 |
\myit{depth} & : & |
| 886 |
\mathbf{array}\;[0..\myit{nd}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 887 |
\myit{italic} & : & |
| 888 |
\mathbf{array}\;[0..\myit{ni}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 889 |
\myit{lig-kern} & : & |
| 890 |
\mathbf{array}\;[0..\myit{nl}-1]\;\mathbf{of}\; |
| 891 |
\myit{lig-kern-command}\\ |
| 892 |
\myit{kern} & : & |
| 893 |
\mathbf{array}\;[0..\myit{nk}-1]\;\mathbf{of}\;\myit{fix-word}\\ |
| 894 |
\myit{exten} & : & |
| 895 |
\mathbf{array}\;[0..\myit{ne}-1]\;\mathbf{of}\; |
| 896 |
\myit{extensible-recipe}\\ |
| 897 |
\myit{param} & : & |
| 898 |
\mathbf{array}\;[1..\myit{np}]\;\mathbf{of}\;\myit{fix-word} |
| 899 |
\end{eqnarray*} |
| 900 |
|
| 901 |
So, for parameter $x$, there is a table $\myit{x-no}$, of |
| 902 |
length~$\myit{nkx}$, giving the size of each table. |
| 903 |
In addition, there are $\myit{nkx}$ tables |
| 904 |
containing the actual entries, where the $i$-th table is of |
| 905 |
length~$\myit{x-no}[i]$. |
| 906 |
|
| 907 |
The only parameter entries with an unclear structure are |
| 908 |
$\myit{rule-entry}$ and $\myit{glue-entry}$. |
| 909 |
|
| 910 |
\begin{itemize} |
| 911 |
\item |
| 912 |
Each $\myit{rule-entry}$ uses three words (12~octets): |
| 913 |
\vspace*{.1cm} |
| 914 |
|
| 915 |
\begin{tabular}{llrl} |
| 916 |
1st word & $\myit{width}$ & 32 bits & fixword\\ |
| 917 |
2nd word & $\myit{height}$ & 32 bits & fixword\\ |
| 918 |
3rd word & $\myit{depth}$ & 32 bits & fixword\\ |
| 919 |
\end{tabular} |
| 920 |
\vspace*{.1cm} |
| 921 |
|
| 922 |
The interpretation of the values should be clear. If one of the |
| 923 |
three values is~0, then it can stretch in the appropriate direction, |
| 924 |
as is standard in~\TeX. |
| 925 |
\item |
| 926 |
Each $\myit{glue-entry}$ uses four words (16~octets): |
| 927 |
\vspace*{.1cm} |
| 928 |
|
| 929 |
\begin{tabular}{llrl} |
| 930 |
1st word & $\myit{subtype}$ & 4 bits & (0--3)\\ |
| 931 |
& $\myit{argument-kind}$ & 4 bits & (0--2)\\ |
| 932 |
& $\myit{stretch-order}$ & 4 bits & (0--4)\\ |
| 933 |
& $\myit{shrink-order}$ & 4 bits & (0--4)\\ |
| 934 |
& $\myit{char-rule}$ & 16 bits\\ |
| 935 |
2nd word & $\myit{width}$ & 32 bits & fixword\\ |
| 936 |
3rd word & $\myit{stretch}$ & 32 bits & fixword\\ |
| 937 |
4th word & $\myit{shrink}$ & 32 bits & fixword\\ |
| 938 |
\end{tabular} |
| 939 |
\vspace*{.1cm} |
| 940 |
|
| 941 |
\begin{itemize} |
| 942 |
\item$\myit{subtype}$ is one of |
| 943 |
\vspace*{.1cm} |
| 944 |
|
| 945 |
\begin{tabular}{ll} |
| 946 |
0 & $\myit{normal}$\\ |
| 947 |
1 & $\myit{a-leaders}$\\ |
| 948 |
2 & $\myit{c-leaders}$\\ |
| 949 |
3 & $\myit{x-leaders}$\\ |
| 950 |
\end{tabular} |
| 951 |
\vspace*{.1cm} |
| 952 |
|
| 953 |
\item $\myit{argument-kind}$ is one of |
| 954 |
\vspace*{.1cm} |
| 955 |
|
| 956 |
\begin{tabular}{ll} |
| 957 |
0 & $\myit{space}$\\ |
| 958 |
1 & $\myit{rule}$ ($\myit{subtype}$ must be leader)\\ |
| 959 |
2 & $\myit{character}$ ($\myit{subtype}$ must be leader)\\ |
| 960 |
\end{tabular} |
| 961 |
\vspace*{.1cm} |
| 962 |
|
| 963 |
\item $\myit{stretch-order}$ and $\myit{shrink-order}$ |
| 964 |
are one of |
| 965 |
\vspace*{.1cm} |
| 966 |
|
| 967 |
\begin{tabular}{ll} |
| 968 |
0 & $\myit{normal}$\\ |
| 969 |
1 & $\myit{fi}$\\ |
| 970 |
2 & $\myit{fil}$\\ |
| 971 |
3 & $\myit{fill}$\\ |
| 972 |
4 & $\myit{filll}$\\ |
| 973 |
\end{tabular} |
| 974 |
\vspace*{.1cm} |
| 975 |
|
| 976 |
\item $n=\myit{char-rule}$ depends on the value of |
| 977 |
$\myit{argument-kind}$: |
| 978 |
\begin{enumerate} |
| 979 |
\item[0.] 0; |
| 980 |
\item[1.] $n$-th rule in rule table~0; |
| 981 |
\item[2.] $n$-character in font. |
| 982 |
\end{enumerate} |
| 983 |
\end{itemize} |
| 984 |
The explanation here only really makes sense if the reader has a clear |
| 985 |
understanding of how glue nodes are built in~\TeX. More detailed |
| 986 |
documentation is forthcoming. |
| 987 |
\end{itemize} |
| 988 |
|
| 989 |
The new $\myit{char-info-word}$ array is of great interest. Its length |
| 990 |
is not directly computable from the number of characters in the font. Each |
| 991 |
$\myit{char-info-word}$ entry contains a minimum of 12 octets, and is in |
| 992 |
any case a multiple of four octets. Each entry is as follows: |
| 993 |
\vspace*{.1cm} |
| 994 |
|
| 995 |
\begin{tabular}{llrl} |
| 996 |
1st word & $\myit{width}$ & 16 bits\\ |
| 997 |
& $\myit{height}$ & 8 bits\\ |
| 998 |
& $\myit{depth}$ & 8 bits\\ |
| 999 |
\hline |
| 1000 |
2nd word & $\myit{italic}$ & 8 bits\\ |
| 1001 |
& $\myit{RFU}$ & 5 bits\\ |
| 1002 |
& $\myit{ext-tag}$ & 1 bit\\ |
| 1003 |
& $\myit{tag}$ & 2 bits\\ |
| 1004 |
& $\myit{remainder}$ & 16 bits\\ |
| 1005 |
\hline |
| 1006 |
& $\myit{no-repeats}$ & 16 bits\\ |
| 1007 |
& $\myit{param}_0$ & 16 bits\\ |
| 1008 |
& \ldots\\ |
| 1009 |
& $\myit{param}_{\it npc-1}$ & 16 bits\\ |
| 1010 |
& $\myit{padding}$ & 16 bits & if necessary\\ |
| 1011 |
\end{tabular} |
| 1012 |
\vspace*{.1cm} |
| 1013 |
|
| 1014 |
\noindent |
| 1015 |
where $\myit{npc}$ is the number of characters per parameter. |
| 1016 |
|
| 1017 |
The $\myit{repeat}$ entry allows one to state that the following |
| 1018 |
\texttt{no-repeats} characters have identical attributes, thereby |
| 1019 |
allowing the \OFM\ file to be much smaller. This attribute is essential |
| 1020 |
for Chinese, Japanese and korean ideogram fonts. In other words, this |
| 1021 |
$\myit{char-info-word}$ entry is relevant to $(\myit{no-repeats}+1)$ |
| 1022 |
characters. |
| 1023 |
|
| 1024 |
If the $\myit{ext-tag}$ bit is on, then the lig-kern entry pointed to |
| 1025 |
by $\myit{remainder}$ is shared with all the other characters in its |
| 1026 |
\emph{equivalence class}, which corresponds to $\myit{param}_0$ |
| 1027 |
if there exists an \textsc{ivalue} table. |
| 1028 |
|
| 1029 |
We are now ready for the changed lig-kern table. There are four |
| 1030 |
new instructions, which can be distinguished by the fact that |
| 1031 |
the 0-th 16-bit entry ($\myit{skip-byte}$) is exactly~256. |
| 1032 |
In that case, then the 1st 16-bit entry ($\myit{next-char}$) |
| 1033 |
defines an equivalence class. If the next character is of that |
| 1034 |
equivalence class, then the 2nd 16-bit entry |
| 1035 |
(the $\myit{op-byte}$) is interpreted as follows: |
| 1036 |
\begin{enumerate} |
| 1037 |
\item[17.] Add the glue node defined by entry $\myit{remainder}$ |
| 1038 |
in the 0-th glue table. |
| 1039 |
\item[18.] Add the penalty node defined by entry $\myit{remainder}$ |
| 1040 |
in the 0-th penalty table. |
| 1041 |
\item[19.] Add the penalty node defined by entry |
| 1042 |
$\myit{remainder}/256$ in the 0-th penalty table, then |
| 1043 |
add the glue node defined by entry |
| 1044 |
$\myit{remainder}\;\textrm{mode}\;256$ in the 0-th glue table. |
| 1045 |
\item[20.] Add the kern node defined by entry $\myit{remainder}$ |
| 1046 |
in the 0-th mvalue table. |
| 1047 |
\end{enumerate} |
| 1048 |
|
| 1049 |
\subsection{Level-1 \OPL\ files} |
| 1050 |
|
| 1051 |
The level-1 \OPL\ files are the text versions of level-1 \OFM\ files. |
| 1052 |
Hence, level-1 \OPL\ files contain six kinds of new tables: |
| 1053 |
integer (\textsc{ivalue}), fixed (\textsc{fvalue}), |
| 1054 |
magnifiable fixed (\textsc{mvalue}), rule (\textsc{rule}), |
| 1055 |
glue (\textsc{glue}) and \textsc{penalty}) tables. |
| 1056 |
In addition, the character entries can include new parameters, |
| 1057 |
which can then be used in the extended lig-kern table. |
| 1058 |
|
| 1059 |
We begin with the new tables. |
| 1060 |
These extra tables are numbered within each class, from 0 to $n-1$, |
| 1061 |
where $n$ is the number of tables in that class. To define, say, |
| 1062 |
the fifth \textsc{ivalue} table, one begins as follows: |
| 1063 |
\[ |
| 1064 |
\bigl(\texttt{FONTIVALUE H 5 } \showtable\bigr) |
| 1065 |
\] |
| 1066 |
The instructions for defining tables are |
| 1067 |
\[ |
| 1068 |
\begin{array}{lll} |
| 1069 |
\bigl(\texttt{FONTIVALUE} & \showtno & \showtable\bigr)\\ |
| 1070 |
\bigl(\texttt{FONTFVALUE} & \showtno & \showtable\bigr)\\ |
| 1071 |
\bigl(\texttt{FONTMVALUE} & \showtno & \showtable\bigr)\\ |
| 1072 |
\bigl(\texttt{FONTRULE} & \showtno & \showtable\bigr)\\ |
| 1073 |
\bigl(\texttt{FONTGLUE} & \showtno & \showtable\bigr)\\ |
| 1074 |
\bigl(\texttt{FONTPENALTY}& \showtno & \showtable\bigr)\\ |
| 1075 |
\end{array} |
| 1076 |
\] |
| 1077 |
|
| 1078 |
The property lists for these tables contain as many entries as there are |
| 1079 |
slots in the table. So the fourth entry, starting from~0, in a glue |
| 1080 |
table would begin as follows: |
| 1081 |
\[ |
| 1082 |
\bigl(\texttt{GLUE H 4 } \showglue\bigr) |
| 1083 |
\] |
| 1084 |
The instructions for defining entries are: |
| 1085 |
\[ |
| 1086 |
\begin{array}{lll} |
| 1087 |
\bigl(\texttt{IVALUE} & \showeno & \showivalue\bigr)\\ |
| 1088 |
\bigl(\texttt{FVALUE} & \showeno & \showfvalue\bigr)\\ |
| 1089 |
\bigl(\texttt{MVALUE} & \showeno & \showmvalue\bigr)\\ |
| 1090 |
\bigl(\texttt{RULE} & \showeno & \showrule\bigr)\\ |
| 1091 |
\bigl(\texttt{GLUE} & \showeno & \showglue\bigr)\\ |
| 1092 |
\bigl(\texttt{PENALTY}& \showeno & \showpenaltydef\bigr)\\ |
| 1093 |
\end{array} |
| 1094 |
\] |
| 1095 |
|
| 1096 |
Now we come to the definitions of the individual entries. |
| 1097 |
The four simple ones are for \textsc{ivalue}, \textsc{fvalue}, |
| 1098 |
\textsc{mvalue} and \textsc{penalty}, which are as follows: |
| 1099 |
The instructions for defining entries are: |
| 1100 |
\[ |
| 1101 |
\begin{array}{ll} |
| 1102 |
\bigl(\texttt{IVALUEVAL} & \showinteger\bigr)\\ |
| 1103 |
\bigl(\texttt{FVALUEVAL} & \showfixword\bigr)\\ |
| 1104 |
\bigl(\texttt{MVALUEVAL} & \showfixword\bigr)\\ |
| 1105 |
\bigl(\texttt{PENALTYVAL}& \showinteger\bigr)\\ |
| 1106 |
\end{array} |
| 1107 |
\] |
| 1108 |
with some examples: |
| 1109 |
\begin{verbatim} |
| 1110 |
(IVALUEVAL H 42) |
| 1111 |
(PENALTYVAL D 1000) |
| 1112 |
(FVALUEVAL R 42.0) |
| 1113 |
(MVALUEVAL R 42.0) |
| 1114 |
\end{verbatim} |
| 1115 |
which define an integer value of hex-42, a penalty value of 1000, |
| 1116 |
a fix-word value of 42.0, and a magnifiable fix-word value of |
| 1117 |
42.0. |
| 1118 |
|
| 1119 |
A $\showrule$ contains three components, each defaulting to~0: |
| 1120 |
\[ |
| 1121 |
\begin{array}{ll} |
| 1122 |
\bigl(\texttt{RULEWD} & \showfixword\bigr)\\ |
| 1123 |
\bigl(\texttt{RULEHT} & \showfixword\bigr)\\ |
| 1124 |
\bigl(\texttt{RULEDP} & \showfixword\bigr)\\ |
| 1125 |
\end{array} |
| 1126 |
\] |
| 1127 |
|
| 1128 |
The most complex entries are for glue, which can take several |
| 1129 |
instructions. The first few instructions should be clear: |
| 1130 |
\[ |
| 1131 |
\begin{array}{ll} |
| 1132 |
\bigl(\texttt{GLUEWD} & \showfixword\bigr)\\ |
| 1133 |
\bigl(\texttt{GLUESTRETCH} & \showfixword\bigr)\\ |
| 1134 |
\bigl(\texttt{GLUESHRINK} & \showfixword\bigr)\\ |
| 1135 |
\bigl(\texttt{GLUESTRETCHORDER} & \showorder\bigr)\\ |
| 1136 |
\bigl(\texttt{GLUESHRINKORDER} & \showorder\bigr)\\ |
| 1137 |
\end{array} |
| 1138 |
\] |
| 1139 |
where $\showorder$ is one of \texttt{UNIT}, \texttt{FI}, \texttt{FIL}, |
| 1140 |
\texttt{FILL}, \texttt{FILLL}. |
| 1141 |
|
| 1142 |
|
| 1143 |
Now, glue can either be blank, or consist of a leader: |
| 1144 |
\[ |
| 1145 |
\begin{array}{ll} |
| 1146 |
\bigl(\texttt{GLUETYPE} & \showkind\bigr)\\ |
| 1147 |
\end{array} |
| 1148 |
\] |
| 1149 |
where $\showkind$ is one of \texttt{NORMAL}, \texttt{ALEADERS}, |
| 1150 |
\texttt{CLEADERS}, \texttt{XLEADERS}. If a leader is chosen, |
| 1151 |
then one of the following alternatives can be given: |
| 1152 |
\[ |
| 1153 |
\begin{array}{ll} |
| 1154 |
\bigl(\texttt{GLUERULE} & \showinteger\bigr)\\ |
| 1155 |
\bigl(\texttt{GLUECHAR} & \showinteger\bigr)\\ |
| 1156 |
\end{array} |
| 1157 |
\] |
| 1158 |
We give below the tables for an initial test with East Asian fonts: |
| 1159 |
\begin{verbatim} |
| 1160 |
(FONTIVALUE H 0 |
| 1161 |
(IVALUE H 0 |
| 1162 |
(IVALUEVAL H 0) |
| 1163 |
) |
| 1164 |
(IVALUE H 1 |
| 1165 |
(IVALUEVAL H 1) |
| 1166 |
) |
| 1167 |
(IVALUE H 2 |
| 1168 |
(IVALUEVAL H 2) |
| 1169 |
) |
| 1170 |
(IVALUE H 3 |
| 1171 |
(IVALUEVAL H 3) |
| 1172 |
) |
| 1173 |
) |
| 1174 |
(FONTGLUE H 0 |
| 1175 |
(GLUE H 0 |
| 1176 |
(GLUETYPE H 0) |
| 1177 |
(GLUESTRETCHORDER NORMAL) |
| 1178 |
(GLUESHRINKORDER NORMAL) |
| 1179 |
(GLUEWD R 0.0) |
| 1180 |
(GLUESTRETCH R 0.0) |
| 1181 |
(GLUESCHRINK R 0.0) |
| 1182 |
) |
| 1183 |
(GLUE H 1 |
| 1184 |
(GLUETYPE H 0) |
| 1185 |
(GLUESTRETCHORDER NORMAL) |
| 1186 |
(GLUESHRINKORDER NORMAL) |
| 1187 |
(GLUEWD R 1.2333 |
| 1188 |
(GLUESTRETCH R 4.5555) |
| 1189 |
(GLUESCHRINK R 2.3444) |
| 1190 |
) |
| 1191 |
(FONTPENALTY H 0 |
| 1192 |
(PENALTY H 0 |
| 1193 |
(PENALTYVAL H 0) |
| 1194 |
) |
| 1195 |
(PENALTY H 1 |
| 1196 |
(PENALTYVAL H 122A) |
| 1197 |
) |
| 1198 |
) |
| 1199 |
\end{verbatim} |
| 1200 |
|
| 1201 |
The extra tables can appear in any order, but they must all appear |
| 1202 |
\emph{before} the first character entry has appeared, since the |
| 1203 |
character parameters can refer to these tables. |
| 1204 |
|
| 1205 |
When defining the character entries, the standard entries (width, |
| 1206 |
height, depth and italic correction) all exist. One can also add |
| 1207 |
parameters to the characters by referring to the above |
| 1208 |
tables. The syntax for an entry resembles |
| 1209 |
\begin{verbatim} |
| 1210 |
(CHARIVALUE H 0 H 2) |
| 1211 |
\end{verbatim} |
| 1212 |
For this character, it is entry 2 in \textsc{ivalue} table 0 that is |
| 1213 |
relevant. All entries are similar: |
| 1214 |
\[ |
| 1215 |
\begin{array}{lll} |
| 1216 |
\bigl(\texttt{CHARIVALUE} & \showinteger & \showinteger\bigr)\\ |
| 1217 |
\bigl(\texttt{CHARFVALUE} & \showinteger & \showinteger\bigr)\\ |
| 1218 |
\bigl(\texttt{CHARMVALUE} & \showinteger & \showinteger\bigr)\\ |
| 1219 |
\bigl(\texttt{CHARRULE} & \showinteger & \showinteger\bigr)\\ |
| 1220 |
\bigl(\texttt{CHARGLUE} & \showinteger & \showinteger\bigr)\\ |
| 1221 |
\bigl(\texttt{CHARPENALTY} & \showinteger & \showinteger\bigr)\\ |
| 1222 |
\end{array} |
| 1223 |
\] |
| 1224 |
There is a special use for the 0-th integer table, which defines |
| 1225 |
the equivalence class of the character for the lig-kern table: |
| 1226 |
\[ |
| 1227 |
\begin{array}{ll} |
| 1228 |
\bigl(\texttt{CHARIVALUE H 0} & \showinteger\bigr) |
| 1229 |
\end{array} |
| 1230 |
\] |
| 1231 |
The idea is that characters that act similarly with respect to |
| 1232 |
their neighboring characters should have the same lig-kern |
| 1233 |
entry, allowing for the dramatic reduction in size of the |
| 1234 |
lig-kern table. More later. |
| 1235 |
|
| 1236 |
Also to save space, it is possible to state that several characters use the |
| 1237 |
same information. This is done with the \textsc{charrepeat} |
| 1238 |
instruction: |
| 1239 |
\[ |
| 1240 |
\begin{array}{ll} |
| 1241 |
\bigl(\texttt{CHARREPEAT H 34 H 42 } \showchardefn\bigr) |
| 1242 |
\end{array} |
| 1243 |
\] |
| 1244 |
states that characters \texttt{0x34} through to \texttt{0x76} |
| 1245 |
(\texttt{0x34}+\texttt{0x42}) all use the same information. |
| 1246 |
This clustering is done automatically by the \texttt{ovp2ovf} program. |
| 1247 |
|
| 1248 |
The lig-kern table uses four new instructions for the automatic |
| 1249 |
insertion of kern, glue and penalties between characters. For example, |
| 1250 |
\begin{verbatim} |
| 1251 |
(CKRN H 3 H 2) |
| 1252 |
\end{verbatim} |
| 1253 |
states that if we encounter this instruction, and the next character |
| 1254 |
has 3~in its 0-th \textsc{ivalue} table, then the 2-nd entry in the 0-th |
| 1255 |
\textsc{mvalue} table is inserted into the stream. |
| 1256 |
Similarly, |
| 1257 |
\begin{verbatim} |
| 1258 |
(CGLUE H 3 H 2) |
| 1259 |
\end{verbatim} |
| 1260 |
states that if we encounter this instruction, and the next character |
| 1261 |
has 3~in its 0-th \textsc{ivalue} table, then the 2-nd entry in the 0-th |
| 1262 |
\textsc{glue} table is inserted into the stream. |
| 1263 |
Once again, |
| 1264 |
\begin{verbatim} |
| 1265 |
(CPENALTY H 3 H 2) |
| 1266 |
\end{verbatim} |
| 1267 |
does the same thing, except that it inserts the 2-nd entry in the 0-th |
| 1268 |
\textsc{penalty} table into the stream. The other one is |
| 1269 |
\begin{verbatim} |
| 1270 |
(CPENGLUE H 3 H 2 H 4) |
| 1271 |
\end{verbatim} |
| 1272 |
which inserts the 2-nd entry in the 0-th \textsc{penalty} table, then |
| 1273 |
the 4-th entry in the 0-th \textsc{glue} table. |
| 1274 |
|
| 1275 |
The \textsc{label} instruction used in \PL\ files has a variant called |
| 1276 |
\textsc{clabel}, which means that several characters are using the same |
| 1277 |
lig-kern entry. It is this technique that allows \texttt{ovp2ovf} |
| 1278 |
to cluster the characters with similar properties, otherwise each would |
| 1279 |
point to a different lig-kern entry. |
| 1280 |
|
| 1281 |
Our example shows how East Asian fonts might be coded. The |
| 1282 |
equivalence class of a character has three possible values: 1~for |
| 1283 |
`left' characters (opening parenthesis, opening quote, etc.), |
| 1284 |
2~for `middle' or ordinary characters, |
| 1285 |
and 3~for `right' characters |
| 1286 |
(closing parenthesis, closing quote, period, etc.). |
| 1287 |
Here is the lig-kern table. |
| 1288 |
\begin{verbatim} |
| 1289 |
(LIGTABLE |
| 1290 |
(CLABEL H 1) |
| 1291 |
(CPENGLUE H 1 H 0 H 0) |
| 1292 |
(CPENGLUE H 2 H 0 H 0) |
| 1293 |
(CPENGLUE H 3 H 0 H 0) |
| 1294 |
(STOP) |
| 1295 |
(CLABEL H 2) |
| 1296 |
(CGLUE H 1 H 0) |
| 1297 |
(CGLUE H 2 H 0) |
| 1298 |
(CPENGLUE H 3 H 0 H 0) |
| 1299 |
(STOP) |
| 1300 |
(CLABEL H 2) |
| 1301 |
(CGLUE H 1 H 0) |
| 1302 |
(CGLUE H 2 H 0) |
| 1303 |
(CPENGLUE H 3 H 0 H 0) |
| 1304 |
(STOP) |
| 1305 |
\end{verbatim} |
| 1306 |
Glue is inserted between all pairs of characters that are of category 1, |
| 1307 |
2, or~3. In addition, a penalty is added in front of characters of |
| 1308 |
category 3 (`right' characters), preventing a linebreak just prior to |
| 1309 |
such characters. At the same time, a penalty is added after all |
| 1310 |
occurrences of characters of category~1 (`left' characters). |
| 1311 |
|
| 1312 |
Another possibility is to completely replace the lig-kern table, |
| 1313 |
with the instruction |
| 1314 |
\[ |
| 1315 |
\begin{array}{ll} |
| 1316 |
\bigl(\texttt{LIGTABLEOCP} & \showligocp\bigr)\\ |
| 1317 |
\end{array} |
| 1318 |
\] |
| 1319 |
Here the \OCP\ $\showligocp$ will be used instead of the lig-kern |
| 1320 |
table. |
| 1321 |
|
| 1322 |
\subsection{Level-1 \OVF\ files} |
| 1323 |
|
| 1324 |
The level-1 \OVF\ files are indistinguishable from level-0 |
| 1325 |
\OVF\ files. |
| 1326 |
|
| 1327 |
\subsection{Level-1 \OVP\ files} |
| 1328 |
|
| 1329 |
The level-1 \OVP\ files are similar to level-1 \OPL\ files for |
| 1330 |
the description of the tables. For the actual character layout |
| 1331 |
stuff, there is no difference with level-0 \OVP\ files. |
| 1332 |
|
| 1333 |
\section{\OMEGA\ Translation Processes} |
| 1334 |
\label{lab:otps} |
| 1335 |
|
| 1336 |
The changes described above are very useful, and allow the resolution |
| 1337 |
of several problems. However, they do not radically alter the |
| 1338 |
structure of \TeX. This is not the case for the \OMEGA\ Translation |
| 1339 |
Processes, which allow text to be passed through any number of finite |
| 1340 |
state automata, in order to impose the required effects. |
| 1341 |
|
| 1342 |
These processes are necessary for translating one character set to |
| 1343 |
another. They are also used to choose the various forms of letters in |
| 1344 |
Arabic, or to create consonental clusters in Khmer, or to rearrange |
| 1345 |
letter order in Indic scripts. They could also offer alternative |
| 1346 |
means of changing texts to upper or lower case or to hyphenate texts. |
| 1347 |
|
| 1348 |
Each translation process is placed in a file with the suffix \verb|.otp|. |
| 1349 |
Its syntax is similar but not identical to a \texttt{lex} or |
| 1350 |
\texttt{flex} file on Unix. Examples of translation processes can |
| 1351 |
be found in the \texttt{texmf/omega/otp} directory. |
| 1352 |
|
| 1353 |
An \verb|.otp| file defines a finite state automaton that transforms |
| 1354 |
an input character stream into an output character stream. |
| 1355 |
It consists of six parts: |
| 1356 |
|
| 1357 |
\begin{tabular}{l} |
| 1358 |
\emph{Input}\\ |
| 1359 |
\emph{Output}\\ |
| 1360 |
\emph{Tables}\\ |
| 1361 |
\emph{States}\\ |
| 1362 |
\emph{Aliases}\\ |
| 1363 |
\emph{Expressions}\\ |
| 1364 |
\end{tabular} |
| 1365 |
|
| 1366 |
\noindent |
| 1367 |
where the \emph{Expressions} actually state what translations take |
| 1368 |
place and in what situation. |
| 1369 |
|
| 1370 |
In what follows, $n$ refers to a positive integer between 0~and |
| 1371 |
$2^{24}-1$. It can be given in decimal form, octal form (preceded by |
| 1372 |
\texttt{@'}) or hexadecimal form (preceded by \texttt{@"}). |
| 1373 |
Hexadecimal numbers can use both minuscule and majuscule letters |
| 1374 |
to express the digits~\emph{a--f}. Numbers can also be given in |
| 1375 |
character form: a printable \textsc{ascii} character, when placed |
| 1376 |
inside a pair of quotes, generates the \textsc{ascii} code for that |
| 1377 |
character. For example, \verb|`a'| is equivalent to~\verb|@"61|. |
| 1378 |
|
| 1379 |
The \emph{Input} part states how many octets are in each input character. |
| 1380 |
If the section is empty, then the default value is~2, since we hope |
| 1381 |
that Unicode will become the standard means of communication in the future. |
| 1382 |
If the section is not empty, it must be of the form |
| 1383 |
\[ \mymathtt{input:}\;\mymathit{in}\mymathtt{;} \] |
| 1384 |
where \emph{in} states how many octets are in each input character. |
| 1385 |
|
| 1386 |
The \emph{Output} part states how many octets are in each output character. |
| 1387 |
If the section is empty, then the default value is~2, since we hope |
| 1388 |
that Unicode will become the standard means of communication in the future. |
| 1389 |
If the section is not empty, it must be of the form |
| 1390 |
\[ \mymathtt{output:}\;\mymathit{out}\mymathtt{;} \] |
| 1391 |
where \emph{out} states how many octets are in each output character. |
| 1392 |
|
| 1393 |
The \emph{Tables} part is used for defining tables that will be |
| 1394 |
referred to later in the expressions. Often, translations from one |
| 1395 |
character set to another are most efficiently presented through table |
| 1396 |
lookup. This section can be empty, in which case no tables have been |
| 1397 |
defined. If it is not empty, it is of the form |
| 1398 |
\[ \mymathtt{tables:}\; \mymathit{table}^+ \] |
| 1399 |
where each \emph{table} is of the form |
| 1400 |
\[ \mymathit{id}\mymathtt{[}n\mymathtt{]}\;\mymathtt{=}\; |
| 1401 |
\mymathtt{\char'173}n^+\mymathtt{\char'175}\mymathtt{;} \] |
| 1402 |
where the numbers in $n^+$ are comma-separated. |
| 1403 |
|
| 1404 |
The \emph{States} part is used to separate out the expressions. Not |
| 1405 |
all expressions will necessarily be applicable in all situations. |
| 1406 |
To do this, the user can name states and identify expressions with |
| 1407 |
state names, in order to express what expressions apply when. |
| 1408 |
This section can be empty, in which case there is only one state. If |
| 1409 |
it is not empty, it is of the form |
| 1410 |
\[ \mymathtt{states:}\; \mymathit{id}^+\mymathtt{;} \] |
| 1411 |
where the identifiers in $\mymathit{id}^+$ are comma-separated. |
| 1412 |
|
| 1413 |
The \emph{Aliases} part is used to simplify the definition of the left |
| 1414 |
hand sides of the expressions. Each expression consists of a |
| 1415 |
left-hand side, in the form of a simplified regular expression, and of a |
| 1416 |
right-hand side, which states what should be done with a recognized |
| 1417 |
string. To simplify the definitions of the left-hand sides, |
| 1418 |
aliases can be used. This section can be empty, in which case there |
| 1419 |
are no aliases. If it is not empty, it is of the form |
| 1420 |
\[ \mymathtt{aliases:}\; \mymathit{alias}^+ \] |
| 1421 |
where each \emph{alias} is of the form |
| 1422 |
\[ \mymathit{id}\;\mymathtt{=}\;\mymathit{left}\mymathtt{;}\] |
| 1423 |
and \emph{left} is defined below. |
| 1424 |
|
| 1425 |
The \emph{Expressions} part is the very reason for an \verb|.otp| |
| 1426 |
file. It states what translations must take place, and when. It |
| 1427 |
cannot be empty, and its syntax is |
| 1428 |
\[ \mymathtt{expressions:}\; \mymathit{expr}^+ \] |
| 1429 |
Each \emph{expr} is of the form |
| 1430 |
\[ |
| 1431 |
\mymathit{leftState}\; \mymathit{totalLeft}\; |
| 1432 |
\mymathit{right} \; \mymathit{pushBack} \; \mymathit{rightState} \mymathtt{;} |
| 1433 |
\] |
| 1434 |
where \emph{leftState} defines the state for which this expression is |
| 1435 |
applicable, \emph{totalLeft} defines the left-hand-side regular |
| 1436 |
expression, \emph{right} defines the characters to be output, |
| 1437 |
\emph{pushBack} states what characters must be added to the input |
| 1438 |
stream and \emph{rightState} gives the new state. |
| 1439 |
|
| 1440 |
Intuitively, if the automaton is in macro-state \emph{leftState} and |
| 1441 |
the regular expression \emph{totalLeft} corresponds to a prefix of the current |
| 1442 |
input stream, then (1)~the input stream is advanced to the end of the recognized |
| 1443 |
prefix, (2)~the characters generated by the \emph{right} |
| 1444 |
expression are put onto the output stream, (3)~the characters |
| 1445 |
generated by the \emph{pushBack} stream are placed at the beginning |
| 1446 |
of the input stream and (4)~the system changes to the macro-state |
| 1447 |
defined by \emph{rightState}. |
| 1448 |
|
| 1449 |
The \emph{leftState} field can be empty. If it is not, its syntax is |
| 1450 |
\[ \mymathtt{<} \mymathit{id} \mymathtt{>} \] |
| 1451 |
|
| 1452 |
The syntax for \emph{totalLeft} is |
| 1453 |
\[ \mymathtt{beg:}? \; \mymathit{left}^+ \; \mymathtt{end:}? \] |
| 1454 |
The \texttt{beg:}, if present, will only match the string if it is |
| 1455 |
at the beginning of the input. The \texttt{end:}, if present, will |
| 1456 |
only match the string if it is at the end of the input. |
| 1457 |
|
| 1458 |
The syntax for \emph{left} is given by |
| 1459 |
\begin{eqnarray*} |
| 1460 |
\mymathit{left} & ::= & n\\ |
| 1461 |
& \mid & n\mymathtt{-}n\\ |
| 1462 |
& \mid & \mymathtt{.}\\ |
| 1463 |
& \mid & \mymathtt{(}\mymathit{left}^+\mymathtt{)}\\ |
| 1464 |
& \mid & \mymathtt{\char94(}\mymathit{left}^+\mymathtt{)}\\ |
| 1465 |
& \mid & \{\mymathit{id}\}\\ |
| 1466 |
& \mid & \mymathit{left}\;\mymathtt{<}n\mymathtt{,}n?\mymathtt{>}\\ |
| 1467 |
\end{eqnarray*} |
| 1468 |
where the $\mymathit{left}^+$ means a series of \emph{left} separated |
| 1469 |
by vertical bars. Therefore, $n$ means a single number, $n\mymathtt{-}n$ is a |
| 1470 |
range, $\mymathtt{.}$~is a wildcard character, |
| 1471 |
$\mymathtt{(}\mymathit{left}^+\mymathtt{)}$ is a choice, |
| 1472 |
$\mymathtt{\char94(}\mymathit{left}^+\mymathtt{)}$ is the negation of a choice, |
| 1473 |
$\mymathtt{\char'173}\mymathit{id}\mymathtt{\char'175}$ |
| 1474 |
is the use of an alias and |
| 1475 |
$\mymathit{left}\mymathtt{<}n\mymathtt{,}n?\mymathtt{>}$ |
| 1476 |
means between $n$~and $n'$~occurrences of \emph{left}. Should there |
| 1477 |
be no~$n'$, then the expression means at least $n$~occurrences. |
| 1478 |
|
| 1479 |
The syntax for \emph{right} is |
| 1480 |
\[ \mymathtt{=>}\; \mymathit{stringExpr}^+ \] |
| 1481 |
while that for \emph{pushBack}, if it is not empty, is |
| 1482 |
\[ \mymathtt{<=}\; \mymathit{stringExpr}^+ \] |
| 1483 |
The \emph{right} expression corresponds to the characters that are to |
| 1484 |
be output. The \emph{pushBack} expression corresponds to the |
| 1485 |
characters that are put back onto the input stream. |
| 1486 |
|
| 1487 |
A \emph{stringExpr} defines a string of characters, using the |
| 1488 |
characters in the recognized input stream as arguments. It is of the form |
| 1489 |
|
| 1490 |
\begin{tabular}{ll} |
| 1491 |
& $s$\\ |
| 1492 |
$\mid$ & $n$\\ |
| 1493 |
$\mid$ & \verb|\|$n$\\ |
| 1494 |
$\mid$ & \verb|\$|\\ |
| 1495 |
$\mid$ & \verb|\($-|$n$\verb|)|\\ |
| 1496 |
$\mid$ & \verb|\*|\\ |
| 1497 |
$\mid$ & \verb|\(*-|$n$\verb|)|\\ |
| 1498 |
$\mid$ & \verb|\(*+|$n$\verb|)|\\ |
| 1499 |
$\mid$ & \verb|\(*+|$n$\verb|-|$n'$\verb|)|\\ |
| 1500 |
$\mid$ & \verb|#|\emph{arithExpr}\\ |
| 1501 |
\end{tabular} |
| 1502 |
|
| 1503 |
\noindent |
| 1504 |
where $s$~is an \textsc{ascii} character string enclosed in double |
| 1505 |
quotation marks. |
| 1506 |
The \verb|\|$n$ means the $n$-th character (starting from 1) |
| 1507 |
in the recognized prefix; the \verb|\$| means the last character in the |
| 1508 |
prefix; \verb|\($-|$n$\verb|)| the $n$-th, counting from the end. |
| 1509 |
The \verb|\*| means the entire recognized prefix; |
| 1510 |
\verb|\(*-|$n$\verb|)| the prefix without the last $n$~characters; |
| 1511 |
\verb|\(*+|$n$\verb|)| without the first $n$~characters; |
| 1512 |
\verb|\(*+|$n$\verb|-|$n'$\verb|)| removes the first~$n$ and last~$n'$ |
| 1513 |
characters. |
| 1514 |
|
| 1515 |
For example, Indic scripts are encoded with vowels at the end of a |
| 1516 |
syllable, but the vowel is actually printed first on the page. Up |
| 1517 |
to six consonants can precede a vowel, yielding the following |
| 1518 |
transliteration: |
| 1519 |
\begin{verbatim} |
| 1520 |
{consonant}<1,6> {vowel} => \$ \(*-1); |
| 1521 |
\end{verbatim} |
| 1522 |
|
| 1523 |
The \emph{arithExpr} entry allows for calculations to actually be |
| 1524 |
effected on the characters in the prefix. Their syntax is as follows: |
| 1525 |
|
| 1526 |
\begin{tabular}{ll} |
| 1527 |
& $n$\\ |
| 1528 |
$\mid$ & \verb|\|$n$\\ |
| 1529 |
$\mid$ & \verb|\$|\\ |
| 1530 |
$\mid$ & \verb|\($-|$n$\verb|)|\\ |
| 1531 |
$\mid$ & \emph{arithExpr}\verb| + |\emph{arithExpr}\\ |
| 1532 |
$\mid$ & \emph{arithExpr}\verb| - |\emph{arithExpr}\\ |
| 1533 |
$\mid$ & \emph{arithExpr}\verb| * |\emph{arithExpr}\\ |
| 1534 |
$\mid$ & \emph{arithExpr}\verb| div: |\emph{arithExpr}\\ |
| 1535 |
$\mid$ & \emph{arithExpr}\verb| mod: |\emph{arithExpr}\\ |
| 1536 |
$\mid$ & \emph{id}\verb|[|\emph{arithExpr}\verb|]|\\ |
| 1537 |
$\mid$ & \verb|(|\emph{arithExpr}\verb|)|\\ |
| 1538 |
\end{tabular} |
| 1539 |
|
| 1540 |
\noindent |
| 1541 |
where \emph{id}\verb|[|\emph{arithExpr}\verb|]| means a table lookup: |
| 1542 |
the \emph{id} must be a table defined in the \emph{Tables} section. |
| 1543 |
The other operations should be clear. |
| 1544 |
|
| 1545 |
The following example shows the use of tables. |
| 1546 |
\label{gb:unicode} |
| 1547 |
\begin{verbatim} |
| 1548 |
% File inbig5.otp |
| 1549 |
% Conversion to Unicode from Chinese Big 5 (HKU) |
| 1550 |
% Copyright (c) 1995 John Plaice and Yannis Haralambous |
| 1551 |
% This file is part of the Omega project. |
| 1552 |
% |
| 1553 |
% This file was derived from data in the tcs program |
| 1554 |
% ftp://plan9.att.com/plan9/unixsrc/tcs.shar.Z, 16 November 1994 |
| 1555 |
% |
| 1556 |
|
| 1557 |
input: 1; |
| 1558 |
output: 2; |
| 1559 |
|
| 1560 |
tables: |
| 1561 |
|
| 1562 |
in_big5_a1[@"9d] = { |
| 1563 |
@"20, @"2c, @"2ce, @"2e, @"2219, @"2219, @"3b, @"3a, |
| 1564 |
... |
| 1565 |
@"2199, @"2198, @"2225, @"2223, @"2215 |
| 1566 |
}; |
| 1567 |
|
| 1568 |
in_big5[@"3695] = { |
| 1569 |
@"3000, @"ff0c, @"3001, @"3002, @"ff0e, @"30fb, @"ff1b, @"ff1a, |
| 1570 |
... |
| 1571 |
@"fffd, @"fffd, @"fffd, @"fffd, @"fffd |
| 1572 |
}; |
| 1573 |
|
| 1574 |
expressions: |
| 1575 |
|
| 1576 |
@"1a => @"0a; |
| 1577 |
@"00-@"a0 => \1; |
| 1578 |
@"a1(@"40-@"7e) => #(in_big5_a1[\2-@"40]); |
| 1579 |
@"a1(@"a1-@"fe) => #(in_big5_a1[\2-@"62]); |
| 1580 |
(@"a2-@"fe)(@"40-@"7e) => #(in_big5[(\1-@"a2)*@"9d + \2-@"40]); |
| 1581 |
(@"a2-@"fe)(@"a1-@"fe) => #(in_big5[(\1-@"a2)*@"9d + \2-@"62]); |
| 1582 |
. . => @"fffd; |
| 1583 |
\end{verbatim} |
| 1584 |
|
| 1585 |
In the future, more operations may well be added. Research is still |
| 1586 |
under way for such things as providing means for defining functions, |
| 1587 |
local variables, error handling and other functionality. |
| 1588 |
|
| 1589 |
The \emph{pushBack} part, which serves to put characters back onto the |
| 1590 |
input stream, uses the same syntax as the \emph{right} part. When |
| 1591 |
characters are placed back onto the input stream, they will be looked |
| 1592 |
at upon the next iteration of the automaton. |
| 1593 |
|
| 1594 |
Finally, the \emph{rightState} can be empty or one of the following |
| 1595 |
three forms: |
| 1596 |
|
| 1597 |
\begin{tabular}{ll} |
| 1598 |
& \verb|<|\emph{id}\verb|>|\\ |
| 1599 |
$\mid$ & \verb|<push: |\emph{id}\verb|>|\\ |
| 1600 |
$\mid$ & \verb|<pop:>|\\ |
| 1601 |
\end{tabular} |
| 1602 |
|
| 1603 |
\noindent |
| 1604 |
If it is empty, the automaton stays in the same state. |
| 1605 |
If it is of the form \verb|<|\emph{id}\verb|>|, then the automaton |
| 1606 |
changes to state~\emph{id}. The \verb|<push: |\emph{id}\verb|>| |
| 1607 |
means change to state~\emph{id}, but remembering the current state. |
| 1608 |
The \verb|<pop:>| means return to the previously saved state. |
| 1609 |
|
| 1610 |
Several \texttt{.otp} files are in the |
| 1611 |
\texttt{omega/texmf/otp} directory. |
| 1612 |
The \texttt{char2uni} directory contains \OTP s that |
| 1613 |
convert national character sets to Unicode, while the |
| 1614 |
\texttt{omega} directory contains \OTP s designed to work |
| 1615 |
with the \OMEGA\ fonts. |
| 1616 |
|
| 1617 |
\section{Compiled Translation Processes} |
| 1618 |
|
| 1619 |
\OMEGA\ does not know anything about \OMEGA\ Translation Processes. |
| 1620 |
It actually reads a compiled form of these filters, known as |
| 1621 |
Compiled Translation Processes (file suffix \texttt{.ocp}). |
| 1622 |
Essentially, the \OCP s can be considered to be portable assembler |
| 1623 |
programs, and \OMEGA\ includes an interpreter for the generated |
| 1624 |
instructions. |
| 1625 |
|
| 1626 |
The command for reading in a \OCP\ file is similar to a font |
| 1627 |
declaration. The example |
| 1628 |
\begin{verbatim} |
| 1629 |
\ocp\TexUni=TeXArabicToUnicode |
| 1630 |
\end{verbatim} |
| 1631 |
means that the file \verb|TeXArabicToUnicode.ocp| is read |
| 1632 |
in by~\OMEGA\ and that internally the translation process is |
| 1633 |
referred to as \verb|\TeXUni|. |
| 1634 |
|
| 1635 |
The \OCP s consist of a sequence of 4-octet words. The first seven |
| 1636 |
words have the following form: |
| 1637 |
|
| 1638 |
\begin{tabular}{ll} |
| 1639 |
\emph{lf}&length of the entire file, in words;\\ |
| 1640 |
\emph{in}&number of octets in an input character;\\ |
| 1641 |
\emph{ot}&number of octets in an output character;\\ |
| 1642 |
\emph{nt}&number of tables;\\ |
| 1643 |
\emph{lt}&number of words allocated for tables;\\ |
| 1644 |
\emph{ns}&number of states;\\ |
| 1645 |
\emph{ls}&number of words allocated for states;\\ |
| 1646 |
\end{tabular} |
| 1647 |
|
| 1648 |
\noindent |
| 1649 |
The header words are followed by four arrays: |
| 1650 |
\begin{eqnarray*} |
| 1651 |
\mathit{table\_length} & : & |
| 1652 |
\mathbf{array} \; [0..\mathit{nt}-1] \; \mathbf{of} \; \mathit{word}\\ |
| 1653 |
\mathit{tables} & : & |
| 1654 |
\mathbf{array} \; [0..\mathit{lt}-1] \; \mathbf{of} \; \mathit{word}\\ |
| 1655 |
\mathit{state\_length} & : & |
| 1656 |
\mathbf{array} \; [0..\mathit{ns}-1] \; \mathbf{of} \; \mathit{word}\\ |
| 1657 |
\mathit{tables} & : & |
| 1658 |
\mathbf{array} \; [0..\mathit{ls}-1] \; \mathbf{of} \; \mathit{word} |
| 1659 |
\end{eqnarray*} |
| 1660 |
|
| 1661 |
The \emph{table\_length} array states how many words are used for each |
| 1662 |
of the tables in the~\OCP. For the GB~$\rightarrow$~Unicode example on |
| 1663 |
page~\pageref{gb:unicode}, the \emph{table\_length} would have two |
| 1664 |
entries: hex values \texttt{9d} and~\texttt{3695}. |
| 1665 |
|
| 1666 |
The \emph{tables} array is simply the concatenation of the tables in |
| 1667 |
the \OTP\ file. |
| 1668 |
|
| 1669 |
The \emph{state\_length} array states how many words are used for each |
| 1670 |
of the states in the~\OCP. For the GB~$\rightarrow$~Unicode example on |
| 1671 |
page~\pageref{gb:unicode}, the \emph{state\_length} would have one |
| 1672 |
entry. |
| 1673 |
|
| 1674 |
The \emph{states} array is simply the concatenation of the sequence of |
| 1675 |
instructions for each state in the \OTP\ file. Each instruction takes |
| 1676 |
one or two 4-octet words. Zero- and one-argument instructions use |
| 1677 |
one word. If the instruction consists of one word, |
| 1678 |
then the actual instruction is in the first two octets and the |
| 1679 |
argument is in the last two octets. If the instruction consists of |
| 1680 |
two words, then the actual instruction is in the first two octets, |
| 1681 |
the first argument is in the next two octets and the last argument is |
| 1682 |
in the last two octets. The instructions are as follows: |
| 1683 |
|
| 1684 |
\begin{tabbing} |
| 1685 |
\makebox[1cm][r]{99} \= \quad \verb|OTP_GOTO_NO_ADVANCE| \= \quad 2 arguments\kill |
| 1686 |
\makebox[1cm][r]{1} \> \quad \verb|OTP_RIGHT_OUTPUT| \> \quad 0 arguments\\ |
| 1687 |
\makebox[1cm][r]{2} \> \quad \verb|OTP_RIGHT_NUM| \> \quad 1 argument\\ |
| 1688 |
\makebox[1cm][r]{3} \> \quad \verb|OTP_RIGHT_CHAR| \> \quad 1 argument\\ |
| 1689 |
\makebox[1cm][r]{4} \> \quad \verb|OTP_RIGHT_LCHAR| \> \quad 1 argument\\ |
| 1690 |
\makebox[1cm][r]{5} \> \quad \verb|OTP_RIGHT_SOME| \> \quad 2 arguments\\ |
| 1691 |
\\ |
| 1692 |
\makebox[1cm][r]{6} \> \quad \verb|OTP_PBACK_OUTPUT| \> \quad 0 arguments\\ |
| 1693 |
\makebox[1cm][r]{7} \> \quad \verb|OTP_PBACK_NUM| \> \quad 1 argument\\ |
| 1694 |
\makebox[1cm][r]{8} \> \quad \verb|OTP_PBACK_CHAR| \> \quad 1 argument\\ |
| 1695 |
\makebox[1cm][r]{9} \> \quad \verb|OTP_PBACK_LCHAR| \> \quad 1 argument\\ |
| 1696 |
\makebox[1cm][r]{10} \> \quad \verb|OTP_PBACK_SOME| \> \quad 2 arguments\\ |
| 1697 |
\\ |
| 1698 |
\makebox[1cm][r]{11} \> \quad \verb|OTP_ADD| \> \quad 0 arguments\\ |
| 1699 |
\makebox[1cm][r]{12} \> \quad \verb|OTP_SUB| \> \quad 0 arguments\\ |
| 1700 |
\makebox[1cm][r]{13} \> \quad \verb|OTP_MULT| \> \quad 0 arguments\\ |
| 1701 |
\makebox[1cm][r]{14} \> \quad \verb|OTP_DIV| \> \quad 0 arguments\\ |
| 1702 |
\makebox[1cm][r]{15} \> \quad \verb|OTP_MOD| \> \quad 0 arguments\\ |
| 1703 |
\makebox[1cm][r]{16} \> \quad \verb|OTP_LOOKUP| \> \quad 0 arguments\\ |
| 1704 |
\makebox[1cm][r]{17} \> \quad \verb|OTP_PUSH_NUM| \> \quad 1 argument\\ |
| 1705 |
\makebox[1cm][r]{18} \> \quad \verb|OTP_PUSH_CHAR| \> \quad 1 argument\\ |
| 1706 |
\makebox[1cm][r]{19} \> \quad \verb|OTP_PUSH_LCHAR| \> \quad 1 argument\\ |
| 1707 |
\\ |
| 1708 |
\makebox[1cm][r]{20} \> \quad \verb|OTP_STATE_CHANGE| \> \quad 1 argument\\ |
| 1709 |
\makebox[1cm][r]{21} \> \quad \verb|OTP_STATE_PUSH| \> \quad 1 argument\\ |
| 1710 |
\makebox[1cm][r]{22} \> \quad \verb|OTP_STATE_POP| \> \quad 1 argument\\ |
| 1711 |
\\ |
| 1712 |
\makebox[1cm][r]{23} \> \quad \verb|OTP_LEFT_START| \> \quad 0 arguments\\ |
| 1713 |
\makebox[1cm][r]{24} \> \quad \verb|OTP_LEFT_RETURN| \> \quad 0 arguments\\ |
| 1714 |
\makebox[1cm][r]{25} \> \quad \verb|OTP_LEFT_BACKUP| \> \quad 0 arguments\\ |
| 1715 |
\\ |
| 1716 |
\makebox[1cm][r]{26} \> \quad \verb|OTP_GOTO| \> \quad 1 argument\\ |
| 1717 |
\makebox[1cm][r]{27} \> \quad \verb|OTP_GOTO_NE| \> \quad 2 arguments\\ |
| 1718 |
\makebox[1cm][r]{28} \> \quad \verb|OTP_GOTO_EQ| \> \quad 2 arguments\\ |
| 1719 |
\makebox[1cm][r]{29} \> \quad \verb|OTP_GOTO_LT| \> \quad 2 arguments\\ |
| 1720 |
\makebox[1cm][r]{30} \> \quad \verb|OTP_GOTO_LE| \> \quad 2 arguments\\ |
| 1721 |
\makebox[1cm][r]{31} \> \quad \verb|OTP_GOTO_GT| \> \quad 2 arguments\\ |
| 1722 |
\makebox[1cm][r]{32} \> \quad \verb|OTP_GOTO_GE| \> \quad 2 arguments\\ |
| 1723 |
\makebox[1cm][r]{33} \> \quad \verb|OTP_GOTO_NO_ADVANCE| \> \quad 1 argument\\ |
| 1724 |
\makebox[1cm][r]{34} \> \quad \verb|OTP_GOTO_BEG| \> \quad 1 argument\\ |
| 1725 |
\makebox[1cm][r]{35} \> \quad \verb|OTP_GOTO_END| \> \quad 1 argument\\ |
| 1726 |
\makebox[1cm][r]{36} \> \quad \verb|OTP_STOP| \> \quad 0 arguments\\ |
| 1727 |
\end{tabbing} |
| 1728 |
|
| 1729 |
The \verb|OTP_LEFT|, \verb|OTP_GOTO| and \verb|OTP_STOP| instructions |
| 1730 |
are used for recognizing prefixes in an input stream. The \verb|OTP_RIGHT| |
| 1731 |
instructions place characters on the output stream, while the |
| 1732 |
\verb|OTP_PBACK| instructions place characters back onto the input |
| 1733 |
stream. The instructions \verb|OTP_ADD| through to |
| 1734 |
\verb|OTP_PUSH_LCHAR| are used for internal computations in preparation |
| 1735 |
for \verb|OTP_RIGHT| or \verb|OTP_PBACK| instructions. Finally, the |
| 1736 |
\verb|OTP_STATE| instructions are for changing macro-states. |
| 1737 |
|
| 1738 |
The system that reads from the input stream uses two pointers, which |
| 1739 |
we will call \emph{first} and \emph{last}. The \emph{first} value |
| 1740 |
points to the beginning of the input prefix that is currently being |
| 1741 |
identified. The \emph{last} value points to the end of the input |
| 1742 |
prefix that has been read. When a prefix has been recognized, then |
| 1743 |
\emph{first} points to~\verb|\1| and \emph{last} points to~\verb|\$|. |
| 1744 |
|
| 1745 |
The \verb|OTP_LEFT_START| instruction, called at the beginning of |
| 1746 |
the parsing of a prefix, advances \emph{first} to $\emph{last}+1$; |
| 1747 |
\verb|OTP_LEFT_RETURN| resets the \emph{last} value to |
| 1748 |
$\emph{first}-1$ (it is called when a particular \emph{left} pattern |
| 1749 |
does not correspond to the prefix); \verb|OTP_LEFT_BACKUP| backs up |
| 1750 |
the \emph{last} pointer by~1. |
| 1751 |
|
| 1752 |
Internally, a \OCP\ program uses a program counter (PC), which is simply an |
| 1753 |
index into the appropriate state array. Like for all assembler |
| 1754 |
programs, this counter is normally incremented by 1 or~2, depending on |
| 1755 |
the size of the instruction, but it can be abruptly changed through |
| 1756 |
an \verb|OTP_GOTO| instruction. |
| 1757 |
|
| 1758 |
The argument in single-argument \verb|OTP_GOTO| instructions is the |
| 1759 |
new~PC. For the two-argument instructions, the first is the comparand |
| 1760 |
and the second is the new~PC should the test succeed. The |
| 1761 |
\verb|OTP_GOTO| instruction itself is an unconditional branch; |
| 1762 |
\verb|OTP_GOTO_NO_ADVANCE| advances \emph{last} by~1, and branches if |
| 1763 |
has reached the end of input; \verb|OTP_GOTO_BEG| branches at the |
| 1764 |
beginning of input and \verb|OTP_GOTO_END| branches at the end of |
| 1765 |
input. As for \verb|OTP_GOTO_|\emph{cond}, it succeeds if the |
| 1766 |
character pointed to by \emph{last} (we'll call it |
| 1767 |
\verb|*|\emph{last}) satisfies the test |
| 1768 |
\emph{cond}(\verb|*|\emph{last}, \emph{firstArg}). |
| 1769 |
|
| 1770 |
The \verb|OTP_STOP| instruction stops processing of the currently |
| 1771 |
recognized prefix. Normally the automaton will be restarted with an |
| 1772 |
\verb|OTP_LEFT_START| instruction. |
| 1773 |
|
| 1774 |
When computations are undertaken for the \verb|OTP_RIGHT| and |
| 1775 |
\verb|OTP_PBACK| instructions, a computation stack is used. |
| 1776 |
This stack is accessed through instructions \verb|OTP_ADD| through |
| 1777 |
to \verb|OTP_PUSH_LCHAR|, as well as through the instructions |
| 1778 |
\verb|OTP_RIGHT_OUTPUT| and \verb|OTP_PBACK_OUTPUT|. |
| 1779 |
|
| 1780 |
Since the \verb|OTP_RIGHT| and \verb|OTP_PBACK| instructions are |
| 1781 |
analogous, only the former are described. |
| 1782 |
The \verb|OTP_RIGHT_OUTPUT| instruction pops a value of the top of the |
| 1783 |
stack and outputs it; \verb|OTP_RIGHT_NUM|$(n$) simply places $n$ |
| 1784 |
on the output stream; \verb|OTP_RIGHT_CHAR|$(n)$ places the $n$-th input |
| 1785 |
character on the output stream; \verb|OTP_RIGHT_LCHAR| does the same, |
| 1786 |
but from the back; finally, \verb|OTP_RIGHT_SOME| places a substring |
| 1787 |
onto the output stream. |
| 1788 |
|
| 1789 |
Three instructions are used for placing values on the stack: |
| 1790 |
\verb|OTP_PUSH_NUM|$(n)$ pushes $n$ onto the stack, |
| 1791 |
\verb|OTP_PUSH_CHAR|$(n)$ pushes the $n$-th character and |
| 1792 |
\verb|OTP_PUSH_LCHAR|$(n)$ does the same from the end. |
| 1793 |
|
| 1794 |
The arithmetic operations of the form \verb|OTP_|\emph{op} apply the |
| 1795 |
operation |
| 1796 |
\begin{eqnarray*} |
| 1797 |
\mathit{stack}[\mathit{top}-1] & := & |
| 1798 |
\mathit{stack}[\mathit{top}-1] \; \mathit{op} \; |
| 1799 |
\mathit{stack}[\mathit{top}] |
| 1800 |
\end{eqnarray*} |
| 1801 |
where \emph{top} is the stack pointer, and then decrement the stack |
| 1802 |
pointer. Finally, the \verb|OTP_LOOKUP| instruction applies the |
| 1803 |
operation |
| 1804 |
\begin{eqnarray*} |
| 1805 |
\mathit{stack}[\mathit{top}-1] & := & |
| 1806 |
\mathit{stack}[\mathit{top}-1][\mathit{stack}[\mathit{top}]] |
| 1807 |
\end{eqnarray*} |
| 1808 |
and then decrements the pointer. |
| 1809 |
|
| 1810 |
Last, but not least, are the \verb|OTP_STATE| instructions, which |
| 1811 |
manipulate a stack of macro-states. The initial state is always~0. |
| 1812 |
The \verb|OTP_STATE_CHANGE|$(n)$ changes the current state |
| 1813 |
state~$n$; \verb|OTP_STATE_PUSH|$(n)$ pushes the current state onto |
| 1814 |
the state stack before changing the current state; |
| 1815 |
\verb|OTP_STATE_POP| pops the state at the top of the state stack into |
| 1816 |
the current state. |
| 1817 |
|
| 1818 |
\section{Translation process lists} |
| 1819 |
|
| 1820 |
Translation processes can be used for a number of different purposes. |
| 1821 |
Since not all uses can be foreseen, we have decided to offer a means |
| 1822 |
to dynamically reconfigure the set of translation processes that are |
| 1823 |
passing over the input text. This is done using stacks of translation |
| 1824 |
process lists. |
| 1825 |
|
| 1826 |
For any single purpose, for example to process a given language, |
| 1827 |
several \OCP s might be required. If one makes a context switch, |
| 1828 |
such as processing a different language, then one would to be able |
| 1829 |
to quickly replace \emph{all} of the \OCP s that are currently being |
| 1830 |
used. This is done using \OCP\ lists. |
| 1831 |
|
| 1832 |
A \OCP\ list is actually a list of pairs. Each pair consists of a |
| 1833 |
positive scaled value and a doubly ended queue of \OCP s. For |
| 1834 |
example, |
| 1835 |
\begin{verbatim} |
| 1836 |
\ocplist\ArabicOCP=[(1.0 : \TexUni,\UniUniTwo,\UniTwoFont)] |
| 1837 |
\end{verbatim} |
| 1838 |
the output from \OMEGA\ once the \OCP\ list \verb|\ArabicOCP| has |
| 1839 |
been typed, shows that that list has one element, namely the pair |
| 1840 |
with the scaled value~1.0 and the doubly ended queue with three |
| 1841 |
\OCP s, \verb|\TexUni|, \verb|\UniUniTwo| and \verb|\UniTwoFont|. |
| 1842 |
|
| 1843 |
\OCP\ lists are built up using the five operators \verb|\nullctlist|, |
| 1844 |
\verb|\addbefore|\-\verb|ocp|\-\verb|list|, \verb|\addafterocplist|, |
| 1845 |
\verb|\removebeforeocplist| and \verb|\removeafter|\-\verb|ocp|\-\verb|list|. |
| 1846 |
For example, the above output was generated by the following |
| 1847 |
sequence of \OMEGA\ statements: |
| 1848 |
\begin{verbatim} |
| 1849 |
\ocp\TexUni=TeXArabicToUnicode |
| 1850 |
\ocp\UniUniTwo=UnicodeToContUnicode |
| 1851 |
\ocp\UniTwoFont=ContUnicodeToTeXArabicOut |
| 1852 |
|
| 1853 |
\ocplist\ArabicOCP= |
| 1854 |
\addbeforeocplist 1 \TexUni |
| 1855 |
\addbeforeocplist 1 \UniUniTwo |
| 1856 |
\addbeforeocplist 1 \UniTwoFont |
| 1857 |
\nullocplist |
| 1858 |
\end{verbatim} |
| 1859 |
|
| 1860 |
The \verb|\ocplist| command is similar to the \verb|\ocp| command:\\ |
| 1861 |
\verb|\ocplist|~\emph{listName}~\verb|=|~\emph{ocpListExpr}. |
| 1862 |
|
| 1863 |
All \emph{ocpListExpr} are built up from either the empty \OCP\ list, |
| 1864 |
\verb|\nullocplist|, or from an already existing \OCP\ list. In the |
| 1865 |
latter case, the list is completely copied, to ensure that the named |
| 1866 |
list is not itself modified. Given a list~$l$, the instruction |
| 1867 |
\verb|\addbeforeocplist|~$n$~\emph{ocp}~$l$ states that the |
| 1868 |
\OCP\ \emph{ocp} is added at the head of the doubly ended queue for |
| 1869 |
value~$n$ in list~$l$. If that queue does not exist, it is created |
| 1870 |
and inserted in the list so that the scaled values are all in |
| 1871 |
increasing order. The instruction |
| 1872 |
\verb|\addafterocplist|~$n$~\emph{ocp}~$l$ does the same, except the |
| 1873 |
addition takes place at the tail of the doubly ended queue. The |
| 1874 |
instruction |
| 1875 |
\verb|\removebeforeocplist|~$n$~$l$ removes the \OCP\ at the head of the |
| 1876 |
doubly ended queue numbered~$n$. The instruction |
| 1877 |
\verb|\removeafterocplist|~$n$~$l$ does the same at the tail of the |
| 1878 |
doubly ended queue. See the next section for more examples. |
| 1879 |
|
| 1880 |
\section{Input Filters} |
| 1881 |
|
| 1882 |
Here we come to the crucial parts of \OMEGA. What happens to the |
| 1883 |
input stream as it passes through translation processes? What is |
| 1884 |
the interaction between \TeX's macro-expansion and \OMEGA's translation |
| 1885 |
processes? |
| 1886 |
|
| 1887 |
When \OMEGA\ is in horizontal mode and it encounters a |
| 1888 |
token of the form |
| 1889 |
\emph{letter}, \emph{other\_char}, \emph{char\_given} or |
| 1890 |
\emph{char\_num}, that character and all the successive |
| 1891 |
characters in those categories are read into a buffer. |
| 1892 |
The currently active \OCP\ is applied to the buffer, and |
| 1893 |
the result is placed back onto the input, to be reread |
| 1894 |
by the standard \TeX\ input routines, including macro |
| 1895 |
expansion. |
| 1896 |
|
| 1897 |
The currently active \OCP\ is designated by a pair $(v,i)$, |
| 1898 |
where $v$~is a scaled value and $i$~is an integer. If all the |
| 1899 |
enabled \OCP s are in a \OCP\ list, then the~$v$ designates the index into |
| 1900 |
the \OCP\ list and the~$i$ designates which element in the $v$-queue is |
| 1901 |
currently active. |
| 1902 |
|
| 1903 |
Once a \OCP\ has been used, the~$i$ is incremented; if it points to the |
| 1904 |
end of the current queue, then $v$~is set to the next queue, and |
| 1905 |
$i$~is reset to~1. |
| 1906 |
|
| 1907 |
When the last enabled \OCP\ has been used, then the standard techniques |
| 1908 |
for treating letters and other characters are used, namely generating |
| 1909 |
paragraphs, etc. |
| 1910 |
|
| 1911 |
What this means is that it is now possible to apply a filter on the |
| 1912 |
\emph{text} of a file without macro-expansion, generate a new text, |
| 1913 |
possibly with macros to be expanded, macro-expand, re-apply filters, |
| 1914 |
etc. All this without active characters, and without breaking macro |
| 1915 |
packages. |
| 1916 |
|
| 1917 |
How are \OCP\ lists enabled? \OCP\ lists are placed on a stack, each |
| 1918 |
numbered queue in a given list masking the queues with the same number |
| 1919 |
for the lists below that one on the stack. |
| 1920 |
|
| 1921 |
There are three commands, which all respect the grouping mechanism. |
| 1922 |
The \verb|\clearocplists| command disables all \OCP\ lists. |
| 1923 |
The \verb|\pushocplist|~\emph{OCPlist} command pushes \emph{OCPlist} |
| 1924 |
onto the stack. The \verb|\popocplist| command pops the last list |
| 1925 |
from the stack. |
| 1926 |
|
| 1927 |
For example, consider the following purely hypothetical situations: |
| 1928 |
\begin{verbatim} |
| 1929 |
\ocplist\FrenchOCP = \addbeforeocplist 1 \ocpA |
| 1930 |
\addbeforeocplist 2 \ocpB |
| 1931 |
\addbeforeocplist 3 \ocpC |
| 1932 |
\nullocplist |
| 1933 |
\end{verbatim} |
| 1934 |
|
| 1935 |
\begin{verbatim} |
| 1936 |
\ocplist\GermanOCP = \addbeforeocplist 1 \ocpD |
| 1937 |
\addbeforeocplist 2 \ocpE |
| 1938 |
\addbeforeocplist 3 \ocpF |
| 1939 |
\nullocplist |
| 1940 |
\end{verbatim} |
| 1941 |
|
| 1942 |
\begin{verbatim} |
| 1943 |
\ocplist\ArabicOCP = \addbeforeocplist 1 \ocpG |
| 1944 |
\addbeforeocplist 2 \ocpH |
| 1945 |
\addbeforeocplist 2 \ocpI |
| 1946 |
\addbeforeocplist 3 \ocpJ |
| 1947 |
\nullocplist |
| 1948 |
\end{verbatim} |
| 1949 |
|
| 1950 |
\begin{verbatim} |
| 1951 |
\ocplist\SpecialArabicOCP = |
| 1952 |
\addafterocplist 3 \ocpK |
| 1953 |
\ArabicOCP |
| 1954 |
\end{verbatim} |
| 1955 |
|
| 1956 |
\begin{verbatim} |
| 1957 |
\ocplist\UpperCaseOCP = |
| 1958 |
\addbeforeocplist 2.5 \ocpL |
| 1959 |
\nullocplist |
| 1960 |
\end{verbatim} |
| 1961 |
There are now 5 \OCP\ lists \emph{defined}, but none of them are |
| 1962 |
\emph{enabled}. The defined lists are: |
| 1963 |
\begin{verbatim} |
| 1964 |
\ocplist\FrenchOCP = |
| 1965 |
[(1.0:\ocpA), (2.0:\ocpB), (3.0:\ocpC)] |
| 1966 |
\ocplist\GermanOCP = |
| 1967 |
[(1.0:\ocpD), (2.0:\ocpE), (3.0:\ocpF)] |
| 1968 |
\ocplist\ArabicOCP = |
| 1969 |
[(1.0:\ocpG), (2.0:\ocpH,\ocpI), (3.0:\ocpJ)] |
| 1970 |
\ocplist\SpecialArabicOCP = |
| 1971 |
[(1.0:\ocpG), (2.0:\ocpH,\ocpI), (3.0:\ocpJ,\ocpK)] |
| 1972 |
\ocplist\UpperCaseOCP = |
| 1973 |
[(2.5:\ocpL)] |
| 1974 |
\end{verbatim} |
| 1975 |
Consider now the sequence of instructions |
| 1976 |
\begin{verbatim} |
| 1977 |
\clearocplists |
| 1978 |
\pushocplist\FrenchOCP |
| 1979 |
\pushocplist\UpperCaseOCP |
| 1980 |
\pushocplist\GermanOCP |
| 1981 |
\popocplist |
| 1982 |
\popocplist |
| 1983 |
\pushocplist\ArabicOCP |
| 1984 |
\pushocplist\SpecialArabicOCP |
| 1985 |
\pushocplist\GermanOCP |
| 1986 |
\end{verbatim} |
| 1987 |
The effective enabled \OCP\ list is, in turn: |
| 1988 |
\begin{verbatim} |
| 1989 |
[] |
| 1990 |
[(1.0:\ocpA), (2.0:\ocpB), (3.0:\ocpC)] |
| 1991 |
[(1.0:\ocpA), (2.0:\ocpB), (2.5:\ocpL), (3.0:\ocpC)] |
| 1992 |
[(1.0:\ocpD), (2.0:\ocpE), (2.5:\ocpL), (3.0:\ocpF)] |
| 1993 |
[(1.0:\ocpA), (2.0:\ocpB), (2.5:\ocpL), (3.0:\ocpC)] |
| 1994 |
[(1.0:\ocpA), (2.0:\ocpB), (3.0:\ocpC)] |
| 1995 |
[(1.0:\ocpG), (2.0:\ocpH,\ocpI), (3.0:\ocpJ)] |
| 1996 |
[(1.0:\ocpG), (2.0:\ocpH,\ocpI), (3.0:\ocpJ,\ocpK)] |
| 1997 |
[(1.0:\ocpD), (2.0:\ocpE), (3.0:\ocpF)] |
| 1998 |
\end{verbatim} |
| 1999 |
|
| 2000 |
The first test of the \OCP\ lists was for Arabic. The text was typed |
| 2001 |
in \textsc{ascii}, using a Latin transliteration. This text was first |
| 2002 |
transformed into Unicode, the official 16-bit encoding for the |
| 2003 |
world's character sets. These letters were then translated into |
| 2004 |
their appropriate visual forms (isolated, initial, medial or final) |
| 2005 |
and then the text was translated into the font encoding. During the |
| 2006 |
second translation, inter-letter black spacing is inserted, since Arabic |
| 2007 |
typesetting calls for word expansion to fill out a line. Here is the |
| 2008 |
input: |
| 2009 |
\begin{verbatim} |
| 2010 |
\font\ARfont=oar10 scaled 1728 offset 256 %% an X-font |
| 2011 |
\def\keshideh{% |
| 2012 |
\begingroup\penalty10000% |
| 2013 |
\clearocplists\xleaders\hbox{\char'767}\hskip0ptplus1fi% |
| 2014 |
\endgroup} |
| 2015 |
\ocp\TexUni=TeXArabicToUnicode |
| 2016 |
\ocp\UniUniTwo=UnicodeToContUnicode |
| 2017 |
\ocp\UniTwoFont=ContUnicodeToTeXArabicOut |
| 2018 |
\ocplist\ArabicOCP=% |
| 2019 |
\addbeforeocplist 1 \TexUni |
| 2020 |
\addbeforeocplist 1 \UniUniTwo |
| 2021 |
\addbeforeocplist 1 \UniTwoFont |
| 2022 |
\nullocplist |
| 2023 |
\def\AR#1{\begingroup\noindent\pushocplist \ArabicOCP% |
| 2024 |
\ARfont\language=255\textdir TRT #1\endgroup} |
| 2025 |
\end{verbatim} |
| 2026 |
Notice that the \verb|\keshideh|, which is dynamically inserted |
| 2027 |
between letters by the \verb|\UniUniTwo| \OCP, uses the \verb|fi| |
| 2028 |
infinity. It also disables all of the \OCP s, within a group. |
| 2029 |
|
| 2030 |
\section{Input and output character sets} |
| 2031 |
|
| 2032 |
In a multilingual, heterogeneous environment, it it inevitable that |
| 2033 |
different files will be written using different character sets. It |
| 2034 |
is even possible that the same file might have different parts that |
| 2035 |
use different character sets. How is it possible to tag |
| 2036 |
these files internally so that \OMEGA\ can read and write differently |
| 2037 |
encoded files in a meaningful manner. |
| 2038 |
|
| 2039 |
After looking at a lot of character sets, we have decided that the |
| 2040 |
vast majority of the world's character sets --- unfortunately not |
| 2041 |
all --- can be categorized into one of the following groups: |
| 2042 |
\begin{itemize} |
| 2043 |
\item \texttt{onebyte} includes all those character sets that include |
| 2044 |
the basic Roman letters, backslash and percent in the same positions |
| 2045 |
as does \textsc{ascii} (\textsc{iso-646}). Hence all the \textsc{iso-8859} |
| 2046 |
character sets, as well as many of the shifted East-Asian sets, |
| 2047 |
such as Shift-\textsc{jis}, are included. |
| 2048 |
\item \texttt{ebcdic} includes all those character sets that include |
| 2049 |
the basic Roman letters, backslash and percent in the same positions |
| 2050 |
as does \textsc{ebcdic-us}. Once again there are shifted character |
| 2051 |
sets that fall into this category. |
| 2052 |
\item \texttt{twobyte} includes all those character sets that include |
| 2053 |
the basic Roman letters, backslash and percent in the same positions |
| 2054 |
as does \textsc{unicode} (\textsc{iso-10646}). |
| 2055 |
\item \texttt{twobyteLE} is the same as \texttt{twobyte}, but in Little |
| 2056 |
Endian order, for ``Microsoft \textsc{unicode}''. |
| 2057 |
\end{itemize} |
| 2058 |
These categories are called \emph{modes}. |
| 2059 |
|
| 2060 |
In \OMEGA, it is assumed that every textual input source and textual output |
| 2061 |
sink has a mode, as well as two translations: one from the character set to |
| 2062 |
the internal encoding, and one from the internal encoding to the character |
| 2063 |
set in question. Normally the internal encoding will be \textsc{unicode}, |
| 2064 |
which means that linguistic information such as hyphenation will only need |
| 2065 |
to be defined once. There are situations in which extra characters will |
| 2066 |
be needed, if the characters or their scripts are not included in |
| 2067 |
\textsc{unicode}, but this will not be the norm. |
| 2068 |
|
| 2069 |
\OMEGA\ has two basic style of input: the old \TeX\ style, or the |
| 2070 |
automatic \OMEGA\ style. |
| 2071 |
In the automatic style, upon opening a file, \OMEGA\ reads the first |
| 2072 |
two octets, and draws the following conclusions: |
| 2073 |
\begin{itemize} |
| 2074 |
\item Hex \texttt{0025} (\textsc{unicode} \verb|%|) |
| 2075 |
or \texttt{005c} (\textsc{unicode} \verb|\|): the mode is \texttt{twobyte}. |
| 2076 |
\item Hex \texttt{2500} (\textsc{unicode} \verb|%|) |
| 2077 |
or \texttt{5c00} (\textsc{unicode} \verb|\|): the mode is \texttt{twobyteLE}. |
| 2078 |
\item Hex \texttt{25} (\textsc{ascii} \verb|%|) |
| 2079 |
or \texttt{5c} (\textsc{ascii} \verb|\|): the mode is \texttt{onebyte}. |
| 2080 |
\item Hex \texttt{6c} (\textsc{ebcdic-us} \verb|%|) |
| 2081 |
or \texttt{e0} (\textsc{ebcdic-us} \verb|\|): the mode is \texttt{ebcdic}. |
| 2082 |
\item If none of these four situations |
| 2083 |
occurs, then the default input mode is assumed. |
| 2084 |
\end{itemize} |
| 2085 |
% |
| 2086 |
Here are the primitives for manipulating modes: |
| 2087 |
\begin{itemize} |
| 2088 |
\item \verb|\DefaultInputMode| $\showmode$ : The default input mode is set |
| 2089 |
to $\showmode$. |
| 2090 |
\item \verb|\noDefaultInputMode| : The standard \TeX\ style of |
| 2091 |
input is restored. |
| 2092 |
\item \verb|\DefaultOutputMode| $\showmode$ : The default output mode |
| 2093 |
is set to $\showmode$. |
| 2094 |
\item \verb|\noDefaultOutputMode| : The standard \TeX\ style of |
| 2095 |
output is restored. |
| 2096 |
\item \verb|\InputMode| $\showfile$ $\showmode$ : The input mode for |
| 2097 |
file $\showfile$ is changed to $\showmode$, where $\showfile$ can be |
| 2098 |
\texttt{currentfile}, meaning the current file being \verb|\input|, |
| 2099 |
or an integer~$n$, which corresponds to \verb|\openin|~$n$. |
| 2100 |
\item \verb|\noInputMode| $\showfile$ : The input mode for |
| 2101 |
file $\showfile$ is restored to the standard \TeX\ style. |
| 2102 |
\item \verb|\OutputMode| $\showfile$ $\showmode$ : The output |
| 2103 |
mode for file $\showfile$ is changed to $\showmode$, where |
| 2104 |
$\showfile$ can be an integer~$n$, which corresponds to |
| 2105 |
\verb|\openout|~$n$. |
| 2106 |
\item \verb|\noOutputMode| $\showfile$ : The output mode for |
| 2107 |
file $\showfile$ is restored to the standard \TeX\ style. |
| 2108 |
\end{itemize} |
| 2109 |
% |
| 2110 |
Here are the primitives for manipulating translations: |
| 2111 |
\begin{itemize} |
| 2112 |
\item \verb|\DefaultInputTranslation| $\showmode$ $\showligocp$ : |
| 2113 |
The default input translation for mode $\showmode$ is $\showligocp$. |
| 2114 |
\item \verb|\noDefaultInputTranslation| $\showmode$ : |
| 2115 |
There is no longer a default input translation for mode $\showmode$. |
| 2116 |
\item \verb|\DefaultOutputTranslation| $\showmode$ $\showligocp$ : |
| 2117 |
The default output translation for mode $\showmode$ is $\showligocp$. |
| 2118 |
\item \verb|\noDefaultOutputTranslation| $\showmode$ : |
| 2119 |
There is no longer a default output translation for mode $\showmode$. |
| 2120 |
\item \verb|\InputTranslation| $\showfile$ $\showligocp$ : |
| 2121 |
The input translation for file $\showfile$ is $\showligocp$, |
| 2122 |
where $\showfile$ is \verb|currentfile| or an integer~$n$. |
| 2123 |
\item \verb|\noInputTranslation| $\showfile$ : |
| 2124 |
There is no longer an input translation for file $\showfile$. |
| 2125 |
\item \verb|\OutputTranslation| $\showfile$ $\showligocp$ : |
| 2126 |
The output translation for file $\showfile$ is $\showligocp$, |
| 2127 |
where $\showfile$ is an integer~$n$. |
| 2128 |
\item \verb|\noOutputTranslation| $\showfile$ : |
| 2129 |
There is no longer an output translation for file $\showfile$. |
| 2130 |
\end{itemize} |
| 2131 |
All of the above instructions apply only after the carriage return |
| 2132 |
ending the current line. |
| 2133 |
|
| 2134 |
The default mode when the system begins is \OMEGA\ style, |
| 2135 |
assuming \texttt{onebyte}. This is sufficient for all the |
| 2136 |
\texttt{iso-8859} character sets, for the \textsc{utf-8} |
| 2137 |
encoding for \textsc{unicode}, many national character sets, |
| 2138 |
and most mixed-length character sets used in East Asia. |
| 2139 |
|
| 2140 |
Once the basic family of character sets has been determined, |
| 2141 |
\OMEGA\ can read the files, and actually interpret control sequences. |
| 2142 |
It is then possible to be more specific and to specify exactly what |
| 2143 |
translation process must be applied to the entire file to convert |
| 2144 |
the input to \textsc{unicode}. |
| 2145 |
|
| 2146 |
Input translations are simply single \OCP s, which |
| 2147 |
differ from input filters in that they apply to \emph{all} characters |
| 2148 |
in a file, not simply the letters and other characters in horizontal |
| 2149 |
mode. For each kind of mode, there can be a default input |
| 2150 |
translation. |
| 2151 |
|
| 2152 |
Upon startup, there is no default translation for the |
| 2153 |
\texttt{onebyte}, \texttt{twobyte} or \texttt{twobyteLE} modes, |
| 2154 |
but there is one for \texttt{ebcdic}, namely |
| 2155 |
\begin{verbatim} |
| 2156 |
\ocp\OCPebcdic=ebcdic |
| 2157 |
\DefaultInputTranslation ebcdic \OCPebcdic |
| 2158 |
\end{verbatim} |
| 2159 |
|
| 2160 |
\section{Further work} |
| 2161 |
|
| 2162 |
The \OMEGA\ project is far from finished. Currently much of the current |
| 2163 |
work is geared towards font development. Nevertheless, new |
| 2164 |
functionality is to be added in the future. In particular, more |
| 2165 |
general methods for hyphenation, as well as for text output, using |
| 2166 |
\OTP s, are envisaged. |
| 2167 |
|
| 2168 |
\end{document} |
| 2169 |
|
| 2170 |
|
| 2171 |
|
| 2172 |
The \verb|.tfm| files used by \TeX3 only allow 256~characters each. |
| 2173 |
Like \TeX, \OMEGA\ uses \verb|.tfm| files, but it also uses |
| 2174 |
\emph{extended font metric} (\verb|.ofm|) files, which are |
| 2175 |
generalizations of \verb|.tfm| files for fonts of up to |
| 2176 |
65~536~characters each. |
| 2177 |
|
| 2178 |
The description below focuses on the differences between \verb|.tfm| |
| 2179 |
files and \verb|.ofm| files. The standard definition of \verb|.tfm| |
| 2180 |
files is in the second volume of Knuth's \emph{Computers and |
| 2181 |
Typesetting} series. |
| 2182 |
|
| 2183 |
The first 52 bytes (13 words) of an \verb|.ofm| file contain thirteen |
| 2184 |
32-bit integers that give the lengths of the various subsequent |
| 2185 |
portions of the file. These thirteen integers are, in order: |
| 2186 |
|
| 2187 |
\begin{tabular}{ll} |
| 2188 |
$0$ &empty word to designate \verb|.ofm| file;\\ |
| 2189 |
\emph{lf}&length of the entire file, in words;\\ |
| 2190 |
\emph{lh}&length of the header data, in words;\\ |
| 2191 |
\emph{bc}&smallest character code in the font;\\ |
| 2192 |
\emph{ec}&largest character code in the font;\\ |
| 2193 |
\emph{nw}&number of words in the width table;\\ |
| 2194 |
\emph{nh}&number of words in the height table;\\ |
| 2195 |
\emph{nd}&number of words in the depth table;\\ |
| 2196 |
\emph{ni}&number of words in the italic correction table;\\ |
| 2197 |
\emph{nl}&number of words in the lig-kern table;\\ |
| 2198 |
\emph{nk}&number of words in the kern table;\\ |
| 2199 |
\emph{ne}&number of words in the extensible character table;\\ |
| 2200 |
\emph{np}&number of font parameter words.\\ |
| 2201 |
\end{tabular} |
| 2202 |
|
| 2203 |
The first word is~0 (future versions of |
| 2204 |
\verb|.ofm| files could have different values; what is important is that |
| 2205 |
the first two bytes be~0 to differentiate \verb|.tfm| and \verb|.ofm| files). |
| 2206 |
The next twelve integers are as above, all non-negative and less |
| 2207 |
than~$2^{31}$. The inequality $\mathit{bc}-1\leq\mathit{ec}\leq65535$ |
| 2208 |
must hold, as must the equality |
| 2209 |
\[\mathit{lf}=13+ |
| 2210 |
\mathit{lh}+ |
| 2211 |
2(\mathit{ec}\!-\!\mathit{bc}\!+\!1)+ |
| 2212 |
\mathit{nw}+ |
| 2213 |
\mathit{nh}+ |
| 2214 |
\mathit{nd}+ |
| 2215 |
\mathit{ni}+ |
| 2216 |
\mathit{nl}+ |
| 2217 |
\mathit{nk}+ |
| 2218 |
\mathit{ne}+ |
| 2219 |
\mathit{np}.\] |
| 2220 |
Note that an \verb|.ofm| font may contain as many as 65~536 characters |
| 2221 |
(if $\mathit{bc}=0$ and $\mathit{ec}=65535$), and as few as 0~characters |
| 2222 |
(if $\mathit{bc}=\mathit{ec}+1$). |
| 2223 |
|
| 2224 |
The rest of the \verb|.ofm| file is, like in \verb|.tfm| files, a |
| 2225 |
sequence of ten data arrays. Three of the arrays are different: |
| 2226 |
\emph{char\_info}, \emph{lig\_kern} and \emph{exten}. |
| 2227 |
|
| 2228 |
The \emph{char\_info} array contains one \emph{char\_info\_word} entry |
| 2229 |
per character. Each \emph{char\_info\_word} in an \verb|.ofm| file |
| 2230 |
takes 2~words (8~octets), packed as follows: |
| 2231 |
|
| 2232 |
\begin{description} |
| 2233 |
\item[octets 0--1:] \emph{width\_index} (16~bits); |
| 2234 |
\item[octet 2:] \emph{height\_index} (8~bits); |
| 2235 |
\item[octet 3:] \emph{depth\_index} (8~bits); |
| 2236 |
\item[octets 4--5:] |
| 2237 |
\emph{italic\_index} (14 bits) times 4, plus \emph{tag} (2~bits); |
| 2238 |
\item[octets 6--7:] \emph{remainder} (16 bits). |
| 2239 |
\end{description} |
| 2240 |
|
| 2241 |
Therefore the \verb|.ofm| format imposes a limit of 256~different heights, |
| 2242 |
256~different depths, and 16~384~different italic corrections. |
| 2243 |
|
| 2244 |
The \emph{lig\_kern} array consists of a sequence of |
| 2245 |
\emph{lig\_kern\_command} entries. Each \emph{lig\_kern\_command} |
| 2246 |
in an \verb|.ofm| file takes 2~words (8~octets), packed as follows: |
| 2247 |
|
| 2248 |
\begin{description} |
| 2249 |
\item[octets 0--1:] \emph{skip\_byte}, indicates that this is the final |
| 2250 |
program step if the byte is 128 or more, otherwise the next step is obtained |
| 2251 |
by skipping this number of intervening steps. |
| 2252 |
\item[octets 2--3:] \emph{next\_char}, ``if \emph{next\_char} |
| 2253 |
follows the current character, then perform the operation and stop, |
| 2254 |
otherwise continue.'' |
| 2255 |
\item[octets 4--5:] \emph{op\_byte}, indicates a ligature step if less |
| 2256 |
than~128, a kern step otherwise. |
| 2257 |
\item[octets 6--7:] \emph{remainder}. |
| 2258 |
\end{description} |
| 2259 |
|
| 2260 |
For \verb|.tfm| files, if the very first instruction of a |
| 2261 |
character's \emph{lig\_kern} program has $\mathit{skip\_byte}>128$, |
| 2262 |
the program actually begins in location |
| 2263 |
$256*\mathit{op\_byte}+\mathit{remainder}$. |
| 2264 |
This feature allows access to large \emph{lig\_kern} arrays, |
| 2265 |
because the first instruction must otherwise appear in a location $\leq255$. |
| 2266 |
For \verb|.ofm| files, the latter value is $\leq65535$. |
| 2267 |
|
| 2268 |
Extensible characters are specified by an \emph{extensible\_recipe}, |
| 2269 |
which consists of four 2-octet words called \emph{top}, \emph{mid}, |
| 2270 |
\emph{bot}, and \emph{rep} (in this order). These bytes are the |
| 2271 |
character codes of individual pieces used to build up a large symbol. |
| 2272 |
If \emph{top}, \emph{mid}, or \emph{bot} are zero, they are not |
| 2273 |
present in the built-up result. For example, an extensible vertical |
| 2274 |
line is like an extensible bracket, except that the top and bottom |
| 2275 |
pieces are missing. |
| 2276 |
|
| 2277 |
\paragraph{Font offsets.} |
| 2278 |
|
| 2279 |
When switching from one alphabet to another in Unicode, one passes |
| 2280 |
from one Unicode page to another. However, the corresponding fonts will |
| 2281 |
normally all be numbered from~0. To deal with this situation, a |
| 2282 |
new keyword, \texttt{offset}, is introduced. In the \verb|\font| |
| 2283 |
command, $\mathtt{offset}\;n$ states that character~$c$ in the |
| 2284 |
font is referred to in \OMEGA\ by $n+c$. For example, |
| 2285 |
\begin{verbatim} |
| 2286 |
\font\ARfont=oar10 scaled 1728 offset 256 %% an Omega font |
| 2287 |
\end{verbatim} |
| 2288 |
states that the font \texttt{oar10} is to be loaded, using a scaling |
| 2289 |
factor of~1728, and that character~$c$ in the font will be referred to |
| 2290 |
in \OMEGA\ as $c+256$ or, equivalently, that character~$C$ in |
| 2291 |
\OMEGA\ refers to character $C-256$ in the font. |
| 2292 |
|
| 2293 |
\paragraph{Extended virtual property files.} |
| 2294 |
|
| 2295 |
The \texttt{.ovp} files are the same as \texttt{.vpl} files, except that |
| 2296 |
characters are no longer limited to 8~bits, but to 16~bits. |
| 2297 |
|
| 2298 |
\paragraph{Extended virtual font files.} |
| 2299 |
|
| 2300 |
The \texttt{.vf} file format already supports fonts with large |
| 2301 |
numbers of characters. However, not all drivers that read |
| 2302 |
\texttt{.vf} files properly support large fonts. Therefore, the |
| 2303 |
files generated from \texttt{.ovp} files are labeled \texttt{.ovf} |
| 2304 |
rather than~\texttt{.vf}. |
| 2305 |
|
| 2306 |
\section{Character dimensions} |
| 2307 |
|
| 2308 |
To simplify the acrobatics necessary for diacritic placement for |
| 2309 |
certain alphabets, four new primitives (\verb|\charwd|, \verb|\chardp|, |
| 2310 |
\verb|\charht|, and \verb|\charit|) are provided. When followed by |
| 2311 |
a integer designating a character, they respectively provide the |
| 2312 |
width, the depth, the height and the italic correction of the |
| 2313 |
character. For example, |
| 2314 |
\begin{verbatim} |
| 2315 |
\charwd120 |
| 2316 |
\end{verbatim} |
| 2317 |
can be considered to be an abbreviation of |
| 2318 |
\begin{verbatim} |
| 2319 |
\setbox250=\hbox{P}\wd250 |
| 2320 |
\end{verbatim} |
| 2321 |
but without the side effect of creating a box and putting something inside it. |
| 2322 |
|
| 2323 |
\end{document} |