Debian Codegraph @

texmf-dist/doc/fonts/fontinst/encspecs/encspecs.tex

raw
1 \documentclass[a4paper]{article}
2
3 \usepackage{array}
4
5 \makeatletter
6 \@ifundefined{l@nohyphenation}{\newlanguage\l@nohyphenation}{}
7 \DeclareRobustCommand\meta[1]{%
8 \ensuremath{\langle}%
9 \sbox{\z@}{%
10 \setlanguage\l@nohyphenation
11 \normalfont\itshape #1\/%
12 \setlanguage\language
13 }%
14 \unhbox\z@
15 \ensuremath{\rangle}%
16 }
17 \makeatother
18 \DeclareRobustCommand\marg[1]{%
19 \texttt{\char`\{}\meta{#1}\texttt{\char`\}}%
20 }
21 \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
22
23 \makeatletter
24 \DeclareTextFontCommand\textsmaller{%
25 \fontsize{\scaledsize{\f@size}}{\f@baselineskip}\selectfont
26 }
27 \newcommand\scaledsize[1]{%
28 \ifdim #1\p@>6\p@
29 \ifdim #1\p@>7\p@
30 \ifdim #1\p@>8\p@
31 \ifdim #1\p@>9\p@
32 \ifdim #1\p@>10\p@
33 \ifdim #1\p@>11\p@
34 \ifdim #1\p@>12\p@
35 \ifdim #1\p@>14\p@ 14%
36 \else 12\fi
37 \else 11\fi
38 \else 10\fi
39 \else 9\fi
40 \else 8\fi
41 \else 7\fi
42 \else 6\fi
43 \else 5\fi
44 }
45 \makeatother
46 \DeclareRobustCommand\ETX{\textsmaller{ETX}}
47 \DeclareRobustCommand\PDF{\textsmaller{PDF}}
48
49 % From tugboat.cls
50 \def\thinskip{\hskip 0.16667em\relax}
51 \def\endash{--}
52 \def\emdash{\endash-}
53 \makeatletter
54 \def\d@sh#1#2{\unskip#1\thinskip#2\thinskip\ignorespaces}
55 \def\dash{\d@sh\nobreak\endash}
56 \def\Dash{\d@sh\nobreak\emdash}
57 \def\ldash{\d@sh\empty{\hbox{\endash}\nobreak}}
58 \def\rdash{\d@sh\nobreak\endash}
59 \def\Ldash{\d@sh\empty{\hbox{\emdash}\nobreak}}
60 \def\Rdash{\d@sh\nobreak\emdash}
61 \newcommand{\La}%
62 {L\kern-.36em
63 {\setbox0\hbox{T}%
64 \vbox to\ht0{\hbox{$\m@th$%
65 \csname S@\f@size\endcsname
66 \fontsize\sf@size\z@
67 \math@fontsfalse\selectfont
68 A}%
69 \vss}%
70 }}
71 \IfFileExists{mflogo.sty}%
72 {\RequirePackage{mflogo}}%
73 {\TBWarning
74 {Package mflogo.sty not available --\MessageBreak
75 Proceeding to emulate mflogo.sty}
76 \DeclareRobustCommand\logofamily{%
77 \not@math@alphabet\logofamily\relax
78 \fontencoding{U}\fontfamily{logo}\selectfont}
79 \DeclareTextFontCommand{\textlogo}{\logofamily}
80 \def\MF{\textlogo{META}\-\textlogo{FONT}\@}
81 \def\MP{\textlogo{META}\-\textlogo{POST}\@}
82 \DeclareFontFamily{U}{logo}{}
83 \DeclareFontShape{U}{logo}{m}{n}{%
84 <8><9>gen*logo%
85 <10><10.95><12><14.4><17.28><20.74><24.88>logo10%
86 }{}
87 \DeclareFontShape{U}{logo}{m}{sl}{%
88 <8><9>gen*logosl%
89 <10><10.95><12><14.4><17.28><20.74><24.88>logosl10%
90 }{}
91 \DeclareFontShape{U}{logo}{m}{it}{%
92 <->ssub*logo/m/sl%
93 }{}%
94 }
95 \makeatother
96 \def\AllTeX{(\La\kern-.075em)\kern-.075em\TeX}
97
98 \usepackage{shortvrb}
99 \MakeShortVerb{\|}
100 \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
101
102 \newcommand{\TeXOmega}{Omega}
103 \DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
104 \DeclareRobustCommand\package[1]{\textsf{#1}}
105
106 \providecommand*{\href}[2]{#2}
107 \newcommand*{\ctanref}[2]{\href{ftp://ftp.ctan.org/#1}{#2}}
108
109 \title{Writing \ETX\ format font encoding specifications}
110 \author{Lars Hellstr\"om}
111 \date{2003/07/09}
112
113 \begin{document}
114 \maketitle
115
116 \begin{abstract}
117 This paper explains how one writes formal specifications of font
118 encodings for \LaTeX\ and suggests a ratification procedure for such
119 specifications.
120 \end{abstract}
121
122
123 \tableofcontents
124
125 \vspace{0mm plus 35mm}
126 \pagebreak[2]
127
128
129 \section{Introduction}
130
131 One of the many difficult problems any creator of a new typesetting
132 system encounters is that of \emph{font construction}\Dash to create
133 fonts that provide all information that the typesetting system needs
134 to do its job. From the early history of \TeX, we learn that this
135 problem is so significant that it motivated the creation of \TeX's
136 companion and equal \MF, whose implementation proved to be an even
137 greater scientific challenge than \TeX\ was. It is also a tell-tale
138 sign that the \texttt{fonts} subtree of the te\TeX\ distribution is
139 about three times as large as the \texttt{tex} subtree: fonts are
140 important, and not at all trivial to generate.
141
142 The most respected and celebrated part of font construction is
143 \emph{font design}\Ldash the creation from practically nothing of new
144 letter (and symbol) shapes, in pursuit of an artistic
145 vision\Dash but it is also something very few people have the time
146 and skill to carry through. More common is the task of \emph{font
147 installation}, where one has to solve the very concrete problem of how
148 to set up an existing font so that it can be used with \AllTeX. The
149 subproblems in this domain ranges from the very technical\Ldash how
150 to make different pieces of software ``talk'' to each other, for
151 example making information in file format~$A$ available to
152 program~$B$\Dash to the almost artistic\Ldash finding values for
153 glyph metrics and kerns that will make them look good in text\Dash
154 but these extremes tend to be clearly defined even if solving them
155 can be hard, so they are not what will be considered here. Rather,
156 this paper is about a class of more subtle problems that have to do
157 with how a font is organised.
158
159 The technical name for such a ``font organisation'' is a \emph{font
160 encoding}. In some contexts, font encodings are assumed to be mere
161 mappings from a set of ``slots'' to a set of glyph identifiers, but
162 in \TeX\ the concept entails much more; the various aspects are
163 detailed in subsequent sections. For the moment, it is sufficient to
164 observe that the role that a font encoding plays in a typesetting
165 system is that of a standard: it describes what an author can expect
166 from a font, so that a document or macro package can be written that
167 work with a large class of fonts rather than just for one font family.
168 The world of \AllTeX\ would be very different if papers published in
169 journal $X$ that is printed in commercial font $Y$ could not use
170 essentially the same sources as the author prepared for typesetting
171 in the free font $Z$. Fine-tuning of a document (overfull lines, bad
172 page breaks, etc.\@) depends on the exact font used, but it is a great
173 convenience that one can typeset a well-coded body of text under a
174 rather wide range of layout parameter (of which the main font family
175 is one) values and still expect the result to look decent, often even
176 good. Had font encodings not been standardised, the results might not
177 even have been readable.
178
179 When font encodings are viewed as standards, the historical states of
180 most \AllTeX\ font encodings becomes rather embarrassing, as they
181 lack something as fundamental as proper specifications! The typical
182 origin of a font encoding has been that some\-one creates a font that
183 behaves noticably different from other fonts, macro packages are then
184 created to support this new font, and in time other people create other
185 fonts that work with the same macros. At the end of this story the new
186 encoding exists, but it is not clear who created it, and there is
187 probably no document that describes all aspects of the encoding. Later
188 contributors have typically had to rely on a combination of imitation
189 of previous works, folklore, and reverse engineering of existing
190 software when trying to figure out what they need to provide, but the
191 results are not always verifiable. Furthermore the errors in this area
192 are usually silent\Ldash the classical error being that a `\textdollar'
193 was substituted for a `\textsterling' (or vice versa)\Dash which means
194 they can only be discovered through careful proofreading, and then
195 only \emph{provided} there at all exists a document which exercises
196 all aspects of the font encoding. Since font encodings interact with
197 hyphenation, exhaustive font verification through proofreading is
198 probably beyond the capabilities of any living \TeX pert on purely
199 linguistic grounds.
200
201 Proper specifications of font encodings makes the task of font
202 installation\Ldash and to some extent also the task of font design,
203 as it too is subject to the technicalities of font encodings\Dash
204 much simpler, as there is then a document that authoratively gives
205 all details of a font encoding. This paper even goes one step further,
206 and proposes (i)~a standard format for formal specifications of
207 \AllTeX\ font encodings and (ii)~a process through which such
208 specifications can be ratified as \emph{the} specification of a
209 particular encoding. My hope is that future \AllTeX\ font encodings
210 will have proper specifications from the start, as this will greatly
211 simplify making more fonts available in these encodings, and perhaps
212 also make font designers aware of the subtler points of \AllTeX\ font
213 design, as many details have been poorly documented.
214
215 The proposed file format for encoding specifications is a development
216 of the \textsf{fontinst}~\cite{fontinst-pre} \ETX\ format. One reason
217 for this choice was that it is an established format; many of those
218 who are making fonts already use it, even if for a slightly
219 different purpose. Another major reason is that an \ETX\ file is both
220 a \LaTeX\ document and a processable data file; this is the same kind
221 of bilinguality that has made the \texttt{.dtx} format so useful.
222 Finally the \ETX\ format makes it easy to create experimental font
223 installations when a new encoding is being designed; \textsf{fontinst}
224 can directly read the file, but the file can also be automatically
225 converted to a PostScript encoding vector if that approach seems more
226 convenient.
227 On the other hand, there are some features\Ldash most notably the
228 prominent role of the glyph names\Dash of the \ETX\ format that would
229 probably had been done differently in a file format that was built
230 from scratch, but this is necessary for several of the advantages
231 listed above.
232
233
234 % \paragraph*{Why should one make formal specifications?}
235 % Because the informal specifications that we have today
236 % are incomplete and hard to use. E.g.\ the \LaTeX\
237 % \meta{enc}\texttt{enc.def} files only say something about the
238 % characters that are accessed via commands, and even for those you
239 % really have to do reverse engineering to figure out what the
240 % encoding contains. To figure out what the remaining characters
241 % should do you have to compile what the various user manuals claim
242 % to work and then work backwards from that, but I don't think the
243 % general problem of which character tokens are allowed in input is
244 % thoroughly treated anywhere. On top of that, \LaTeX\ itself
245 % contributes some character tokens when the document is being
246 % typeset.\footnote{This is basically the ``a \texttt{T}$*$ encoding
247 % must contain the characters \ldots'' problem that was the reason
248 % that the \texttt{T2} encoding had to be split up.}
249 %
250 % On the other side of things there are the files which tell e.g.
251 % \textsf{fontinst} or \textsf{AFMtoTFM} what the target font
252 % encoding is. These are basically recipes which are known (?\@) to
253 % produce valid results, and they do usually provide more
254 % information about the encoding than the sources listed above, but
255 % they don't give much information about where the recipe can be
256 % modified.
257
258 % \paragraph*{Why use the \ETX\ format?}
259
260
261 \section{Points to keep in mind}
262
263 \subsection{Characters, glyphs, and slots}
264
265 One fundamental difference one must understand is that between
266 characters and glyphs. A \emph{character} is a semantic entity---it
267 carries some meaning, even if you usually have to combine several
268 characters to make up even one word---whereas a \emph{glyph} simply
269 is a piece of graphics. In printed text, glyphs are used to represent
270 characters and the first step of reading is to determine which
271 character(s) a given glyph is representing.\footnote{Some \PDF\ viewers
272 also try to accomplish this, but in general they need extra
273 information to do it right. The generic solution provided is to embed
274 a \emph{ToUnicode CMap}\Ldash which is precisely a map from slots to
275 characters\Rdash in the \PDF\ font object.}
276
277 In the output, \TeX\ neither deals with characters nor glyphs, really
278 (although many of its messages speak of characters), but with
279 \emph{slots}, which essentially are numbered positions in a font. To
280 \TeX, a slot is simply something which can have certain metric
281 properties (width, height, depth, etc.\@) but to the driver which
282 actually does the printing the slot also specifies a glyph. The same
283 slot in two different fonts can correspond to two quite different
284 characters.
285
286 For completeness it should also be mentioned that the \emph{input} of
287 \TeX\ is a stream of semantic entities and thus \TeX\ is dealing with
288 characters on that side, but the input is not the subject of this
289 paper.
290
291
292 \subsection{Ligatures}
293
294 In typography, a \emph{ligature} is a glyph which has been formed by
295 joining glyphs that represent two or more characters; this joining can
296 involve quite a lot of deformation of the original shapes. Examples
297 of ligatures are the `fi' ligature (from `f' and `i'), the `\AE'
298 ligature (from `A' and `E'), and the `\textit{\&}' character (from `E'
299 and `t'), the latter two of which has evolved to become characters of
300 their own. For those ligatures (such as `fi') that have not evolved to
301 characters, \TeX\ has a mechanism for forming the ligature out of the
302 characters it is composed from, under the guidance of ligature\slash
303 kerning programs found in the font.
304
305 More technically, what happens is really that if the |\char| (or
306 equivalent) for one slot is immediately followed by the |\char| (or
307 equivalent) for another (or the same) slot and there is a ligaturing
308 instruction in the \texttt{\small LIGKERN} table of the current font
309 which applies to this slot pair then this ligaturing instruction is
310 executed. This usually replaces the two slots in the pair with a
311 single new slot specified by the ligaturing instruction (it could
312 also keep one or both of the original slots, but that is less common).
313 \TeX\ has no idea about whether these replacements change the meaning
314 of anything, but \TeX\ assumes that it doesn't, and it is up to the
315 font designer to ensure that this is the case.
316
317 Apart from forming ligatures in text, the ligaturing mechanism of
318 \TeX\ is traditionally also employed for another task which is much
319 more problematic. Ligatures are also used to produce certain
320 characters which are not part of visible ASCII---the most common are
321 the endash (typed as |--|) and the emdash (typed as |---|). This is a
322 problem because it violates \TeX's assumption that the meaning is
323 unchanged; the classical problem with this appears in the \texttt{OT2}
324 encoding, where the Unicode character \texttt{U+0446}
325 (\textsc{cyrillic small letter tse}) could be typed as |ts|, whilst
326 the |t| and |s| by themselves produced Unicode characters
327 \texttt{U+0442} (\textsc{cyrillic small letter te}) and \texttt{U+0441}
328 (\textsc{cyrillic small letter es}) respectively. \TeX's hyphenation
329 mechanism can however decompose ligatures, so it sometimes happened
330 that the \textsc{tse} was hyphenated as \textsc{te}-\textsc{es},
331 which is quite different from what was intended. Since this is such
332 an obvious disadvantage, the use of ligatures for forming non-English
333 letters quickly disappeared after 8-bit input encodings became
334 available. The practice still remains in use for punctuation, however,
335 and the font designer must be aware of this. For many font encodings
336 there is a set of ligatures which must be present and replace two or
337 more characters by a single, different character. These ligatures are
338 called \emph{mandatory ligatures} in this paper.
339
340 The use of mandatory ligatures in new font encodings is strongly
341 discouraged, for a number of reasons. The main problem is that they
342 create unhealthy dependencies between input and output encoding,
343 whereas these should ideally be totally independent. Using ligatures
344 in this way complicates the internal representation of text, and it
345 also makes it much harder to typeset text where those ligatures are not
346 wanted (such as verbatim text). Furthermore it creates problems with
347 kerning, since the ``ligature'' has not yet been formed when a kern
348 to the left of it is inserted. Finally, a much better solution (when
349 it is available) is to use an \TeXOmega\ translation process
350 (see~\cite[Sec.~8--11]{Omega-doc}), since that \emph{is} independent
351 of the font, different translations can be combined, and they can
352 easily handle even ``abbreviations'' much more complicated than those
353 ligatures can deal with.
354
355
356 \subsection{Output stages}
357
358 On its way out of \LaTeX\ towards the printed text, a character passes
359 through a number of stages. The following five seem to cover what is
360 relevant for the present discussion:
361 \begin{enumerate}
362 \item \emph{\LaTeX\ Internal Character Representation} (LICR);
363 see~\cite{LaTeXCompanion}, Section~7.11 for a full description.
364 At this point the character is a character token (e.g.~|a|),
365 a text command (e.g.~|\ss|), or a combination (e.g.~|\H{o}|).
366 \item \emph{Horizontal material;} this is what the character is
367 en route from \TeX's mouth to its stomach. For most characters
368 this is equivalent to a single |\char| command (e.g.\ |a| is
369 equivalent to |\char|\,|97|), but some require more than one, some
370 are combined using the |\accent| and |\char| commands, some
371 involve rules and\slash or kerns, and some are built using boxes
372 that arbitrarily combine the above elements.
373 \item \emph{DVI commands;} this is the DVI file commands that
374 produce the printed representation of the character.
375 \item \emph{Printed text;} this is the graphical representation of
376 the character, e.g. as ink on paper or as a pattern on a computer
377 screen. Here the text consists of glyphs.
378 \item \emph{Interpreted text;} this is essentially printed text
379 modulo equivalence of interpretation, hence the text doesn't really
380 reach this stage until someone reads it. Here the text consists of
381 characters.
382 \end{enumerate}
383
384 In theory there is a universal mapping from LICR to interpreted text,
385 but various technical restrictions make it impossible to simultaneously
386 support the entire mapping. A \LaTeX\ encoding selects a restriction
387 of this mapping to a limited set which will be ``well supported''
388 (meaning kerning and such between characters in the set works), whereas
389 elements outside this set at best can be supported through temporary
390 encoding changes. The encoding also specifies a decomposition of the
391 mapping into one part which maps LICR to horizontal material and one
392 part which maps horizontal material to interpreted text. The first
393 part is realized by the text command definitions usually found in the
394 \meta{enc}\texttt{enc.def} file for the encoding. The second part is
395 the font encoding, the specification of which is the topic of this
396 paper. It is also worth noticing that an actual font is a mapping of
397 horizontal material to printed text.
398
399 An alternative decomposition of the mapping from LICR to interpreted
400 text would be at the DVI command level, but even though this
401 decomposition is realized in most \TeX\ implementations, it has very
402 little relevance for the discussion of encodings. The main reason for
403 this is that it depends not only on the encoding of a font, but
404 also on its metrics. Furthermore it is worth noticing that in e.g.\
405 pdf\TeX\ there need not be a DVI command level.
406
407
408 \subsection{Hyphenation}
409
410 There are strong connections between font encoding and hyphenation because
411 \TeX's hyphenation mechanism operates on horizontal material; more
412 precisely the hyphenation mechanism only works on pieces of horizontal
413 material that are equivalent to sequences of |\char| commands. This
414 implies that hyphenation patterns, as selected via the |\language|
415 parameter, are not only for a specific language, they are also for a
416 specific font encoding.
417
418 The hyphenation mechanism uses the |\lccode| values to distinguish
419 between three types of slots: lower case letters (|\lccode|\(\,n =
420 n\)), upper case letters (|\lccode|\(\,n \notin \{0,n\}\)), and
421 non-letters (|\lccode|\(\,n = 0\)); only the first two types can be
422 part of a hyphenatable word and only lower case letters are needed
423 in the hyphenation patters. This does however place severe
424 restrictions on how letters can be placed in a text font because
425 \TeX\ uses the same |\lccode| values for all text in a paragraph and
426 therefore these values cannot be changed whenever the encoding changes.
427 In \LaTeX\ the |\lccode| table is not allowed to change at all and
428 consequently all text font encodings must work using the standard set
429 of |\lccode| values.
430
431 In \eTeX\ each set of hyphenation patterns has its own set of
432 |\lccode| values for hyphenation, so the problem isn't as severe
433 there. The hyphenation mechanism of \TeXOmega\ should become
434 completely independent of the font encoding, although the last time I
435 checked it was still operating on material encoded according to
436 a font encoding.
437
438
439 \subsection{Production and specification \ETX\ files}
440
441 Finally, it is worth pointing out the difference between an \ETX\ file
442 created for the specification of a font encoding and one created for
443 being used in actually producing fonts with this encoding. They are
444 usually not the same. Specification \ETX s certainly may be of direct
445 use in the production of fonts---especially experimental fonts
446 produced as part of the work on a new encoding---but they are usually
447 not ideal for the purpose. In particular there is often a need to
448 switch between alternative names for a glyph to accommodate what is
449 actually in the fonts, but such trickeries are undesirable
450 complications in a specification. On the other hand a production
451 \ETX\ file has little need for verbose comments, whereas they are rather
452 an advantage in a specification \ETX\ file.
453
454 Therefore one shouldn't be surprised if there are two \ETX\ files for a
455 specific encoding: one which is a specification version and one which
456 is a production version. If both might need to be in the same
457 directory then one should, as a rule of thumb, include a
458 `\texttt{spec}' in the name of the specification version.
459
460
461 \section{Font encoding specifications}
462 \label{Sec:FontEncSpec}
463
464 \subsection{Basic principles}
465
466 Most features of the font encoding are categorized as either
467 \emph{mandatory} or \emph{ordinary}. The mandatory features are what
468 macros may rely on, whereas the ordinary simply are something which
469 fonts with this encoding normally provide. Font designers may choose
470 to provide other features than the ordinary, but are recommended to
471 provide the ordinary features to the extent that the available
472 resources permit.
473
474 Many internal references in the specification are in the form of
475 \emph{glyph names} and the choice of these is a slightly tricky
476 matter. From the point of formal specification, the choices can be
477 completely arbitrary, but from the point of practical usefulness they
478 most likely are not. One of the main advantages of the \ETX\ format
479 for specifications is that such specifications can also be used to
480 make experimental implementations, but this requires that the glyph
481 names in the specification are the same as those used in the fonts
482 from which the experimental implementation should be built. Yet
483 another aspect is that the glyph names are best chosen to be the ones
484 one can expect to find in actual fonts, as that will make things
485 easier for other people that want to make non-experimental
486 implementations later. For this last purpose, a good reference is
487 Adobe's technical note on Unicode and glyph names~\cite{unicodesign}.
488 For most common glyphs, \cite{unicodesign} ends up recommending that
489 one should follow the Adobe glyph list~\cite{AGL}, which however has
490 the peculiar trait of recommending names on the form
491 \texttt{afii}\textit{ddddd} (rather than the Unicode-based alternative
492 \texttt{uni}\textit{xxxx}) for most non-latin glyphs. This is somewhat
493 put in perspective by~\cite{ATN5013}.
494
495
496 \subsection{Slot assignments}
497
498 The purpose of the slot assignments is to specify for each slot which
499 character or characters it is mapped to. That one slot is mapped to
500 many characters is an unfortunate, but not very uncommon, reality in
501 many encodings, as limitations in font size have often encouraged
502 identifications of two characters which are almost the same. It should
503 be avoided in new encodings.
504
505 Slot assignmets are done using the |\nextslot| command and a
506 |\setslot| \dots\ |\endsetslot| construction as follows:
507 \begin{quote}
508 |\nextslot|\marg{slot number}\\*
509 |\setslot|\marg{glyph name}\\*
510 \mbox{\quad}\meta{slot commands}\\*
511 |\endsetslot|
512 \end{quote}
513 A typical example of this is
514 \begin{quote}\begin{verbatim}
515 \nextslot{65}
516 \setslot{A}
517 \Unicode{0041}{LATIN CAPITAL LETTER A}
518 \endsetslot
519 \end{verbatim}\end{quote}
520 which gets typeset as
521 \begin{quote}
522 \textbf{Slot 65 `\texttt{A}'}\\*
523 Unicode character \texttt{U+0041}, \textsc{latin capital letter a}.
524 \end{quote}
525
526 The |\nextslot| command does not typeset anything; it simply stores
527 the slot number in a counter, for later use by |\setslot|. The
528 |\endsetslot| command increments this counter by one. Hence the
529 |\nextslot| command is unnecessary between |\setslot|s for consecutive
530 slots. Besides |\nextslot|, there is also a command |\skipslots| which
531 increments the slot number counter by a specified amount. The
532 argument of both |\nextslot| and |\skipslots| can be arbitrary
533 \package{fontinst} integer expressions (see~\cite{fontinst-man}). All
534 \TeX\ \meta{number}s that survive full expansion are valid
535 \package{fontinst} integer expressions, but for example |`\~| isn't,
536 as |\~| is a macro which will break before the expression is typeset.
537 These cases can however be fixed by preceding the \TeX\ \meta{number}
538 by |\number|, as |\number`\~| survives full expansion by expanding to
539 |126|.
540
541 The main duty of the \meta{slot commands} is to specify the target
542 character (or characters) for this slot. The simplest way of doing
543 this is to use the |\Unicode| command, which has the syntax
544 \begin{quote}
545 |\Unicode|\marg{code point}\marg{name}
546 \end{quote}
547 The \meta{code point} is the number of the character (in hexadecimal
548 notation, usually a four-digit number) and the \meta{name} is the name.
549 Case is insignificant in these arguments. If a slot corresponds to a
550 string of characters rather than to a single character, then one uses
551 the |\charseq| command, which has the syntax
552 \begin{quote}
553 |\charseq|\marg{\cs{Unicode} commands}
554 \end{quote}
555 e.g.
556 \begin{quote}\begin{verbatim}
557 \nextslot{30}
558 \setslot{ffi}
559 \charseq{
560 \Unicode{0066}{LATIN SMALL LETTER F}
561 \Unicode{0066}{LATIN SMALL LETTER F}
562 \Unicode{0069}{LATIN SMALL LETTER I}
563 }
564 \endsetslot
565 \end{verbatim}\end{quote}
566 Several |\Unicode| commands not in the argument of a |\charseq|
567 instead mean that each of the listed characters is a valid
568 interpretation of the slot.
569
570 If a character cannot be specified in terms of Unicode code points then
571 the specification should simply be a description in text which
572 identifies the character. Such descriptions are written using the
573 |\comment| command
574 \begin{quote}
575 |\comment|\marg{text}
576 \end{quote}
577 It is worth noticing that the \meta{text} is technically only an
578 argument of |\comment| when the program processing the \ETX\ file is
579 ignoring |\comment| commands. This means |\verb| and similar
580 catcode-changing commands \emph{can} be used in the \meta{text}. The
581 |\par| command is on the other hand not allowed in the \meta{text}.
582
583 The |\comment| command should also be used for any further piece of
584 explanation of or commentary to the character used for the slot, if the
585 exposition seems to need it. There can be any number of |\comment|
586 commands in the \meta{slot commands}.
587
588
589 \subsection{Ligatures}
590
591 There are three classes of ligatures in the font encoding
592 specifications: mandatory, ordinary, and odd. Mandatory ligatures must
593 be present in any font which complies with the encoding, whereas
594 ordinary and odd ligatures need not be. No clear distinction can be
595 made between ordinary and odd ligatures, but a non-mandatory ligature
596 should be categorized as ordinary if it makes sense for the majority
597 of users, and as odd otherwise. Hence the `fi' ligature is
598 categorized as ordinary in the \texttt{T1} encoding (although it
599 makes no sense in Turkish), whereas the `ij' ligature is odd.
600
601 In the \ETX\ format, a ligature is specified using one of the slot
602 commands
603 \begin{quote}
604 |\Ligature|\marg{ligtype}\marg{right}\marg{new}\\
605 |\ligature|\marg{ligtype}\marg{right}\marg{new}\\
606 |\oddligature|\marg{note}\marg{ligtype}\marg{right}\marg{new}
607 \end{quote}
608 |\Ligature| is used for mandatory ligatures, |\ligature| is used for
609 ordinary ligatures, and |\oddligature| is used for odd ligatures. The
610 \meta{right} and \meta{new} arguments are names of the glyphs being
611 assigned to the slots involved in this ligature. The \meta{right}
612 specifies the right part in the slot pair being affected by the
613 ligature, whereas the left part is the one of the |\setslot| \dots\
614 |\endsetslot| construction in which the ligaturing command is placed.
615 The \meta{new} specifies a new slot which will be inserted by the
616 ligaturing instruction. The \meta{ligtype} is the actual ligaturing
617 instruction that will be used; it must be |LIG|, |/LIG|, |/LIG>|,
618 |LIG/|, |LIG/>|, |/LIG/|, |/LIG/>|, or |/LIG/>>|. The slashes specify
619 retention of the left or right original character; the |>| signs
620 specify passing over that many slots in the result without further
621 ligature processing. \meta{note}, finally, is a piece of text which
622 explains when the odd ligature may be appropriate. It is typeset as a
623 footnote.
624
625 As an example of ligatures we find the following in the specification
626 of the \texttt{T1} encoding:
627 \begin{quote}
628 |\nextslot{33}|\\
629 |\setslot{exclam}|\\
630 | \Unicode{0021}{EXCLAMATION MARK}|\\
631 | \Ligature{LIG}{quoteleft}{exclamdown}|\\
632 |\endsetslot|
633 \end{quote}
634 It is typeset as
635 \begin{quote}
636 \textbf{Slot 33 `\texttt{exclam}'}\\*
637 Unicode character \texttt{U+0021}, \textsc{exclamation mark}.\\*
638 \textbf{Mandatory ligature}
639 \texttt{exclam}${}*{}$\texttt{quoteleft}${}\rightarrow
640 {}$\texttt{exclamdown}
641 \end{quote}
642 With other \meta{ligtype}s there may be more names listed on the
643 right hand side and possibly a `$\lfloor$' symbol showing the
644 position at which ligature processing will start afterwards.
645
646
647 \subsection{Math font specialities}
648
649 There are numerous technicalities which are special to math fonts, but
650 only a few of them are exhibited in \ETX\ files.\footnote{For an
651 overview of the subject, see for example Vieth~\cite{Vieth2001}.} Most
652 of these have to do with the \TeX\ mechanisms that find sufficiently
653 large characters for commands like |\left|, |\sqrt|, and |\widetilde|.
654
655 The first mechanism for this is that a character in a font can sort of
656 say ``If I'm too small, then then try character \dots\ instead''. This
657 is expressed in an \ETX\ file using the |\nextlarger| command, which
658 has the syntax
659 \begin{quote}
660 |\nextlarger|\marg{glyph name}
661 \end{quote}
662 The second mechanism constructs a sufficiently large character from
663 smaller pieces; this is known as a `varchar' or `extensible character'.
664 This is expressed in an \ETX\ file using an ``extensible recipe'', the
665 syntax for which is
666 \begin{quote}
667 |\varchar| \meta{varchar commands} |\endvarchar|
668 \end{quote}
669 where each \meta{varchar command} is one of
670 \begin{quote}
671 |\varrep|\marg{glyph name}\\
672 |\vartop|\marg{glyph name}\\
673 |\varmid|\marg{glyph name}\\
674 |\varbot|\marg{glyph name}
675 \end{quote}
676 There can be at most one of each and their order is irrelevant. The
677 most important is the |\varrep| command, as that is the part which is
678 repeated until the character is sufficiently large. The |\vartop|,
679 |\varmid|, and |\varbot| commands are used to specify some other part
680 which should be put at the top, middle, and bottom of the extensible
681 character respectively. Not all extensible recipes use all of these,
682 however.
683
684 As an example, here is how a very large left brace is constructed:
685 \begin{center}
686 \begin{tabular}{>{%
687 \fontencoding{OMX}\fontfamily{cmex}\selectfont
688 $\vcenter\bgroup\hbox\bgroup
689 }l<{\egroup\egroup$} l}
690 \char"38& For |\vartop{bracelefttp}|\\
691 \char"3E& For |\varrep{braceex}|\\
692 \char"3C& For |\varmid{braceleftmid}|\\
693 \char"3E& Again for |\varrep{braceex}|\\
694 \char"3A& For |\varbot{braceleftbt}|
695 \end{tabular}
696 \end{center}
697
698 Both |\nextlarger| and |\varchar| commands are like |\ligature| in
699 that they describe ordinary features for the encoding; they appear in
700 a specification \ETX\ file mainly to explain the purpose of some
701 ordinary character. There is no such thing as a mandatory |\nextlarger|
702 or |\varchar|, but varchars are occationally used to a similar effect.
703 In these cases, the character generated by the extensible recipe is
704 something quite different from what a |\char| for that slot would
705 produce. Thus for the slot to produce the expected result it must be
706 referenced using a |\delimiter| or |\radical| primitive, since those
707 are the only ones which make use of the extensible recipe. The effect
708 is that the slot has a \emph{semimandatory} assignment; the result of
709 |\char| is unspecified (as for a slot with an ordinary assignment), but
710 the result for a large delimiter or radical is not (as for a slot with
711 a mandatory assignment).
712
713 Thus some math fonts have an extra section ``Semimandatory characters''
714 between the mandatory and ordinary character sections. In that section
715 for the \texttt{OMX} encoding we find for example
716 \begin{quote}\begin{verbatim}
717 \nextslot{60}
718 \setslot{braceleftmid}
719 \Unicode{2016}{DOUBLE VERTICAL LINE}
720 \comment{This is the large size of the |\Arrowvert|
721 delimiter, a glyphic variation on |\Vert|.
722 The \texttt{braceleftmid} glyph ordinarily
723 placed in this slot must not be too tall,
724 or else the extensible recipe actually producing
725 the character might sometimes not be used.}
726 \varchar
727 \varrep{arrowvertex}
728 \endvarchar
729 \endsetslot
730 \end{verbatim}\end{quote}
731 which is typeset as
732 \begin{quote}
733 \textbf{Slot 60 `\texttt{braceleftmid}'}\\*
734 Unicode character \texttt{U+2016}, \textsc{double vertical line}.\\
735 This is the large size of the |\Arrowvert|
736 delimiter, a glyphic variation on |\Vert|.
737 The \texttt{braceleftmid} glyph ordinarily
738 placed in this slot must not be too tall,
739 or else the extensible recipe actually producing
740 the character might sometimes not be used.\\
741 \textbf{Extensible glyph:}\\*
742 \textbf{Repeated} \texttt{arrowvertex}
743 \end{quote}
744
745
746
747
748 \subsection{Fontdimens}
749
750 Each \TeX\ font contains a list of fontdimens, numbered from $1$ and
751 up, which are accessible via the |\fontdimen| \TeX\ primitive. Quite a
752 few are also used implicitly by \TeX\ and therefore cannot be left out
753 even if they are totally irrelevant, but as one can always include
754 some extra fontdimens in a font---the only bounds on how many
755 fontdimens there may be are the general bound on the size of a TFM
756 file and the amount of font memory \TeX\ has available---this is
757 usually not a problem.
758
759 The reason fontdimens are part of font encoding specifications is
760 that the meaning of e.g.\ |\fontdimen|\,|8| varies between different
761 fonts depending on their encoding; thus the encoding specification
762 must define the quantity stored in each |\fontdimen| parameter. This
763 is done using the |\setfontdimen| command, which has the syntax
764 \begin{quote}
765 |\setfontdimen|\marg{number}\marg{name}
766 \end{quote}
767 The \meta{number} is the fontdimen number (as a sequence of decimal
768 digits where the first digit isn't zero) and the \meta{name} is a
769 symbolic name for the quantity.
770
771 The standard list of symbolic names for fontdimen quantities appears
772 below; the listed quantities should always be described using the names
773 in this list. Encoding specifications that employ other quantities as
774 fontdimens should include definitions of these quantities. Those
775 quantities that are defined as ``Formula parameter \dots'' have to
776 do with how mathematical formulae are rendered and are usually much
777 too complicated to explain here. For exact definitions of these
778 parameters, the reader is referred to Appendix~G of \textit{The
779 \TeX book}~\cite{TeXbook}.
780 \begin{list}{}{%
781 \setlength\labelwidth{0pt}%
782 \setlength\itemindent{-\leftmargin}%
783 \def\makelabel#1{\hspace{\labelsep}\normalfont\itshape #1}%
784 \setlength\itemsep{0.5\itemsep}%
785 \setlength\parsep{0.5\parsep}%
786 }
787 \item[acccapheight]
788 The height of accented full capitals.
789 \item[ascender]
790 The height of lower case letters with ascenders.
791 \item[axisheight] Formula parameter $\sigma_{22}$.
792 \item[baselineskip]
793 The font designer's recommendation for natural length of the
794 \TeX\ parameter |\baselineskip|.
795 \item[bigopspacing1] Formula parameter $\xi_{9}$.
796 \item[bigopspacing2] Formula parameter $\xi_{10}$.
797 \item[bigopspacing3] Formula parameter $\xi_{11}$.
798 \item[bigopspacing4] Formula parameter $\xi_{12}$.
799 \item[bigopspacing5] Formula parameter $\xi_{13}$.
800 \item[capheight]
801 The height of full capitals.
802 \item[defaultrulethickness] Formula parameter $\xi_{8}$.
803 \item[delim1] Formula parameter $\sigma_{20}$.
804 \item[delim2] Formula parameter $\sigma_{21}$.
805 \item[denom1] Formula parameter $\sigma_{11}$.
806 \item[denom2] Formula parameter $\sigma_{12}$.
807 \item[descender]
808 The depth of lower case letters with descenders.
809 \item[digitwidth]
810 The median width of the digits in the font.
811 \item[extraspace]
812 The natural width of extra interword glue at the end of a sentence.
813 \TeX\ implicitly uses this parameter if |\spacefactor| is $2000$ or
814 more and |\xspaceskip| is zero.
815 \item[interword]
816 The natural width of interword glue (spaces). \TeX\ implicitly uses
817 this parameter unless |\spaceskip| is nonzero.
818 \item[italicslant]
819 The slant per point of the font. Unlike all other fontdimens, it is
820 not proportional to the font size.
821 \item[maxdepth]
822 The maximal depth over all slots in the font.
823 \item[maxheight]
824 The maximal height over all slots in the font.
825 \item[num1] Formula parameter $\sigma_{8}$.
826 \item[num2] Formula parameter $\sigma_{9}$.
827 \item[num3] Formula parameter $\sigma_{10}$.
828 \item[quad]
829 The quad width of the font, normally approximately equal to the
830 font size and\slash or the width of an `M'. Also implicitly available
831 as the length unit |em| and used for determining the size of the
832 length unit |mu|.
833 \item[shrinkword]
834 The (finite) shrink component of interword glue (spaces). \TeX\
835 implicitly uses this parameter unless |\spaceskip| is nonzero.
836 \item[stretchword]
837 The (finite) stretch component of interword glue (spaces). \TeX\
838 implicitly uses this parameter unless |\spaceskip| is nonzero.
839 \item[sub1] Formula parameter $\sigma_{16}$.
840 \item[sub2] Formula parameter $\sigma_{17}$.
841 \item[subdrop] Formula parameter $\sigma_{19}$.
842 \item[sup1] Formula parameter $\sigma_{13}$.
843 \item[sup2] Formula parameter $\sigma_{14}$.
844 \item[sup3] Formula parameter $\sigma_{15}$.
845 \item[supdrop] Formula parameter $\sigma_{18}$.
846 \item[verticalstem]
847 The dominant width of vertical stems. This quantity is meant to be used
848 as a measure of how ``dark'' the font is.
849 \item[xheight]
850 The x-height (height of lower case letters without ascenders). Also
851 implicitly available as the length unit |ex|.
852 \end{list}
853
854
855 \subsection{The codingscheme}
856
857 The final encoding-dependent piece of information in a \TeX\ font is
858 the codingscheme, which is essentially a string declaring what
859 encoding the font has. This information is currently only used by
860 programs that convert the information in a \TeX\ font to some other
861 format and these use it to identify the glyphs in the font. Therefore
862 this string should be chosen so that the contents of the slots in the
863 font can be positively identified. Observe that the encoding
864 specification by itself does not provide enough information for this,
865 since there are usually a couple of slots that do not contain
866 mandatory characters. On the other hand, it is not a problem in this
867 context if the font leaves some of the slots (even mandatory ones)
868 empty as that is anyway easily detected. The only problem is with
869 fonts where the slots are assigned to other characters than the ones
870 specified in the encoding.
871
872 For that reason, it is appropriate to assign two codingscheme strings
873 to each encoding. The main codingscheme is for fonts were all slots
874 (mandatory and ordinary alike) have been assigned according to the
875 specification or have been left empty. The variant codingscheme is for
876 fonts where some ordinary slots have been assigned other characters
877 than the ones listed in the specification, but where the mandatory
878 slots are still assigned according to the specification or are left
879 empty. The font encoding specification should give the main
880 codingscheme name, whereas the variant codingscheme name could be
881 formed by adding \verb*| VARIANT| to the main codingscheme name.
882
883 Technically the codingscheme is specified by setting the
884 \texttt{codingscheme} string variable. This has the syntax
885 \begin{quote}
886 |\setstr{codingscheme}|\marg{codingscheme name}
887 \end{quote}
888 e.g.
889 \begin{quote}
890 |\setstr{codingscheme}{EXTENDED TEX FONT ENCODING - LATIN}|
891 \end{quote}
892 which is typeset as
893 \begin{quote}
894 \textbf{Default} s(\texttt{codingscheme}) =
895 \verb*|EXTENDED TEX FONT ENCODING - LATIN|
896 \end{quote}
897 A codingscheme name may be at most 40 characters long and may not
898 contain parentheses. If the entire \verb*| VARIANT| cannot be suffixed
899 to a main name because the result becomes to long (as in the above
900 example) then use the first 40 characters of the result.
901
902
903 \subsection{Overall document structure}
904 \label{Ssec:Structure}
905
906 The overall structure of a font encoding specification should be
907 roughly the following
908 \begin{quote}
909 |\relax|\\
910 |\documentclass[twocolumn]{article}|\\
911 |\usepackage[specification]{fontdoc}|\\
912 \meta{preamble}\\
913 |\begin{document}|\\
914 \meta{title}\\
915 \meta{manifest}\\
916 |\encoding|\\
917 \meta{body}\\
918 |\endencoding|\\
919 \meta{discussion}\\
920 \meta{change history}\\
921 \meta{bibliography}\\
922 |\end{document}|
923 \end{quote}
924 The commands described in the preceding subsections must all go in
925 the \meta{body} part of the document, as that is the only part of the
926 file which actually gets processed as a data file. The part before
927 |\encoding| is skipped and the part after |\endencoding| is never
928 even input, so whatever appears there is only part of the \LaTeX\
929 document. For the purposes of processing as a data file, the
930 important markers in the file are the |\relax|, the |\endcoding|, and
931 the |\endencoding| commands.
932
933 The \meta{title} is the usual |\maketitle| (and the like) stuff. The
934 person or persons who appear as author(s) are elsewhere in this paper
935 described as the \emph{encoding proposers}. The \meta{title} should
936 also give the date when the specification was last changed.
937
938 The \meta{manifest} is an important, although usually pretty short,
939 part of the specification. It is a piece of text which explains the
940 purpose of the encoding (in particular what it can be used for) and
941 the basic ideas (if any) which have been used in its construction. It
942 is often best marked up as an abstract.
943
944 The \meta{discussion} is the place for any longer comments on the
945 encoding, such as analyses of different implementations, comparisons
946 with other encodings, etc. This is also the place to explain any more
947 general structures in the encoding, such as the arrow kit in the
948 proposed \texttt{MS2} encoding~\cite{ClasenVieth}. In cases where the
949 specification is mainly a formulation of what is already an
950 established standard the \meta{discussion} is often rather short as
951 the relevant discussion has already been published elsewhere, but
952 it is anyway a service to the reader to include this information.
953 References to the original documents should always be given.
954
955 It might be convenient to include an FAQ section at the end of the
956 discussion. This is particularly suited for explaining things where
957 one has to look for a while and consult the references to find the
958 relevant information.
959
960 The \meta{change history} documents how the specification has changed
961 over time. It is preferably detailed, as each detail in an encoding
962 is important, but one should not be surprised if it is anyway rather
963 short due to that there haven't been that many changes.
964
965 The \meta{bibliography} is an important part of the specification. It
966 should at the very least include all the sources which have been used
967 in compiling the encoding specification, regardless of whether they
968 are printed, available on the net, merely ``personal communication'',
969 or something else. It is also a service to the reader to include in
970 the bibliography some more general references for related matters.
971
972 The \meta{preamble} is just a normal \LaTeX\ preamble and there are no
973 restrictions on defining new commands in it, although use of such
974 commands in the \meta{body} part is subject to the same restrictions
975 as use of any general \LaTeX\ command. The preamble should however
976 \emph{not} load any packages not part of the required suite of
977 \LaTeX\ packages, as that may prevent users who do not have these
978 packages from typesetting the specification. Likewise, the
979 specification should \emph{not} require that some special font is
980 available. Glyph examples for characters are usually better
981 referenced via Unicode character charts than via special fonts.
982
983 An exception to this rule about packages is that the specification
984 must load the \package{fontdoc} package, as shown in the outline
985 above, since that defines the |\setslot| etc.\ commands that should
986 appear in the \meta{body}. This should not be a problem, as the
987 \package{fontdoc} package can preferably be kept in the same directory
988 as the collection of encoding specifications (see below). The
989 \texttt{specification} option should be passed to the package to let it know
990 that the file being processed is an encoding specification---otherwise
991 |\Ligature| and |\ligature| will get the same formatting, for one. It
992 is not necessary to use the \package{article} document class, and
993 neither must it be passed the \texttt{twocolumn} option, but it is
994 customary to do so. In principle any other document class within
995 required \LaTeX\ will do just as well.
996
997 If you absolutely think that using some non-required package
998 significantly improves the specification, then try writing the code so
999 that is loads the package only if it is available and provide some
1000 kind of fallback definition for sites where it is not. E.g.\ the
1001 \package{url} package could be loaded as
1002 \begin{verbatim}
1003 \IfFileExists{url.sty}{\usepackage{url}}{}
1004 \providecommand\url{\verb}
1005 \end{verbatim}
1006 The |\url| command defined by this is not equivalent to the command
1007 defined by the \package{url} package, but it can serve fairly well
1008 (with a couple of extra overfull lines as only ill effect) if its
1009 use is somewhat restricted.
1010
1011 Finally, a technical restriction on the \meta{preamble}, \meta{title},
1012 and \meta{manifest} is that they must not contain any mismatched
1013 |\if|s (of any type) or |\fi|s, as \TeX\ conditionals will be used for
1014 skipping those parts of the file when it is processed as a data file.
1015 If the definition of some macro includes mismatched |\if|s or |\fi|s
1016 (this will probably occur only rarely) then include some extra code
1017 so that they do match.
1018
1019
1020 % All technical parts of the encoding specification (slot assignments,
1021 % fontdimens, etc.\@) have to be in the \meta{encoding commands} part.
1022 % The other parts are suitably used for longer commentry, such as the
1023 % mainfest (see below), revision history, and bibliography.
1024 %
1025 % When the file is being typeset as a \LaTeX\ document there is nothing
1026 % special going on. The |\encoding| and |\endencoding| commands may set
1027 % some internal variables, but otherwise they do very little. When the
1028 % file is being read by \package{fontinst}, things are quite different.
1029 % Everything between the initial |\relax| and |\encoding| is skipped,
1030 % and the file is not read further than to the |\endencoding|. Hence
1031 % the \meta{preamble}, \meta{\LaTeX\ text 1}, and \meta{\LaTeX\ text 2}
1032 % can contain pretty much anything (with a few exceptions) which is
1033 % legal in a \LaTeX\ document.
1034
1035
1036 \subsection{Encoding specification body syntax}
1037
1038 The \meta{body} part of an encoding specification must comply to a
1039 much stricter syntax than the rest of the file. The \meta{body} is
1040 a sequence of \meta{encoding command}s, each of which should be one
1041 of the following:
1042 \begin{quote}
1043 |\setslot|\marg{glyph name} \meta{slots commands} |\endsetslot|\\
1044 |\nextslot|\marg{number}\\
1045 |\skipslots|\marg{number}\\
1046 |\setfontdimen|\marg{number}\marg{name}\\
1047 |\setstr{codingscheme}|\marg{codingscheme name}\\
1048 |\needsfontinstversion|\marg{version number}
1049 \end{quote}
1050 The |\needsfontinstversion| command is usually placed immediately
1051 after the |\encoding| command. The \meta{version number} must be at
1052 least |1.918| for many of the features described in this file to be
1053 available, and at least |1.928| if the |\charseq| command is used.
1054
1055 The \meta{slot commands} are likewise a sequence of \meta{slot
1056 command}s, each of which should be one of the following:
1057 \begin{quote}
1058 |\Unicode|\marg{code point}\marg{name}\\
1059 |\charseq|\marg{\cs{Unicode} commands}\\
1060 |\comment|\marg{text}\\
1061 |\Ligature|\marg{ligtype}\marg{right}\marg{new}\\
1062 |\ligature|\marg{ligtype}\marg{right}\marg{new}\\
1063 |\oddligature|\marg{note}\marg{ligtype}\marg{right}\marg{new}\\
1064 |\nextlarger|\marg{glyph name}\\
1065 |\varchar| \meta{varchar commands} |\endvarchar|
1066 \end{quote}
1067 where \meta{varchar commands} similarly is a sequence of \meta{varchar
1068 command}s, each of which should be one of the following:
1069 \begin{quote}
1070 |\varrep|\marg{glyph name}\\
1071 |\vartop|\marg{glyph name}\\
1072 |\varmid|\marg{glyph name}\\
1073 |\varbot|\marg{glyph name}
1074 \end{quote}
1075 Finally, one can include any number of \meta{comment command}s between
1076 any two encoding, slot, or varchar commands. The comment commands are
1077 \begin{quote}
1078 |\begincomment| \meta{\LaTeX\ text} |\endcomment|\\
1079 |\label|\marg{reference label}
1080 \end{quote}
1081 The \meta{\LaTeX\ text} can be pretty much any \LaTeX\ code that can
1082 appear in conditional text. (|\begincomment| is either |\iffalse| or
1083 |\iftrue| depending on whether the encoding specification is
1084 processed as a data file or typeset as a \LaTeX\ document respectively.
1085 |\endcomment| is always |\fi|.) The |\label| command is just
1086 the normal \LaTeX\ |\label| command; when it is used in a \meta{slot
1087 commands} it references that particular slot (by number and glyph
1088 name).
1089
1090 The full syntax of the \ETX\ format can be found in the
1091 \package{fontinst} manual~\cite{fontinst-man}, but font encoding
1092 specifications only need a subset of that.
1093
1094
1095 \subsection{Additional \package{fontdoc} features}
1096
1097 There is an ``in comment paragraph'' form |\textunicode| of the
1098 |\Unicode| command. Both commands have the same syntax, but
1099 |\textunicode| is only allowed in ``comment'' contexts. A typical use
1100 of |\textunicode| is
1101 \begin{quote}
1102 |\comment{An |\dots\\
1103 \quad\dots| this is \textunicode{2012}{FIGURE DASH}; in |\dots\\
1104 |}|
1105 \end{quote}
1106 which is typeset as
1107 \begin{quote}
1108 An \dots\ this is \texttt{U+2012} (\textsc{figure dash}); in \dots
1109 \end{quote}
1110
1111 The \package{fontdoc} package inputs a configuration file
1112 \texttt{fontdoc.cfg} if that exists. This can be used to pass
1113 additional options to the package. The only currently available
1114 options that this could be of interest for are the \texttt{hypertex}
1115 and \texttt{pdftex} options, which hyperlinks each \texttt{U+}\dots\
1116 generated by |\Unicode| or |\textunicode| (using Hyper\TeX\ or
1117 pdf\TeX\ conventions\footnote{One could just as well do the same
1118 thing using some other convention if a suitable definition of
1119 \cs{FD@codepoint} is included in \texttt{fontdoc.cfg}. See the
1120 \package{fontinst} sources~\cite{fontinst-pre} for more details.}
1121 respectively) to a corresponding glyph image on the Unicode consortium
1122 website. To use this feature one should put the line
1123 \begin{quote}
1124 |\ExecuteOptions{hypertex}|
1125 \end{quote}
1126 or
1127 \begin{quote}
1128 |\ExecuteOptions{pdftex}|
1129 \end{quote}
1130 in the \texttt{fontdoc.cfg} file. \emph{Please} do not include this
1131 option in the |\usepackage|\nolinebreak[1]|{fontdoc}| of an encoding
1132 specification file as that can be a severe annoyance for people whose
1133 \TeX\ program or DVI viewers do not support the necessary extensions.
1134 % Hyper\TeX\ |\special|s.
1135
1136
1137 \section{Font encoding ratification}
1138
1139 This section describes a suggested ratification process for font
1140 encoding specifications. As there are fewer technical matters that
1141 impose restrictions on what it may look like, it is probably more
1142 subjective than the other parts of this paper.
1143
1144 \medskip
1145
1146 A specification in the process of being ratified can be in one of
1147 three different stages: \emph{draft}, \emph{beta}, or \emph{final}.
1148 Initially the specification is in the draft stage, during which it
1149 will be scrutinized and can be subject to major changes. A
1150 specification which is in the beta stage has got a formal approval
1151 but the encoding in question may still be subject to some minor
1152 changes if weighty arguments present themselves. Once the
1153 specification has reached the final stage, the encoding may not
1154 change at all.
1155
1156
1157 \subsection{Getting to the draft stage}
1158
1159 The process of taking an encoding to the draft stage can be
1160 summarized in the following steps. Being in the draft stage doesn't
1161 really say anything about whether the encoding is in any way correct
1162 or useful, except in that some people (the encoding proposers)
1163 believe it is and are willing to spend some time on ratifying it.
1164
1165 \paragraph{Write an encoding specification} The first step is to
1166 write a specification for the font encoding in question. This
1167 document must not only technically describe the encoding but also
1168 explain what the encoding is for and why it was created. See
1169 Subsection~\ref{Ssec:Structure} for details on how the document is
1170 preferably organised.
1171
1172 \paragraph{Request an encoding name} The second step is to write to
1173 the \LaTeX3 project and request a \LaTeX\ encoding name for the
1174 encoding. This mail should be in the form of a \LaTeX\ bug report, it
1175 must be sent to
1176 \begin{quote}
1177 \href{mailto:[email protected]}%
1178 {\texttt{[email protected]}},
1179 \end{quote}
1180 and it must include the encoding specification file. Suggestions for
1181 an encoding name are appreciated, but not necessarily accepted.
1182 The purpose of this mail is \emph{not} to get an approval of the
1183 encoding, but only to have a reasonable name assigned to it.
1184
1185 \paragraph{Upload the specification to CTAN} The third step is make
1186 the encoding specification publicly available by uploading it to
1187 CTAN. Encoding specifications are collected in the
1188 \begin{quote}
1189 \ctanref{info/encodings}{\texttt{info/encodings}}
1190 \end{quote}
1191 directory (which should also contain the most recent version of this
1192 paper). The name of the uploaded file should be
1193 \meta{encoding name}\texttt{draft.etx}. The reason for this naming is
1194 that it must be clear that the specification has not yet been ratified.
1195
1196 \paragraph{Announce the encoding} When the upload has been confirmed,
1197 it is time to announce the encoding by posting a message about it to
1198 the relevant forums. Most important is the \texttt{tex-fonts} mailing
1199 list, since that is where new encodings should be debated. Messages
1200 should also be posted to the \texttt{comp.text.tex} newsgroup and any
1201 forums related to the intended use of the encoding: an encoding for
1202 Sanskrit should be announced on Indian \TeX\ users forums, an
1203 encoding for printing chess positions should be announced on some
1204 chess-with-\TeX\ user forum, etc.; in the extent that such forums exist.
1205
1206 The full address of the \texttt{tex-fonts} mailing list is
1207 \begin{quote}
1208 \texttt{[email protected]}
1209 \end{quote}
1210 This list rejects postings from non-members, so you need to subscribe
1211 to it before you can post your announcement. This is done by sending
1212 a `subscribe me' mail to
1213 \begin{quote}
1214 \href{mailto:[email protected]}
1215 {\texttt{[email protected]}}
1216 \end{quote}
1217 The list archives can be found at
1218 \begin{quote}
1219 \href{http://www.math.utah.edu/mailman/listinfo/tex-fonts}
1220 {\textsc{http:}/\slash \texttt{www.math.utah.edu}\slash
1221 \texttt{mailman}\slash \texttt{listinfo}\slash
1222 \texttt{tex-fonts}}
1223 \end{quote}
1224 A tip is to read through the messages from a couple of months
1225 before you write up your announcement, as that should help you get
1226 acquainted with the normal style on the list. Please do not send
1227 messages encoded in markup languages (notably, \textsmaller{HTML},
1228 \textsmaller{XML}, and word processor formats) to the list.
1229
1230 \paragraph{Experimental encodings} There is a point in going through
1231 the above procedure even for experimental encodings, i.e., encodings
1232 whose names start with an \texttt{E}. Of course there is no idea in
1233 ratifying a specification of an experimental encoding, as it is very
1234 likely to frequently change, but having a proper name assigned to the
1235 encoding and uploading its specification to CTAN makes it much simpler
1236 for other people to learn about and make references to the encoding.
1237
1238
1239 \subsection{From draft to beta stage}
1240
1241 The main difference between a draft and beta stage specification
1242 respectively is that beta stage specifications have been scrutinized
1243 by other people and found to be free of errors. The practical
1244 implementation of this is that a debate is held (in the normal
1245 anarchical manner of mailing list debates) on the \texttt{tex-fonts}
1246 mailing list. In particular the following aspects of the
1247 specification should be checked:
1248 \begin{enumerate}
1249 \item \emph{Is the encoding technically correct?}
1250 There are many factors which affect what \TeX\ does and it is
1251 easy to overlook some. (The \cs{lccode}s seem to be particularly
1252 troublesome, in this respect.) Sometimes fonts simply cannot work
1253 as an encoding specifies they should and it is important that
1254 such defects in the encoding are discovered on an early stage.
1255 \item \emph{Are there any errors in the specification?}
1256 A font encoding specification is largely a table and typos are
1257 easy to make. Proof-reading may be boring, but it is very, very
1258 important.
1259 \item \emph{Is the specification sufficiently precise?}
1260 Are there any omissions, ambiguities, inaccuracies, or completely
1261 irrelevant material in the specification? There shouldn't be.
1262 \end{enumerate}
1263 During the debate, the encoding proposers should hear what other
1264 people have to say about the encoding draft, revise it accordingly
1265 when some flaw is pointed out, and upload the revised version. This
1266 cycle may well have to be repeated several times before everyone's
1267 content. It is worth pointing out that in practice the debate should
1268 turn out to be more of a collective authoring of the specification
1269 than a defense of its validity. There is no point in going into it
1270 expecting the worst.
1271
1272 Unfortunately, it might happen that there never is a complete agreement
1273 on an encoding specification---depending on what side on takes, either
1274 the encoding proposers refuse to correct obvious flaws in it, or someone
1275 on the list insists that there is a flaw although there is obviously
1276 not---but hopefully that will never happen. If it anyway does happen
1277 then the person objecting should send a mail whose subject contains the
1278 phrase "formal protest against XXX encoding" (with XXX replaced by
1279 whatever the encoding is called) to the list. Then it will be up to
1280 the powers that be to decide on the fate of the encoding (see below).
1281
1282 \paragraph{Summarize the debate} When the debate on the encoding is
1283 over---e.g.\ a month after anyone last posted anything new on the
1284 subject---then the encoding proposers should summarize the debate on
1285 the encoding specification draft and post this summary as a follow-up
1286 on the original mail to \texttt{latex-bugs}. This summary should list
1287 the changes that have been made to the encoding, what suggestions there
1288 were for changes which have not been included, and whether there were
1289 any formal protests against the encoding. The summary should also explain
1290 what the proposers want to have be done with the encoding. In the
1291 usual case this is having it advanced to beta stage, but the proposers
1292 might alternatively at this point have reached the conclusion that the
1293 encoding wasn't such a good idea to start with and therefore withdraw
1294 it, possibly to come again later with a different proposal.
1295
1296 In response to this summary, the \LaTeX-project people may do one of
1297 three things:
1298 \begin{itemize}
1299 \item
1300 If the proposers wants the encoding specification advanced and
1301 there are no formal protests against this, then the encoding
1302 should be advanced to the beta stage. The \LaTeX-project
1303 people do this by adding the encoding to the list of approved
1304 (beta or final stage) encodings that they [presumably] maintain.
1305 \item
1306 If the proposers want to withdraw the encoding specification
1307 then the name assigned to it should once again be made available
1308 for use for other encodings.
1309 \item
1310 If the proposers want the encoding specification advanced but
1311 there is some formal protest against this, then the entire matter
1312 should be handed over to some suitable authority, as a suggestion
1313 some technical TUG committee, for resolution.
1314 \end{itemize}
1315
1316
1317 \paragraph{Update the specification on CTAN} When the specification
1318 has reached the beta stage, its file on CTAN should be updated to say
1319 so. In particular the file name should be changed from \meta{encoding
1320 name}\texttt{draft.etx} to \meta{encoding name}\texttt{spec.etx}.
1321
1322
1323 \paragraph{Modifying beta stage encodings} If a beta stage encoding is
1324 modified then the revised specification should go through the above
1325 procedure of ratification again before it can replace the previous
1326 \meta{encoding name}\texttt{spec.etx} file on CTAN. The revised
1327 version should thus initially be uploaded as \meta{encoding
1328 name}\texttt{draft.etx}, reannounced, and redebated. It can however
1329 be expected that such debates will not be as extensive as the
1330 original debates.
1331
1332
1333 \subsection{From beta stage to final stage}
1334
1335 The requirements for going from beta stage to final stage are more
1336 about showing that the encoding has reached a certain maturity than
1337 about demonstrating any technical merits of it. The main difference in
1338 usefulness between a beta stage encoding and a final stage encoding is
1339 that the latter can be considered safe for archival purposes, whereas
1340 one should have certain reservations against such use of beta stage
1341 encodings.
1342
1343 It seems reasonable that the following conditions should have to be
1344 fulfilled before a beta stage encoding can be made a final stage
1345 encoding:
1346 \begin{itemize}
1347 \item At least one year must have passed since the last change was
1348 made to the specification.
1349 \item At least two people other than the proposer must have
1350 succeeded in implemented the encoding in a font.
1351 \end{itemize}
1352 It is quite possible that some condition should be added or some of
1353 the above conditions reformulated.
1354
1355
1356 % References updated 2004/08/07.
1357 \begin{thebibliography}{???}
1358 \bibitem{ATN5013}
1359 Adobe Systems Incorporated:
1360 \textit{Adobe Standard Cyrillic Font Specification},
1361 Adobe Technical Note \#5013, 1998;
1362 \href{http://partners.adobe.com/asn/developer/pdfs/tn/%
1363 5013.Cyrillic_Font_Spec.pdf}{\textsc{http}:/\slash
1364 \texttt{partners.adobe.com}\slash \texttt{asn}\slash
1365 \texttt{developer}\slash \texttt{pdfs}\slash \texttt{tn}\slash
1366 \texttt{5013.Cyrillic\_Font\_Spec.pdf}}.
1367 \bibitem{AGL}
1368 Adobe Systems Incorporated: \textit{Adobe Glyph List},
1369 text file, 1998,
1370 \href{http://partners.adobe.com/asn/developer/type/glyphlist.txt}
1371 {\textsc{http}:/\slash \texttt{partners.adobe.com}\slash
1372 \texttt{asn}\slash \texttt{developer}\slash \texttt{type}\slash
1373 \texttt{glyphlist.txt}}.
1374 \bibitem{unicodesign}
1375 Adobe Systems Incorporated:
1376 \textit{Adobe Solutions Network: Unicode and Glyph Names},
1377 web page, 1998,
1378 \href{http://partners.adobe.com/asn/developer/type/unicodegn.html}
1379 {\textsc{http}:/\slash \texttt{partners.adobe.com}\slash
1380 \texttt{asn}\slash \texttt{developer}\slash \texttt{type}\slash
1381 \texttt{unicodegn.html}}.
1382 \bibitem{ClasenVieth}
1383 Matthias Clasen and Ulrik Vieth:
1384 \textit{Towards a new Math Font Encoding for (La)TeX},
1385 March 1998, presented at EuroTeX'98;
1386 \href{http://tug.org/twg/mfg/papers/current/mfg-euro-all.ps.gz}
1387 {\textsc{http}:/\slash \texttt{tug.org}\slash \texttt{twg}\slash
1388 \texttt{mfg}\slash \texttt{papers}\slash \texttt{current}\slash
1389 \texttt{mfg-euro-all.ps.gz}}.
1390 \bibitem{fontinst-man}
1391 Alan Jeffrey, Rowland McDonnell, Ulrik Vieth, and Lars Hellstr\"om:
1392 \textit{\package{fontinst}---font installation software for \TeX}
1393 (manual), 2004,
1394 \ctanref{fonts/utilities/fontinst/doc/fontinst.tex}{%
1395 \textsc{ctan}:\discretionary{}{}{\thinspace}%
1396 \texttt{fonts}\slash \texttt{utilities}\slash
1397 \texttt{fontinst}\slash \texttt{doc}\slash \texttt{fontinst.tex}}.
1398 % \bibitem{fontinst}
1399 % Alan Jeffrey, Sebastian Rahtz, and Ulrik Vieth:
1400 % \textit{The \package{fontinst} utility}, documented source code,
1401 % v\,1.801,
1402 % \ctanref{fonts/utilities/fontinst/source}{%
1403 % \textsc{ctan}:\discretionary{}{}{\thinspace}%
1404 % \texttt{fonts}\slash \texttt{utilities}\slash
1405 % \texttt{fontinst}\slash \texttt{source}/}.
1406 \bibitem{fontinst-pre}
1407 Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, and Lars Hellstr\"om:
1408 \textit{The \package{fontinst} utility}, documented source code,
1409 v\,1.9xx,
1410 \ctanref{fonts/utilities/fontinst/source}{%
1411 \textsc{ctan}:\discretionary{}{}{\thinspace}%
1412 \texttt{fonts}\slash \texttt{utilities}\slash
1413 \texttt{fontinst}\slash \texttt{source}/}.
1414 \bibitem{TeXbook}
1415 Donald E.\ Knuth, Duane Bibby (illustrations): \textit{The \TeX book},
1416 Ad\-di\-son--Wes\-ley, 1991;
1417 volume A of \textit{Computers and typesetting}.
1418 \bibitem{LaTeXCompanion}
1419 Frank Mittelbach and Michel Goossens, with Johannes Braams,
1420 David Carlisle, and Chris Rowley:
1421 \textit{The \LaTeX\ Companion} (second edition),
1422 Ad\-di\-son--Wes\-ley, 2004; ISBN~0-201-36299-6.
1423 \bibitem{Omega-doc}
1424 John Plaice and Yannis Haralambous:
1425 \textit{Draft documentation for the Omega system},
1426 version~1.12, 1999;
1427 \href{http://omega.cse.unsw.edu.au:8080/doc-1.12.ps}{%
1428 \textsc{http:}/\slash \texttt{omega.cse.unsw.edu.au:8080}\slash
1429 \texttt{doc-1.12.ps}}.
1430 % \textsc{ctan}:\discretionary{}{}{\thinspace}%
1431 % \texttt{systems}\slash \texttt{omega}\slash
1432 % \texttt{omega-doc-1.8.tar.gz}.
1433 \bibitem{Vieth2001}
1434 Ulrik Vieth:
1435 \textit{Math typesetting in \TeX: The~good, the~bad, the~ugly},
1436 to appear in the proceedings of Euro\TeX\ 2001;
1437 \href{http://www.ntg.nl/eurotex/vieth.pdf}{%
1438 \textsc{http}:/\slash \texttt{www.ntg.nl}\slash
1439 \texttt{eurotex}\slash \texttt{vieth.pdf}}.
1440 \end{thebibliography}
1441
1442
1443 \end{document}