Debian Codegraph @

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

raw
1 %%% ====================================================================
2 %%% @LaTeX-file{
3 %%% author = "Alan Jeffrey and Rowland McDonnell and
4 %%% Ulrik Vieth and Lars Hellstr{\"o}m",
5 %%% version = "1.928",
6 %%% date = "2007-09-06",
7 %%% time = "11:22:41 +02:00",
8 %%% filename = "fontinst.tex",
9 %%% email = "[email protected]",
10 %%% checksum = "",
11 %%% codetable = "ISO/ASCII",
12 %%% keywords = "fontinst, TeX, PostScript, documentation",
13 %%% supported = "yes",
14 %%% abstract = "This is the documentation for the fontinst
15 %%% font installation package.",
16 %%% package = "fontinst",
17 %%% dependencies = "ltxguide.cls, url.sty, xspace.sty"
18 %%% }
19 %%% ====================================================================
20
21 % Copyright 1993, 1994, 1995, 1996 Alan Jeffrey
22
23 % Modified by Rowland McDonnell June 1998
24 % Modified and revised by Ulrik Vieth June 1998
25 % Modified by Lars Hellstr\"om July 2004 and later
26
27
28
29 \documentclass[a4paper]{ltxguide}
30 \usepackage[OT1]{fontenc}
31 \usepackage{url,xspace}
32 \usepackage{graphicx}
33
34 \IfFileExists{palatino.flag}{
35 \renewcommand\rmdefault{ppl}
36 }
37 %\renewcommand\rmdefault{padx}
38 %\renewcommand\rmdefault{pmnx}
39
40 % \MakeShortVerb{\|}
41
42
43 % Title page and running heads.
44
45 \makeatletter
46 \newcommand{\subtitle}[1]{\renewcommand{\@subtitle}{#1}}
47 \newcommand{\version}[1]{\renewcommand{\@version}{#1}}
48 \newcommand{\illustration}[1]{\renewcommand{\@illustration}{#1}}
49
50 \newcommand{\@subtitle}{}
51 \newcommand{\@version}{???}
52 \newcommand{\@illustration}{cover.eps}
53
54 % \pagestyle{myheadings}
55 % \AtBeginDocument{\markright{\small\itshape
56 % \@author\hfill\@title: \@subtitle\quad}}
57
58
59 \renewcommand{\maketitle}{{%
60 \thispagestyle{empty}%
61 \normalfont\centering
62 \null
63 {\fontsize{100}{100}\textit{\@title}}%
64 \par\bigskip
65 {\Large\textbf{\@subtitle}}%
66 \vfill
67 \includegraphics[width=\textwidth]{\@illustration}%
68 \vfill
69 {\Large\textbf{%
70 \def\and{\egroup\qquad\hbox\bgroup}
71 \leavevmode \hbox{\@author}\\[\smallskipamount]
72 \@title~v\@version
73 \quad\textperiodcentered\quad \@date}}%
74 \clearpage
75 }}
76 \makeatother
77
78
79 % Set lists tighter (assuming non-zero \parskip).
80
81 \makeatletter
82 \renewcommand{\@listI}{%
83 \leftmargin\leftmargini
84 \parsep\medskipamount
85 \itemsep\z@ % + parsep
86 \topsep\z@ % + parskip
87 \partopsep\z@
88 }
89 \newenvironment{isyntax}{%
90 \let\\\@centercr
91 \list{}{%
92 \itemsep \z@
93 \itemindent -1.5em%
94 \listparindent \itemindent
95 \advance \leftmargin 1.5em%
96 }%
97 \advance \rightskip \z@\@plus0.7\linewidth \relax
98 \linepenalty=100\relax
99 \item\relax
100 }{\endlist}
101 \makeatother
102
103 \newenvironment{smalldes}{%
104 \list{}{%
105 \setlength\labelwidth{0pt}%
106 \setlength\itemindent{-\leftmargin}%
107 \setlength\listparindent{1em}%
108 \setlength\parsep{0pt}%
109 \setlength\itemsep{0pt plus 1pt}%
110 \setlength\topsep{\itemsep}%
111 \let\makelabel\descriptionlabel
112 }%
113 }{\endlist}
114
115 \newenvironment{hackernote}{%
116 \list{}{
117 \setlength{\leftmargin}{0pt}%
118 \setlength\labelwidth{0pt}%
119 \setlength{\listparindent}{1.4em}%
120 \setlength{\parsep}{0pt plus 1pt}%
121 \setlength{\itemsep}{\medskipamount}%
122 }\item[]%
123 \small
124 \textit{Note for hackers.}\hspace{0.5em}%
125 }{\endlist}
126
127 % % I don't use the <...> feature for verbatim,
128 % % so I undo that ltxguide feature.
129 % \makeatletter
130 % \renewcommand{\verbatim@font}{%
131 % \normalfont \ttfamily
132 % % \catcode`\<=\active
133 % % \catcode`\>=\active
134 % }
135 % \makeatother
136
137
138 % ltxguide.cls decl environment, but with equal space above and
139 % below.
140 \DeleteShortVerb{\|}
141 \makeatletter
142 \newenvironment{decl*}[1][]{%
143 \par
144 \small
145 \addvspace{2.3ex}%
146 \vskip -\parskip
147 \ifx\relax#1\relax
148 \def\@decl@date{}%
149 \else
150 \def\@decl@date{\NEWfeature{#1}}%
151 \fi
152 \noindent\hspace{-\leftmargini}%
153 \begin{tabular}{|l|}%
154 \hline\ignorespaces
155 }{%
156 \\\hline
157 \end{tabular}%
158 \nobreak\@decl@date\par\nobreak
159 \vspace{2.3ex}\vskip -\parskip
160 }
161 \makeatother
162 \MakeShortVerb{\|}
163
164
165 % Set spacing around captions.
166
167 \setlength{\abovecaptionskip}{\medskipamount}
168 \setlength{\belowcaptionskip}{\medskipamount}
169
170 % Markup for logos, file types, programs, etc.
171
172 \newcommand*{\meta}{\m}
173 \newcommand*{\marg}{\arg}
174 \newcommand*{\parg}[1]{\texttt{(}\m{#1}\texttt{)}}
175
176 \newcommand*{\cs}[1]{\texttt{\char`\\ #1}\xspace}
177
178 \newcommand*{\OzTeX}{O\kern-.03em z\kern-.15em\TeX}
179 \newcommand*{\OzMF}{O\kern-.03em zMF}
180 \newcommand*{\OzTools}{O\kern-.03em z\kern-.15em Tools}
181
182 \makeatletter
183 \newcommand{\La}{%
184 L\kern-.36em
185 {%
186 \setbox0\hbox{T}%
187 \vbox to\ht0{\hbox{%
188 $\m@th$\csname S@\f@size\endcsname
189 \fontsize\sf@size\z@\math@fontsfalse\selectfont
190 A%
191 }\vss}%
192 }%
193 }
194 \makeatother
195 \DeclareRobustCommand\AllTeX{(\La\kern-.075em)\kern-.075em\TeX}
196
197 \newcommand{\PS}{Post\-Script\xspace}
198 \newcommand{\TT}{True\-Type\xspace}
199
200 \newcommand*{\setfilename}[1]{\texttt{#1}}
201 \newcommand*{\setdotfilename}[1]{\setfilename{.#1}}
202 \newcommand*{\setpackagename}[1]{\textsf{#1}}
203
204 \newcommand{\dvips} {\setpackagename{dvips}\xspace}
205 \newcommand{\Dvips} {\setpackagename{Dvips}\xspace}
206 \newcommand{\fontinst}{\setpackagename{font\-inst}\xspace}
207 \newcommand{\Fontinst}{\setpackagename{Font\-inst}\xspace}
208 \newcommand{\fontdoc}{\setpackagename{font\-doc}\xspace}
209 \newcommand{\Fontdoc}{\setpackagename{Font\-doc}\xspace}
210
211 % \show\fontname
212 \newcommand{\fontnamekb}{fontname\xspace}
213 \newcommand{\Fontnamekb}{Fontname\xspace}
214
215 \newcommand{\mf} {\setfilename{mf}\xspace}
216 \newcommand{\Mf} {\setfilename{Mf}\xspace}
217 \newcommand{\vf} {\setfilename{vf}\xspace}
218 \newcommand{\Vf} {\setfilename{Vf}\xspace}
219 \newcommand{\pl} {\setfilename{pl}\xspace}
220 \newcommand{\Pl} {\setfilename{Pl}\xspace}
221 \newcommand{\fd} {\setfilename{fd}\xspace}
222 \newcommand{\Fd} {\setfilename{Fd}\xspace}
223 \newcommand{\pk} {\setfilename{pk}\xspace}
224 \newcommand{\Pk} {\setfilename{Pk}\xspace}
225 \newcommand{\afm}{\setfilename{afm}\xspace}
226 \newcommand{\Afm}{\setfilename{Afm}\xspace}
227 \newcommand{\vpl}{\setfilename{vpl}\xspace}
228 \newcommand{\Vpl}{\setfilename{Vpl}\xspace}
229 \newcommand{\cvpl}{(\setfilename{v})\setfilename{pl}\xspace}
230 \newcommand{\tfm}{\setfilename{tfm}\xspace}
231 \newcommand{\Tfm}{\setfilename{Tfm}\xspace}
232 \newcommand{\mtx}{\setfilename{mtx}\xspace}
233 \newcommand{\Mtx}{\setfilename{Mtx}\xspace}
234 \newcommand{\etx}{\setfilename{etx}\xspace}
235 \newcommand{\Etx}{\setfilename{Etx}\xspace}
236 \newcommand{\enc}{\setfilename{enc}\xspace}
237 \newcommand{\Enc}{\setfilename{Enc}\xspace}
238 \newcommand{\pfa}{\setfilename{pfa}\xspace}
239 \newcommand{\Pfa}{\setfilename{Pfa}\xspace}
240 \newcommand{\pfb}{\setfilename{pfb}\xspace}
241 \newcommand{\Pfb}{\setfilename{Pfb}\xspace}
242 \newcommand{\dvi}{\setfilename{dvi}\xspace}
243 \newcommand{\Dvi}{\setfilename{Dvi}\xspace}
244 \newcommand{\pdf}{\setfilename{pdf}\xspace}
245 \newcommand{\Pdf}{\setfilename{Pdf}\xspace}
246 \newcommand{\ttf}{\setfilename{ttf}\xspace}
247 \newcommand{\Ttf}{\setfilename{Ttf}\xspace}
248 \newcommand{\map}{\setfilename{map}\xspace}
249 \newcommand{\Map}{\setfilename{Map}\xspace}
250
251
252 \newcommand{\vftovp}{\setpackagename{vftovp}\xspace}
253 \newcommand{\vptovf}{\setpackagename{vptovf}\xspace}
254 \newcommand{\pltotf}{\setpackagename{pltotf}\xspace}
255 \newcommand{\tftopl}{\setpackagename{tftopl}\xspace}
256
257 \newcommand{\BibTeX}{Bib\TeX}
258
259
260
261
262 \title{fontinst}
263 \subtitle{Font installation software for \TeX}
264 \author{Alan Jeffrey\and Rowland McDonnell\and Lars Hellstr\"om}
265 \illustration{roadmap.eps}
266 \version{1.9}
267 \date{August 2009}
268
269 \begin{document}
270
271 \maketitle
272
273
274 % \begin{itshape}
275 % This manual is currently being rewritten, and may therefore be a
276 % bit disorganised. For authoritative information on command syntaxes
277 % and the like, see the Literate Programming sources for
278 % \fontinst. The main file there is \textsl{\texttt{fisource.tex}}.
279 % \end{itshape}
280 %
281 % \bigskip
282
283 \begin{footnotesize}
284 This manual describes the \texttt{fontinst} software for converting
285 fonts from Adobe Font Metric format to forms readable by \TeX. This
286 manual should be distributed with the \texttt{fontinst} software,
287 which is available by anonymous FTP from
288 \url{ftp://ftp.tex.ac.uk/tex-archive/fonts/utilities/fontinst}, and
289 on the various CD-ROMs containing material from the CTAN archives.
290 Please do not contact the author directly for copies.
291
292 If you would like to report a bug with \texttt{fontinst}, please
293 mail \url{[email protected]}. The mail will be sent to the
294 \texttt{fontinst} mailing list. If you would like to be on the
295 \texttt{fontinst} mailing list, see
296 \url{http://tug.org/mailman/listinfo/fontinst}.
297 \end{footnotesize}
298
299 \tableofcontents
300
301 % \vfill
302
303 \clearpage
304
305
306 \section{Introduction}
307
308 The purpose of \fontinst is to make digital fonts, as they may
309 be bought from a foundry or other supplier, usable with \AllTeX;
310 in general, they are not directly so. An obvious problem can be
311 that the font information is not available in a format that \TeX\
312 understands. A more subtle problem is that the fonts are often
313 organised in a way that is unsuitable for automatic typesetting.
314 It is furthermore necessary to inform \AllTeX\ and related software
315 about the existence of the new font, and the pieces of code needed
316 to do this are somewhat exotic.
317
318 Regarding the first problem, \fontinst can bridge the gap between
319 non-\TeX\ and \TeX-specific file formats, but may need some help from
320 other tools (\setfilename{pltotf}, \setfilename{vptovf},
321 \setfilename{ttf2afm}, etc.) with conversions between text and binary
322 file formats. Regarding the last problem, \fontinst can generate the
323 necessary code, although you may in some cases need to paste it into
324 the right configuration file yourself. It is however with respect to
325 the second problem that \fontinst shines, as the many minutiae of
326 providing fonts for \AllTeX\ are automated to a very high degree,
327 while still providing you as user with the power to fine-tune every
328 detail of the output. In addition, \fontinst is available for every
329 platform that has \TeX.
330
331 The reason \fontinst is so portable is simply that it is written in
332 \TeX, exploiting those features of the language which does other
333 things than typesetting. A drawback of this is the inability to work
334 directly with binary file formats, but an advantage is that users
335 do not need to learn a separate command language before they can
336 configure the tool; \fontinst only introduces a set of new \TeX\
337 commands, not a new set of syntax rules. Moreover, many encoding and
338 metric files used with \fontinst can also be typeset as \LaTeX\
339 documents, yielding a rendering of their contents which might be more
340 pleasing to the eye than the raw code.
341
342 The main thing \fontinst does is creating virtual fonts (\vf's). For
343 this, it takes the approach that the world is full of glyphs, and a
344 subset of these are to be picked, perhaps tweaked, and finally wrapped
345 up as a new font for \TeX\ to use. In the basic case where one merely
346 wants to make a specific foundry-supplied font available to \TeX, what
347 one does is to present only that font as glyphbase for \fontinst, since
348 this means all glyphs in the resulting virtual font will come from that
349 base font, only reorganised to meet the requirements of \AllTeX. It is
350 however not uncommon to use several base fonts for forming a single
351 glyphbase, maybe because the foundry has arbitrarily decided to divide
352 the basic font up into separate ``base'', ``expert'', and ``alternate''
353 varieties that don't match the needs of \TeX, or maybe because the
354 foundry did not provide all the glyphs of standard \TeX\ fonts and glyphs
355 from some other font family are used to fill in the gaps. Either way,
356 since it's you that's doing the packaging, it is you that gets to say
357 what goes into the package.
358
359 In the process of creating some virtual fonts, many minor pieces of
360 data are encounted that would be needed when informing \AllTeX\ and
361 related software about these new fonts.
362 \Fontinst records this information and provides for writing finished
363 files in the most common formats, notably \LaTeX\ \fd files and
364 \dvips \map files. One can even ask \fontinst to have certain
365 transformations performed on the base fonts, to extend or tweak the
366 repertoire of glyph shapes that are available.
367
368
369 \subsection{Overview of the process}
370
371 If you're using \fontinst, the usual steps you need to take to use
372 an ordinary \PS latin text font with \LaTeX\ are these:
373 \marginpar{Related commands:}
374 \begin{enumerate}
375 \item \label{WhatToDoList:1}
376 Gather \afm files for the base fonts you want to make use of, and
377 (optionally) give the \afm files appropriate names.
378 \item \label{WhatToDoList:2}
379 Use \fontinst\marginpar{\cs{transformfont}} to produce \texttt{8r}
380 encoded \pl files from these \afm files.
381 \item \label{WhatToDoList:3}
382 Use \fontinst\marginpar{\cs{installfont}} to create T1 and OT1
383 encoded \pl and \vpl files from the |8r| encoded \pl files (this
384 procedure will also create suitable \fd files).
385 \item \label{WhatToDoList:4}
386 Use \fontinst (its \setfilename{finstmsc.sty}\marginpar{
387 \cs{adddriver}} variety) to generate the mapfile entries needed
388 for the above.
389 \item
390 Use \pltotf to turn each \pl file into a \tfm file.
391 \item
392 Use \vptovf to turn each \vpl file into a pair of \vf and
393 \tfm files.
394 \item
395 Move the \tfm, \vf, and \fd files into the appropriate
396 directories so \LaTeX\ can see them.
397 \item
398 Tell your \dvi driver about the new font (typically involves
399 editing some configuration file or files, possibly also running
400 some helper command to update cached configuration information).
401 \item
402 Test it. (The \LaTeX\ command \cs{usefont} lets you select a font
403 by encoding, family, series, and shape. The Plain\TeX\ file
404 \setfilename{testfont.tex} provides an easy way of producing font
405 tables.)
406 \item
407 Perhaps write a package file to make selecting the new font
408 a little easier.
409 \end{enumerate}
410
411 The \setfilename{examples\slash basic\slash basicex.tex} file
412 contains examples of doing \ref{WhatToDoList:2}
413 and~\ref{WhatToDoList:3}; in many cases, it is possible to use the
414 |\latinfamily| command to do all of this.
415 The \setfilename{examples\slash basic\slash basicex2.tex} file
416 contains examples of doing \ref{WhatToDoList:4}.
417
418
419 \section{Defining terms}
420
421 The process of making fonts usable involves some rather technical
422 issues, so in order to understand a discussion of what is going on,
423 it is necessary to first get the terminology straight. Feel free to
424 skip parts of this if you think you already know the material covered
425 or for the moment want to concentrate on other aspects of what
426 \fontinst does, but bear in mind that you may then have reason to return
427 to this section at a later time.
428
429 % This is rather a large and perhaps tedious section. You might be
430 % tempted to skip it so you can get to some more direct information on
431 % how to use \fontinst. That's fine if you understand everything about
432 % how \TeX\ handles fonts. If not, we suggest you at least skim though
433 % this section.
434
435 \subsection{What's a font?}
436
437 Once upon a time, this question was easily answered: a font is a
438 set of type in one size, style, etc. There used to be no
439 ambiguity, because a font was a collection of chunks of type metal
440 kept in a drawer, one drawer for each font.
441
442 These days, with digital typesetting, things are more complicated.
443 What a font `is' isn't easy to pin down. A typical use of a \PS
444 font with \LaTeX\ might use these elements:
445 \begin{itemize}
446 \item Type 1 printer font file
447 \item Bitmap screen font file
448 \item Adobe font metric file (\afm file)
449 \item \TeX\ font metric file (\tfm file)
450 \item Virtual font file (\vf file)
451 \item font definition file (\fd file)
452 \end{itemize}
453 Looked at from a particular point of view, each of these files
454 `is' the font. So what's going on?
455
456
457 \subsubsection{Type 1 printer font files}
458
459 These files contain the information needed by your printer to draw
460 the shapes of all the characters in a font. They're typically
461 files with a \pfa or \pfb extension; on Macs they're usually in
462 files of type `LWFN' and have icons that look like a
463 laser printer. The information in all these formats is basically
464 the same: the only difference is in its representation. \pfa
465 stands for `printer font ASCII', while \pfb stands for `printer
466 font binary'. \pfa files are pure \PS code (though in parts highly
467 convoluted) and can typically be pasted into or copied from \PS
468 documents using a text editor if one feels like hacking. Since \pfa
469 files contain a large chunk of hex-encoded binary data, they are
470 however about twice the size of the equivalent \pfb, where text and
471 binary data reside in separate sections of an overall binary file
472 format.
473
474 % That is, \pfa files contain plain text information,
475 % while \pfb files contain the same information encoded as
476 % machine-readable binary data.
477
478 % If you have Adobe Type Manager (ATM) installed on your computer,
479 % ATM will use these files to draw an accurate representation of the
480 % letters on the screen of your computer when you are previewing a
481 % \TeX\ document.
482
483 Printer font files are not used directly by \TeX\ at all -- \TeX\
484 just prepares a \dvi file that refers to the fonts by name and the
485 characters by number: \TeX\ knows nothing about the shapes
486 involved. The \dvi driver uses the printer font files when you ask
487 it to print the \dvi file. This means that you can produce a \dvi
488 file which uses, say, Palatino, even if you do not have the
489 Type~1 printer font file for this font on your computer. You will
490 need to find a computer that does have Palatino before you can
491 print it or preview it, though.
492 (Pdf\TeX\ is different from \TeX\ in this respect; since pdf\TeX\
493 integrates most of the functionality of a \dvi driver, it may be unable
494 to generate working \pdf output if the some Type~1 printer font file
495 is not available.)
496
497 \Dvi drivers generating \pdf often require Type~1 fonts to be in \pfb
498 format, as that is very close to how the data is stored in a \pdf
499 file.
500
501
502 \subsubsection{Bitmap screen font files}
503
504 These files contain a low-resolution bitmap for drawing a
505 representation of the font on the screen of your computer if ATM
506 is not installed. In the \TeX\ world, these files are only used
507 for screen previews by \dvi drivers that use the windowing system
508 for rendering text.
509 % They are kept in font suitcase files on Macintoshes.
510 %\marginnote{And where on other computers?}
511
512 Technically, \pk files are also bitmap font files, for use on screen
513 or with a printer, but \TeX\ systems tend to be set up so that \pk
514 files are generated automatically when needed. (Of course, this
515 requires that the font is first available in some other format,
516 usually \mf or \pfb.)
517
518
519 \subsubsection{Adobe font metric files (\afm files)}
520
521 These files are text files which contain information about the
522 size of each character in a font, kerning and ligature
523 information, and so on. They can't be used by \TeX\ directly, but
524 the information they contain is essential if you want to use a
525 font with \TeX. \Fontinst can from an \afm file create the
526 necessary \tfm and \vf files (well, really \pl and \vpl files, but
527 see below) so you can use a font with \TeX.
528 Once you have created all the files you need to use a font with
529 \TeX, you can remove the corresponding \afm files from your
530 computer unless you have other software that needs them.
531
532 The job of turning an \afm file into a set of \tfm and \vf files
533 is one of the main uses for \fontinst. Most of this document is
534 concerned with this process, so don't worry if it seems a bit
535 vague at the moment.
536
537
538 \subsubsection{\TT and OpenType font files}
539
540 The \TT format was created as an Apple--Microsoft collaboration to
541 avoid being dependent on Adobe's font technologies. Later Adobe and
542 Microsoft went on to define the OpenType format, which is a
543 development of \TT. However, the three don't always agree on the
544 fine details of the format.
545
546 A \TT font file is a collection of rather disparate tables, and can
547 therefore contain scalable outline fonts (like \PS~type~1), bitmap
548 screen fonts, and font metrics all in one file; for software with
549 direct support for \TT this tends to simplify font installation, but
550 for \TeX\ it rather adds a level of complication. An advantage for
551 \TeX\ use is that the suppliers provide font metrics in a
552 cross-platform format (as opposed to rather obscure platform-specific
553 formats, which could previously be the norm), but they still have to
554 undergo conversion before we can use them. \TT is furthermore a
555 ``there is more than one way to do it'' format, so it sometimes
556 happens that information which is present in the font is ignored by
557 some programs because that information happened to be in an unusal
558 format\dots
559
560 Classical \TT fonts have outlines defined in terms of quadratic
561 Bezier curves. The main addition in the OpenType specification was a
562 second outline format (CFF\slash type~2) which uses cubic Bezier
563 curves. Both outline formats are directly supported in \pdf and can
564 (even if the driver doesn't have built-in support for the format)
565 with a thin wrapper be used in \PS, but there is also a tradition of
566 rather converting to type~1 before using such fonts with \TeX; the
567 latter leads to a slight drop in quality.
568
569
570
571
572 \subsubsection{\TeX\ font metric files (\tfm files)}
573
574 These are binary data files in a format designed for use by \TeX\
575 which contain (more-or-less) the same information as \afm files:
576 the size of each character in a font (font metric data), kerning,
577 and ligature information.
578
579 When you select a font in \TeX, you are telling \TeX\ to typeset
580 using a particular \tfm file; from \TeX's point of view, a \tfm
581 file (and nothing else) \emph{is} a font. \TeX\ itself doesn't
582 see printer font files, screen bitmaps, \pk files, \vf files, or
583 anything else to do with fonts: only \tfm files.
584
585 \TeX\ uses these \tfm files to decide where to put characters when
586 typesetting. From \TeX's point of view, \tfm files \emph{are}
587 fonts, even though they contain no information about the shape of
588 letters, and are rarely needed by anything except \TeX. (\Dvi drivers
589 generally read \tfm files so that they can keep track of exact glyph
590 widths and fine-tune positioning accordingly, but they would get by
591 fairly well with only the information in the printer fonts.)
592
593
594 \subsubsection{Property list files (\pl files)}
595
596 \pl files are human-readable text files which contain all the font
597 metric, kerning, ligature, and other information needed to create
598 a \tfm file. You can convert between the two file formats using
599 \tftopl and \pltotf, which are standard utilities in a \TeX\ system.
600
601
602 \subsubsection{Virtual font files (\vf files)}
603
604 These are binary data files in a format designed for use by \TeX\
605 \dvi drivers. Their main purpose in life is to replace the raw font
606 abstraction available in the printer with one more convenient for
607 \TeX. These files are used by \dvi driver software only.
608
609 \Dvi drivers use \vf files to work out what should \emph{really} be
610 printed when you ask for a particular character.
611 Technically they are like subroutine libraries for \dvi drivers,
612 with one subroutine for each character in the virtual font: when
613 the \dvi driver sees a \dvi command to set a character from a virtual
614 font, it will execute a sequence of \dvi commands (the ``mapcommands
615 property'' of this character) that it reads in the \vf file. You need
616 not worry about the details of this, as \fontinst deals with them for
617 you. Creating and using virtual fonts is what this document is about,
618 so don't worry if this doesn't make sense yet. (After all, how much
619 do you need to know about the inner workings of \dvi files to typeset
620 and print \TeX\ documents?)
621
622 Each \vf file has a \tfm file with the same name. To use a
623 virtual font, you select the \tfm file as the font to use in your
624 document. When the \dvi driver comes across this \tfm file in the
625 \dvi file, it looks up the \vf file and uses that to decide what
626 to do.
627
628
629 \subsubsection{Virtual property list files (\vpl files)}
630
631 \vpl files are human-readable text files which contain all the
632 font metric, kerning, mapping, and other information needed to
633 create a \vf and \tfm pair.
634
635 \vptovf will create a \vf/\tfm pair from a \vpl file. \vftovp
636 will create a \vpl from a \vf/\tfm pair. \vftovp also needs to be
637 able to read all the \tfm files that are referred to by a \vf to
638 recreate the \vpl\ -- it looks at the checksums to verify that
639 everything's okay.
640
641
642 \subsubsection{Font definition files (\fd files)}
643
644 These are files containing commands to tell \LaTeX\ which \tfm
645 files to associate with a request for a font using \LaTeX's font
646 selection commands.
647
648 For example, here is a small and edited part of the \fd file
649 supplied with \setpackagename{PSNFSS} to allow you to use the
650 Adobe Times font in T1 encoding:
651
652 \begin{verbatim}
653 \ProvidesFile{t1ptm.fd}
654 [1997/02/11 Fontinst v1.6 font definitions for T1/ptm.]
655
656 \DeclareFontFamily{T1}{ptm}{}
657
658 \DeclareFontShape{T1}{ptm}{m}{n} {<<->> ptmr8t}{}
659 \DeclareFontShape{T1}{ptm}{m}{it}{<<->> ptmri8t}{}
660 ...
661 \DeclareFontShape{T1}{ptm}{b}{n} {<<->> ptmb8t}{}
662 \DeclareFontShape{T1}{ptm}{b}{it}{<<->> ptmbi8t}{}
663 ...
664 \end{verbatim}
665 What this means is: when you use \LaTeX\ to select the font family
666 |ptm| in T1 encoding in the medium series (|m|) and normal shape
667 (|n|), \TeX\ uses the font \texttt{ptmr8t.tfm}. Similarly, if you
668 select bold italic, \TeX\ uses \texttt{ptmbi8t.tfm}.
669
670 \LaTeX\ works out which \fd file to load based on the current
671 encoding and font family selected. If you've selected T1 encoded
672 |ptm| like this:
673 \begin{verbatim}
674 \fontencoding{T1}\fontfamily{ptm}\selectfont
675 \end{verbatim}
676 \LaTeX\ loads the file \url{t1ptm.fd} (if it doesn't exist, you're
677 in trouble). As you can see above, this file contains information
678 so that \LaTeX\ knows which \tfm file to use. So if you ask for,
679 say, |T1/ptm/b/it| (T1 encoded Times-Roman, bold series, italic
680 shape), you get the font \texttt{ptmbi8t}.
681
682 You can find more about \fd files and \LaTeX's font selection commands
683 at CTAN:
684 \url{ftp://ftp.tex.ac.uk/tex-archive/macros/latex/base/fntguide.tex}
685 and \url{ftp://ftp.tex.ac.uk/tex-archive/info/simple-nfss.tex} are
686 both useful.
687
688
689 \subsubsection{Font mapping files (\map files)}
690
691 These are files telling \dvi drivers which printer fonts correspond to
692 specific \TeX\ fonts (\tfm files) -- how a specific \TeX\ font should
693 be \emph{mapped} onto a font concept available in the \dvi driver's
694 output format. Unlike \tfm, \fd, and \vf files,
695 which tend to be found as soon as they're in a suitable location
696 (such as the current directory), mapfiles typically need to be fully
697 installed or selected through a command-line option before any notice
698 is taken of them.
699
700 The format of mapfiles varies from driver to driver, but a common
701 format is that of \dvips, where each line is a separate entry (except
702 lines that contain comments). The first word of an entry is the
703 \TeX~font name, the second word is the basic printer font name, and
704 remaining words provide additional information (e.g., the name of the
705 file in which the font is stored).
706
707 The default in most \TeX\ systems is that fonts are assumed to be \mf
708 fonts unless there is a specific \map file entry which says otherwise.
709 Hence if you're trying to use a new Type~1 font, but the \dvi driver
710 gives you an error message that `\textit{somefile}\texttt{.mf} not
711 found', then the problem is most likely with the mapfiles.
712
713
714
715
716
717
718 \subsection{Fonts and characters}
719
720 The term `character' (or just `char') is frequently used in
721 discussions of fonts, but not always correctly, and when getting into
722 the details of what \fontinst does it is necessary to keep the
723 terminology straight.
724
725 \begin{description}
726 \item[Glyph]
727 A glyph is an image, often associated with one or several characters.
728 Some examples of glyphs are:
729 `A', `\textsf{A}', `$\mathcal{A}$', `B', `F',
730 `{\usefont{OT1}{cmr}{m}{n}f}',
731 `{\usefont{OT1}{cmr}{m}{n}fi}', `\~{}'.
732 Fonts are collections of glyphs. \Fontinst refers to glyphs by name.
733 \item[Slot]
734 This is jargon for `a numbered position in a font'. (What is
735 important is the number, and that this number refers to a position
736 in a font, but which font is usually specified separately.)
737 For typesetting, \TeX\ identifies glyphs as ``slot $n$ in font $f$''.
738 \item[Character]
739 The modern definition is that a character is the smallest component
740 of written language that has semantic value. Speaking of a
741 character, one refers to the abstract meaning, rather
742 than a specific shape.
743
744 Since fonts have often contained a unique glyph for each character
745 and each usable glyph has been assigned a particular slot,
746 it is not uncommon (in particular in older terminology) to see the
747 three mixed up, usually so that one says `character' where one of
748 the other two would have been more correct. The \TeX-related font
749 file formats is no exception, as you may see examples of elsewhere
750 in this document.
751 \item[Encoding]
752 There are really two different encoding concepts that one encounters
753 when using \fontinst. The differences are not great, and an
754 encoding of one kind often corresponds to an encoding of the other
755 kind, but it is not merely a matter of translation.
756
757 A \emph{\LaTeX\ encoding} is a mapping from characters (or more
758 formally \LaTeX\ Internal Character Representations) to slots.
759 In the \texttt{OT1} encoding, `\o' (or more technically `|\o|') maps
760 to slot~28, whereas in the \texttt{T1} encoding it maps to slot~248.
761 This kind of encoding affects what \TeX\ is doing; \dvi drivers are
762 not involved.
763
764 A \emph{font encoding} (or \emph{encoding vector}) is a mapping from
765 slots to glyph names. This is the kind of encoding that \fontinst
766 primarily deals with, and also the kind of encoding that \dvi
767 drivers make use of. \texttt{ot1.etx} associates slot~28 with
768 `\texttt{oslash}', whereas \texttt{t1.etx} and \texttt{EC.enc} (one
769 of several to \texttt{T1} corresponding encoding vectors that come
770 with \dvips) associates slot~28 with `\texttt{fi}'.
771
772 \LaTeX\ encodings occur in \fontinst only as names and only in
773 relation to \fd files. It is unlikely that you will need to create
774 one of your own. The mappings defined by font encodings are on the
775 other hand of great importance and \etx files are used to direct
776 the generation of virtual fonts. Advanced \fontinst users may well
777 find that they need to create new font encodings to achieve their
778 goals.
779 \end{description}
780
781 \fontinst creates \vpl and \pl files from \afm or \pl files to map
782 any glyph or combination of glyphs in the original font files to
783 any slot in the output font file. There, isn't that better? Off
784 you go now\ldots
785
786 % You're probably familiar with ASCII
787 % encoding, which has the letter `A' in slot~65, `B' in slot~66,
788 % and so on. That's it, really. \TeX\ uses several different
789 % encodings. The most common ones are OT1 (the original \TeX\
790 % 7~bit encoding) and T1 (the newer \TeX\ 8~bit encoding).
791 % % -- much more on this later.
792
793 The thing is that the average \PS font comes in Adobe standard
794 encoding, which, for example, has the glyph dotless~i `\i' in
795 slot~245. But \TeX\ \texttt{T1} encoding expects the glyph o~dieresis
796 `{\"o}' in that slot, and wants dotless~i in slot~25. So if you
797 tried to use a raw \PS font with \TeX, any time you tried to get
798 an `\"o', you'd get a `\i'; and every time you tried to get a `\i',
799 you'd get a blank, because Adobe standard encoding says that
800 slot~25 is empty. The process of dealing with this problem is
801 called `re-encoding', and is one thing \fontinst helps with.
802
803 % This might not make much sense yet; the best thing to do is relax.
804 % There's a lot of things that need to be dealt with when you're
805 % setting up \LaTeX\ to use a new font, so you can expect to be a
806 % bit confused until you've done it a few times.
807
808
809 \subsection{What are verbatim, typewriter, and monowidth fonts?}
810
811 The verbatim, typewriter, and monowidth concepts are common sources
812 of confusion for those who use \fontinst to install fonts
813 with \LaTeX; in particular
814 there are many misconceptions about the relation between them. The
815 official view (of which not much has actually been brought forward)
816 is that these concepts are really about three quite different things.
817
818 A font is a \emph{monowidth} (monospaced, fixed-pitch) font if all
819 glyphs in it have exactly the same width. Some font formats make
820 special provisions for such fonts; the most notable example is the
821 \afm format, where a single \texttt{CharWidth} keyword specifies the
822 width for all glyphs in the font. \Fontinst responds to this
823 by including the command
824 \begin{quote}
825 |\setint{monowidth}{1}|
826 \end{quote}
827 in the \mtx file generated from an \afm, but that is everything that is
828 hard-wired into the program. That a font is monowidth is however
829 something that one should take note of when installing it for \TeX,
830 as it means many of the glyphs in it have such a strange appearance
831 that they are (pretty much) useless. The \texttt{endash} is for
832 example usually only half as long as the \texttt{hyphen} and the
833 letters in ligature glyphs are only half as wide as normal letters.
834 Many of the \etx and \mtx files that come with \fontinst
835 contain special commands to avoid making use of such degenerate
836 glyphs.
837
838 That a font is a \emph{typewriter} font really only means that it has
839 a typewriterish look about it. The two most familiar typewriter fonts
840 are probably Computer Modern Typewriter (\texttt{cmtt}) and Courier.
841 Both of these fonts are monowidth, but there is no absolute rule about
842 this. One of the standard \TeX\ fonts is for example Computer Modern
843 Variable-width Typewriter (\texttt{cmvtt}), which is not a monowidth
844 font, as Figure~\ref{Fig:TTvsVTT} shows.
845 \begin{figure}
846 \begin{tabular}{ll}
847 \texttt{cmtt}:& \fontfamily{cmtt}\selectfont
848 The quick brown fox jumps over the lazy dog.\\
849 \texttt{cmvtt}:& \fontfamily{cmvtt}\selectfont
850 The quick brown fox jumps over the lazy dog.
851 \end{tabular}
852 \caption{Two typewriter fonts}
853 \label{Fig:TTvsVTT}
854 \end{figure}
855
856 The verbatim concept has very little to do with fonts at all; in
857 \LaTeX\ it is considered to be a property of the environment
858 (\texttt{verbatim}, \texttt{macrocode}, etc.) rather than a property
859 of the font. The connection there is with fonts is that the encoding
860 of the font must contain visible ASCII (as defined in Appendix~C
861 of \emph{The \TeX book}%~\cite{TeXbook}
862 ) as a subset for the text to
863 be rendered correctly. The \texttt{cmtt} family is the only one amongst
864 the original Computer Modern fonts which meets this criterion and
865 that is the primary grounds for the idea that these three concepts
866 should be connected. Today that reason is at best a very weak one, as
867 all \texttt{T1}-encoded fonts also meet the criterion of containing
868 visible ASCII as a subset.
869
870 A circumstance which has probably added to the confusion is that
871 \texttt{OT1} is usually claimed to be one encoding. In reality the
872 Computer Modern fonts that are declared in \LaTeX\ as being
873 \texttt{OT1} display as many as five different encodings, as shown in
874 Table~\ref{Tab:OT1-fonts}.
875 \begin{table}[!tb]
876 \DeleteShortVerb{\|}
877 \begin{tabular}{l|c|c|c|}
878 & \texttt{TEX TEXT}&
879 \begin{tabular}[b]{c}
880 \texttt{TEX TEXT}\\
881 \texttt{WITHOUT}\\
882 \texttt{F-LIGATURES}
883 \end{tabular}&
884 \begin{tabular}[b]{c}\texttt{TEX}\\
885 \texttt{TYPEWRITER}\\
886 \texttt{TEXT}
887 \end{tabular}\\
888 \hline
889 non-italic&
890 \begin{tabular}{l}
891 \texttt{cmb10}\\
892 \texttt{cmbx5}--\texttt{12}\\
893 \texttt{cmbxsl10}\\
894 \texttt{cmdunh10}\\
895 \texttt{cmff10}\\
896 \texttt{cmfib8}\\
897 \texttt{cmr6}--\texttt{17}\\
898 \end{tabular}
899 \begin{tabular}{l}
900 \texttt{cmsl8}--\texttt{12}\\
901 \texttt{cmss8}--\texttt{17}\\
902 \texttt{cmssbx10}\\
903 \texttt{cmssdc10}\\
904 \texttt{cmssi8}--\texttt{17}\\
905 \texttt{cmssq8}\\
906 \texttt{cmssqi8}\\
907 \texttt{cmvtt10}
908 \end{tabular}&
909 \begin{tabular}{l}
910 \texttt{cmcsc8}--\texttt{10}\\
911 \texttt{cmr5}
912 \end{tabular}&
913 \begin{tabular}{l}
914 \texttt{cmsltt10}\\
915 \texttt{cmtcsc10}\\
916 \texttt{cmtt8}--\texttt{12}
917 \end{tabular}\\
918 \hline
919 italic&
920 \begin{tabular}{l}
921 \texttt{cmbxti10}\\
922 \texttt{cmfi10}\\
923 \texttt{cmti7}--\texttt{12}\\
924 \texttt{cmu10}
925 \end{tabular}&&
926 \begin{tabular}{l}
927 \texttt{cmitt10}
928 \end{tabular}\\
929 \hline
930 \end{tabular}
931 \MakeShortVerb{\|}
932 \caption{``\texttt{OT1}-encoded'' Computer Modern fonts, collected
933 according to the actual font encoding}
934 \label{Tab:OT1-fonts}
935 \end{table}
936 Since most monowidth fonts are only used for setting verbatim text,
937 there is some code in \texttt{ot1.etx} which automatically chooses a
938 \texttt{TEX TYPEWRITER TEXT} encoding for the font when the
939 \texttt{monowidth} integer is set. The only reason for this is the
940 guess that this is what the user wanted.
941
942
943
944 \section{Fontmaking commands}
945
946 There are three main types of files that you may write to control what
947 \fontinst does: \emph{command files} (usually with suffix
948 \setdotfilename{tex}), \emph{encoding definition files} (suffix
949 \setdotfilename{etx}), and \emph{metric files} (suffix
950 \setdotfilename{mtx}). Command files directly tell \fontinst to do
951 things, whereas the purpose of an encoding or metric file is more to
952 store data, but all three file types are technically sequences of
953 \TeX\ commands that \fontinst execute when reading the file. Normal
954 \TeX\ syntax rules apply in all three file types, although a few
955 commands may behave in unfamiliar ways.
956
957 Within the command file category, it is possible to discern certain
958 subcategories. Most command files are written for one particular
959 task, but some are common pieces that have been factored out from
960 larger command files and are merely meant to be |\input| where
961 appropriate. (\setfilename{csc2x.tex} in the \fontinst distribution is
962 an example of this latter kind.) One may also distinguish between
963 command files that are made for use with \setfilename{fontinst.sty}
964 command definitions and command files that are made for use with
965 \setfilename{finstmsc.sty} command definitions. This section documents
966 the commands that are particular to the former category, whereas the
967 next section documents commands that are particular to the latter.
968
969
970 \subsection{Install commands}
971
972 The core fontmaking takes place within a block of ``install
973 commands''. (This name is a bit unfortunate since nothing is actually
974 installed; rather some files that need to be installed are generated.)
975 Such blocks have the structure
976 \begin{quote}
977 |\installfonts|\\
978 \m{install commands}\\
979 |\endinstallfonts|
980 \end{quote}
981 The \m{install commands} describe the fonts, glyphs and encodings used
982 to build fonts, whereas the purpose of the delimiting |\installfonts|
983 and |\end|\-|install|\-|fonts| are rather to organise the writing
984 of \fd files.
985
986 \begin{decl*}
987 |\installfonts|\\
988 |\endinstallfonts|
989 \end{decl*}
990 At |\installfonts|, \fontinst's internal list of \fd files to generate
991 are cleared. At |\endinstallfonts|, \fd files are written for those
992 combinations of encoding and font family that appeared in the
993 \meta{install commands}.
994
995 \begin{hackernote}
996 |\installfonts|, |\endinstallfonts|, and the individual
997 install commands between them also cooperate in a rather complicated
998 grouping scheme to cache glyphbases. This may interfere with
999 non-\fontinst commands in the \meta{install commands}. If for
1000 example an assignment to some |\tracing|\dots\ parameter here does
1001 not seem to have any effect, try making the assignment |\global|.
1002 \end{hackernote}
1003
1004 The most important \meta{install command} is
1005 \begin{decl*}
1006 |\installfont|\arg{font-name}\arg{metrics-list}\arg{etx-list}\\
1007 \hspace*{1.5em}\arg{encoding}\arg{family}\arg{series}%
1008 \arg{shape}\arg{size}
1009 \end{decl*}
1010 This produces a \TeX\ virtual font called \m{font-name}. The
1011 \meta{metrics-list} and the \meta{etx-list} determine this font,
1012 whereas the other arguments specify how the \fd file will declare it
1013 for \LaTeX. The \m{encoding}, \m{family}, \m{series}, and \m{shape}
1014 are precisely the NFSS parameters. The \m{size} is either a shorthand
1015 declared by \verb|\declaresize| (see below), or is an \fd size
1016 specification.
1017
1018 Like most \fontinst lists, the elements in the \meta{metrics-list} and
1019 \meta{etx-list} are separated by commas (so-called comma-separated
1020 lists). In their simplest form, the elements of these lists are file
1021 names (minus suffixes): \mtx files in the \meta{metrics-list} and
1022 \etx files in the \meta{etx-list}. First the \mtx files are processed
1023 to build up a glyphbase, i.e., store definitions of glyphs and their
1024 metric properties in memory, and then the \etx files are processed
1025 (several times) to select a set of glyphs and write the corresponding
1026 information to a \vpl file.
1027
1028 For example, to install the \texttt{T1}-encoded Times Roman font
1029 (using \texttt{t1.etx} and \texttt{latin.mtx}), you say:
1030 \begin{verbatim}
1031 \installfont{ptmr8t}{ptmr8r,latin}{t1}
1032 {T1}{ptm}{m}{n}{}
1033 \end{verbatim}
1034 To install a \texttt{OT1}-encoded Times Roman font, with a scaled
1035 version of Symbol for the Greek letters, you say:
1036 \begin{verbatim}
1037 \installfont{zptmrsy}{ptmr8r,psyr scaled 1100,latin}{ot1}
1038 {OT1}{ptm}{m}{n}{}
1039 \end{verbatim}
1040
1041 As the second example indicates, there is more to the list items than
1042 just file names. In the case of an metrics list item, the syntax
1043 permits the two forms
1044 \begin{decl*}
1045 \meta{filename}\meta{optional modifiers}\\
1046 |\metrics| \meta{metric commands}
1047 \end{decl*}
1048 \NEWfeature{v1.923}
1049 where an \meta{optional modifier} is one of
1050 \begin{decl*}
1051 \verb*| scaled |\meta{rawscale factor}\\
1052 \verb*| suffix |\meta{glyph name suffix}\\
1053 \verb*| encoding |\meta{etx}\\
1054 \verb*| option |\meta{string}
1055 \end{decl*}
1056 A list item may contain several such modifiers, but most commonly it
1057 does not contain any. The
1058 \meta{metric commands} are explicit metric commands, as described in
1059 Section~\ref{Sec:Metric}; this latter feature is meant for minor
1060 adjustments that you don't want to bother creating a separate \mtx
1061 file for.
1062
1063 The \meta{filename} above primarily refers to a file
1064 \meta{filename}\texttt{.mtx}, but that need not always exist before
1065 executing the above command. If there exists a \pl, \afm, or \vpl file
1066 with the right name then that is first converted to a corresponding
1067 \mtx file. However, a special case occurs if there is an |encoding|
1068 modifier: this forces conversion of a \pl or \vpl file even if an
1069 \mtx file exists, and also forces using the specified \etx file when
1070 assigning glyph names to the slots of that file. Normally the choice
1071 of \etx file for such conversions to \mtx is based on
1072 |\declareencoding| declarations.
1073
1074 The |scaled| modifier sets the \texttt{rawscale} variable for the
1075 processing of that file. This has the effect of scaling all raw
1076 glyphs from that file to \meta{rawscale factor} per milles of their
1077 previous size. The |suffix| modified causes the \meta{glyph name
1078 suffix} to be implicitly appended to all glyphs defined by this file.
1079 The |option| modifier adds the \meta{string} to the list of ``options''
1080 for this file. The |\ifoption| command can be used in the file to test
1081 whether a particular string has been supplied as an option.
1082
1083 \begin{hackernote}
1084 In general, \fontinst commands process comma-separated list arguments
1085 by first splitting at commas and then fully expanding each item, but
1086 this \meta{metrics-list} argument is an exception. This is first
1087 fully expanded (|\edef|) and then split into items. The difference
1088 is that a macro used in this \meta{metrics-list} argument can expand
1089 to several list items, whereas a macro used in an ordinary
1090 comma-separated list argument can only expand to (part of) a single
1091 list item.
1092
1093 The |\metrics| list items do however constitute an exception within
1094 this exception. These list items are in their entirety protected
1095 from the initial full expansion, so you don't have to worry about
1096 peculiar fragility errors there.
1097 \end{hackernote}
1098
1099 The elements in the \meta{etx-list} have fewer variants, but there is
1100 still a general syntax
1101 \begin{decl*}
1102 \meta{filename}\meta{optional modifiers}
1103 \end{decl*}
1104 The \meta{optional modifier}s permitted are:
1105 \begin{decl*}
1106 \verb*| mtxasetx|\\
1107 \verb*| option |\meta{string}
1108 \end{decl*}
1109 The \texttt{option} one is as for metric files. \texttt{mtxasetx} is
1110 probably only relevant for use with |\installrawfont| (see below).
1111
1112
1113 \begin{decl}[v1.912]
1114 |\installfontas|\arg{font-name}\\%
1115 \hspace*{1.5em}\arg{encoding}\arg{family}\arg{series}%
1116 \arg{shape}\arg{size}
1117 \end{decl}
1118 This install command adds an \fd entry for the \meta{font-name}, but
1119 it doesn't actually generate that font. Usually that font was
1120 generated by a previous |\installfont|, and this is used to create
1121 additional entries for the font.
1122
1123
1124 \begin{decl}
1125 |\installrawfont|\arg{font-name}\arg{metrics-list}\arg{etx-list}\\
1126 \hspace*{1.5em}\arg{encoding}\arg{family}\arg{series}%
1127 \arg{shape}\arg{size}
1128 \end{decl}
1129 This is similar to |\installfont| except that it produces
1130 a \TeX\ raw font as \pl file rather than a virtual font. Often a \pl
1131 file with the specified name will already exist when this command is
1132 called, and that will then be overwritten. These two \pl files will
1133 typically be somewhat different.
1134 The normal reason for using this command is that one wishes to
1135 ``refine'' the metrics of a font that was generated by transformation
1136 commands.
1137
1138 For example, to install an \texttt{8r}-encoded Times Roman raw font
1139 (using \texttt{8r.etx} and \texttt{8r.mtx}), you say:
1140 \begin{verbatim}
1141 \installrawfont{ptmr8r}{ptmr8r,8r}{8r}
1142 {8r}{ptm}{m}{n}{}
1143 \end{verbatim}
1144 (The files referred to are, in order, \texttt{ptmr8r.pl},
1145 \texttt{ptmr8r.mtx}, \texttt{8r.mtx}, and \texttt{8r.etx}.)
1146
1147 The effect of a
1148 \begin{decl*}[v1.923]
1149 \meta{filename}\verb*| mtxasetx|
1150 \end{decl*}
1151 in the \meta{etx-list} is not that \meta{filename}\texttt{.etx} is
1152 read, but that \meta{filename}\texttt{.mtx} is read. The
1153 interpretation of the commands in this file is however not the
1154 customary, and almost the only thing paid attention to is the
1155 correspondence between glyph names and slot numbers that is provided
1156 by the |\setrawglyph| and |\setscaledrawglyph| commands; this
1157 correspondence is treated as if it was given by |\setslot| \dots\
1158 |\endsetslot| commands in an \etx file. This is however only
1159 guaranteed to work with transformable metric files.
1160
1161 The purpose of this feature is to simplify installation of fonts with
1162 very special encodings, such as ``Dingbat'' or ``Pi'' fonts. Instead
1163 of creating an \etx file, which would probably only be useful with
1164 that particular font, one can make use of the fact that the
1165 interesting information is anyway available in the \mtx file. To
1166 install Zapf Dingbats in their default encoding, one can thus say
1167 \begin{verbatim}
1168 \installrawfont{pzdr}{pzdr}{pzdr mtxasetx}
1169 {U}{pzd}{m}{n}{}
1170 \end{verbatim}
1171
1172 Unlike the case with |\installfont|, which actually creates a real
1173 (although virtual) font, |\installrawfont| can only create the
1174 metrics for a font. The \dvi driver will require some other kind of
1175 implementation of this font, usually an entry in some map file (e.g.
1176 \texttt{psfonts.map}, in the case of \dvips) that links the \TeX\ font
1177 name to e.g.\ a \PS\ font name and file. (Many \dvi drivers are
1178 configured in such a way that they, without such a map file entry,
1179 will call Metafont with the font name and thereby raise a sequence of
1180 error messages about a \setdotfilename{mf} that doesn't exist. These
1181 results are often rather confusing.)
1182
1183
1184
1185 \begin{decl}
1186 |\installfamily|\arg{encoding}\arg{family}\arg{fd-commands}
1187 \end{decl}
1188 This tells \fontinst to write an \fd file for the given combination
1189 of encoding and family, and clears the internal list of entries to
1190 put in that file. |\installfamily| commands usually come first in each
1191 block of \meta{install commands}.
1192
1193 For example, if you intend to produce a \texttt{T1}-encoded Times
1194 family of fonts, you say:
1195 \begin{verbatim}
1196 \installfamily{T1}{ptm}{}
1197 \end{verbatim}
1198 The \m{fd-commands} are executed every time a font in that family is
1199 loaded, for example to stop the Courier font from being hyphenated you
1200 say:
1201 \begin{verbatim}
1202 \installfamily{T1}{pcr}{\hyphenchar\font=-1}
1203 \end{verbatim}
1204 In more recent versions of \fontinst, the |\installfamily| command is
1205 only necessary if you want the \m{fd-commands} argument to be
1206 nonempty, but it doesn't hurt to make it explicit.
1207
1208 \begin{hackernote}
1209 The \m{fd-commands} argument is tokenized with the current catcodes
1210 and written to file without expansion. In particular this means
1211 that spaces will be inserted after all control sequences whose
1212 names consists of letters, which can be unexpected if you intend to
1213 make use of control sequences whose names contain |@| characters.
1214
1215 One way around this is to use |\fontinstcc| and |\normalcc| to
1216 temporarily switch catcodes around the |\installfamily| command.
1217 \end{hackernote}
1218
1219
1220
1221 \subsection{Transformation commands}
1222
1223
1224 \begin{decl}
1225 |\transformfont|\arg{font-name}\arg{transformed font}
1226 \end{decl}
1227 This makes a raw transformed font, for example expanded, slanted,
1228 condensed or re-encoded. \emph{It is the responsibility of the device
1229 driver to implement this transform.} Each \verb|\transformfont|
1230 command writes out an \mtx file and a raw \pl file for \m{font-name}.
1231
1232 The following commands are valid \m{transformed font}s:
1233 \begin{decl*}
1234 |\fromafm|\arg{afm}\\
1235 |\fromany|\arg{whatever}\\
1236 |\frompl|\arg{pl}\\
1237 |\fromplgivenetx|\marg{pl}\marg{etx}\\
1238 |\frommtx|\arg{mtx}
1239 \end{decl*}
1240 These read the metrics of the font which is about to be transformed from
1241 an external file. |\fromafm|, |\frompl|, and |\fromplgivenetx| write out
1242 an \mtx file corresponding to the \afm or \pl file. In addition,
1243 |\fromafm| also writes out a raw \pl file, containing just the glyph
1244 metrics but no kerning information. |\fromplgivenetx| permits
1245 specifying which encoding file to use when associating glyph names to
1246 slots, whereas |\frompl| tries to guess this from the
1247 \texttt{CODINGSCHEME} property of the \pl file. |\fromany| looks for
1248 a file in any of the formats (in the order \mtx, \pl, \afm) and
1249 behaves as the first |\from|\dots\ for which it found a file.
1250
1251 A \m{transformed font} may also be one of the following:
1252 \begin{decl*}
1253 |\scalefont|\arg{integer expression}\arg{transformed font}\\
1254 |\xscalefont|\arg{integer expression}\arg{transformed font}\\
1255 |\yscalefont|\arg{integer expression}\arg{transformed font}\\
1256 |\slantfont|\arg{integer expression}\arg{transformed font}
1257 \end{decl*}
1258 This applies a geometric transformation to the font metrics of
1259 \m{transformed font}. The scale factor or slant factor are given in
1260 units 1000 to the design size. Typical examples are 167 for slanted
1261 fonts (a slant of $\frac{1}{6}$) or 850 for condensed fonts (shrunk
1262 to 85\% of their natural width).
1263
1264 The final case of a \m{transformed font} is:
1265 \begin{decl*}
1266 |\reencodefont|\arg{etx}\arg{transformed font}
1267 \end{decl*}
1268 This rearranges the encoding vector of \m{transformed font} to match
1269 the encoding given by the \etx file.
1270
1271
1272 For example, to create an oblique, |8r|-encoded version of Adobe Times
1273 called \texttt{ptmro8r} you say:
1274 \begin{verbatim}
1275 \transformfont{ptmro8r}{
1276 \reencodefont{8r}{
1277 \slantfont{167}{\fromafm{ptmr8a}}
1278 }
1279 }
1280 \end{verbatim}
1281 This will create \texttt{ptmr8a.mtx}, \texttt{ptmr8a.pl},
1282 \texttt{ptmro8r.mtx} and \texttt{ptmro8r.pl}, which can then be used
1283 as raw fonts in \verb|\installfont| commands. The equivalent
1284 transformation can also be achieved in two steps:
1285 \begin{verbatim}
1286 \transformfont{ptmr8r}{\reencodefont{8r}{\fromafm{ptmr8a}}}
1287 \transformfont{ptmro8r}{\slantfont{167}{\frommtx{ptmr8r}}}
1288 \end{verbatim}
1289 This will create \texttt{ptmr8a.mtx}, \texttt{ptmr8a.pl},
1290 \texttt{ptmr8r.mtx}, \texttt{ptmr8r.pl}, \texttt{ptmro8r.mtx} and
1291 \texttt{ptmro8r.pl}.
1292
1293 You will have to inform your device driver about the transformed font,
1294 using the syntax appropriate for that driver. For example, in \dvips
1295 you add a line to \texttt{psfonts.map}:
1296 \begin{verbatim}
1297 ptmro8r Times-Roman ".167 SlantFont TeXBase1Encoding ReEncodeFont" <<8r.enc
1298 \end{verbatim}
1299 See Section~\ref{Sec:Mapmaking} and
1300 Subsection~\ref{Ssec:MapFragments} for details on how to generate
1301 such lines automatically.
1302
1303
1304 \subsection{The \cs{latinfamily} command}
1305
1306
1307 \begin{decl}
1308 |\latinfamily|\marg{family}\marg{commands}
1309 \end{decl}
1310 This command is by itself an entire |\installfonts| \dots\
1311 |\endinstallfonts| block, automatically doing |\transformfont|s,
1312 |\installfont|s, and |\install|\-|raw|\-|font|s depending on which
1313 base font metrics it finds. It generates virtual fonts in the
1314 \texttt{T1}, \texttt{OT1}, and \texttt{TS1} encodings.
1315
1316 There is really much to much about this command for it to be described
1317 in full here. Please see other available documentation.
1318
1319 \begin{decl}
1320 |\fakenarrow|\marg{width factor}
1321 \end{decl}
1322 This command makes |\latinfamily| fake `narrow' fonts in the family it
1323 is working on, by $x$-scaling the normal fonts. The \meta{width factor}
1324 is the scale factor to use.
1325
1326
1327 \subsection{Reglyphing commands}
1328
1329 ``Reglyphing'' is an \mtx file transformation that changes glyph
1330 names but leaves the slot numbers and metrics as they were;
1331 optionally it may drop some of the metric commands. See
1332 Subsection~\ref{Ssec:Des:Reglyph} for an introduction to this.
1333
1334 Like installation commands, reglyphing commands are preferably placed
1335 in a block between two delimiter commands:
1336 \begin{decl*}
1337 |\reglyphfonts|\\
1338 \meta{reglyphing commands}\\
1339 |\endreglyphfonts|
1340 \end{decl*}
1341 The purpose of these delimiter commands is to delimit the scope in
1342 which the various declarations made take effect. After
1343 |\endreglyphfont|, you're back to the ``clean'' state that existed
1344 before the |\reglyphfont|.
1345
1346 \begin{decl}
1347 |\reglyphfont|\marg{destination font}\marg{source font}
1348 \end{decl}
1349 This is the only command that actually does something; all the other
1350 commands simply set parameters for the processing carried out here.
1351 What the command does is that it reads the \meta{source font} (which
1352 may be in \mtx, \pl, \afm, or \vpl format, but will be converted to
1353 \mtx before it is read for reglyphing) and writes each command back to
1354 the \meta{destination font} (in \mtx format \emph{only}), but often
1355 with some subtle modifications.
1356
1357 It should be observed that the ``destination font'' generated by this
1358 command is not a real font, but just an \mtx file. If that \mtx file
1359 contains raw glyph defintions (|\setscaledrawglyph| commands) then
1360 these will refer to the \meta{source font}, so that is all a \dvi
1361 driver needs to be informed about.
1362
1363 \begin{decl}
1364 |\renameglyph|\marg{to}\marg{from}\\
1365 |\renameglyphweighted|\marg{to}\marg{from}\marg{weight}\\
1366 |\killglyph|\marg{glyph}\\
1367 |\killglyphweighted|\marg{glyph}\marg{weight}
1368 \end{decl}
1369 The |\renameglyph| and |\renameglyphweighted| commands cause each
1370 reference to the glyph \meta{from} in the source font to be replaced
1371 by a reference to the glyph \meta{to} in the destination font. Thus if
1372 the source font contains a command that sets a glyph with the name
1373 \meta{from}, then this will in the destination font be changed to a
1374 command that sets a glyph with the name \meta{to}, but with the same
1375 metrics, slot, and base font name as in the source font. Kerns are
1376 similarly adjusted to be for the \meta{to} glyph.
1377
1378 There is also a ``weight'' associated with each command being copied
1379 from source font to destination font, and if that weight is too small
1380 then the command will be omitted from the destination font. The weight
1381 of a command is the sum of the weights of all glyphs mentioned in that
1382 command. A glyph for which no settings have been made has weight $0$.
1383 A glyph name which is the \meta{from} of a |\renameglyphweighted| or
1384 the \meta{glyph} of a |\killglyphweighted| has the \meta{weight}
1385 specified there. A \meta{from} glyph of a |\renameglyph| gets the
1386 weight stored in the \texttt{renameweight} integer variable
1387 (by default $1$) and the \meta{glyph} of a |\killglyph| gets the
1388 weight stored in the \texttt{killweight} integer variable (by default
1389 $-10$). It is this large negative weight that makes |\killglyph|
1390 ``kill'' glyphs.
1391
1392 The weight condition for keeping a command is given by the
1393 |\iftokeep| command, which is regarded as a \fontinst command
1394 variable (see Section~\ref{Sec:Variables}). The default definition is
1395 to keep things with non-negative weight (typically everything that
1396 doesn't involve a glyph that has been killed), but for example
1397 \setfilename{csckrn2x.tex} redefines it to only keep things with
1398 positive weight (typically everything involving at least one glyph
1399 that has been renamed and not any that has been killed).
1400
1401
1402 \begin{decl}
1403 |\offmtxcommand|\marg{command}\\
1404 |\onmtxcommand|\marg{command}
1405 \end{decl}
1406 Turning a command `off' using |\offmtxcommand| means no such commands
1407 are to be copied to a destination font by |\reglyphfont|. Turning it
1408 back `on' using |\onmtxcommand| restores it to normal, i.e., whether
1409 it is copied depends on the weight of the command.
1410
1411 \begin{hackernote}
1412 |\offmtxcommand| and |\onmtxcommand| are wrappers around the
1413 general-purpose |\offcommand| and |\oncommand| commands (see
1414 Subsection~\ref{Ssec:Variables}). The wrapping makes the general
1415 commands to act on a family of internal macros, namely those which
1416 are used by |\reglyphfont| as definitions of the transformable
1417 metric commands.
1418 \end{hackernote}
1419
1420
1421 \subsection{Miscellaneous settings}
1422
1423 \begin{decl}
1424 |\substitutesilent|\arg{to}\arg{from}\\
1425 |\substitutenoisy|\arg{to}\arg{from}
1426 \end{decl}
1427 This declares a \LaTeX\ font substitution, that the series or shape
1428 \m{to} should be substituted if necessary by the series or shape
1429 \m{from}. Font substitutions happen at |\endinstallfonts| time, and
1430 cause font declarations using |sub| or |ssub| to be added to the \fd
1431 files being written.
1432
1433 \verb|\substitutenoisy| means that a warning will be given when
1434 the substitution is made by \LaTeX.
1435 \verb|\substitutesilent| means that \LaTeX\ should not warn when
1436 the font substitution is made.
1437
1438 For example, to say that the series |bx| can be replaced by the
1439 series |b| (a request for series |bx| selects a font with actual series
1440 |b|), you say:
1441 \begin{verbatim}
1442 \substitutesilent{bx}{b}
1443 \end{verbatim}
1444 To say that the shape |ui| can be replaced by the shape |it| (a
1445 request for shape |ui| selects a font with actual shape |it|), you say:
1446 \begin{verbatim}
1447 \substitutenoisy{ui}{it}
1448 \end{verbatim}
1449
1450 The following weight substitutions are standard:
1451 \begin{verbatim}
1452 \substitutesilent{bx}{b}
1453 \substitutesilent{b}{bx}
1454 \substitutesilent{b}{sb}
1455 \substitutesilent{b}{db}
1456 \substitutesilent{m}{mb}
1457 \substitutesilent{m}{l}
1458 \end{verbatim}
1459 The following shape substitutions are standard:
1460 \begin{verbatim}
1461 \substitutenoisy{ui}{it}
1462 \substitutesilent{it}{sl}
1463 \substitutesilent{sl}{it}
1464 \end{verbatim}
1465 In order to disable a default substitution, use the \meta{from} for
1466 both arguments.
1467
1468 The |\installfontas| command should be considered as an
1469 alternative to using font substitution, as it gives much finer
1470 control over what \fd entries will be made.
1471
1472
1473 \begin{decl}
1474 |\declaresize|\arg{size}\arg{fd-size-range}
1475 \end{decl}
1476 This declares a new size shorthand, and gives the \fd size
1477 specifications for it. For example, \url{fontinst.sty} declares
1478 the following sizes:
1479 \begin{verbatim}
1480 \declaresize{}{<<->>}
1481 \declaresize{5}{<<5>>}
1482 \declaresize{6}{<<6>>}
1483 \declaresize{7}{<<7>>}
1484 \declaresize{8}{<<8>>}
1485 \declaresize{9}{<<9>>}
1486 \declaresize{10}{<<10>>}
1487 \declaresize{11}{<<10.95>>}
1488 \declaresize{12}{<<12>>}
1489 \declaresize{14}{<<14.4>>}
1490 \declaresize{17}{<<17.28>>}
1491 \declaresize{20}{<<20.74>>}
1492 \declaresize{25}{<<24.88>>}
1493 \end{verbatim}
1494 The first of these is what gives an empty \meta{size} argument for
1495 the font installation commands the meaning ``all sizes''.
1496
1497 \begin{decl}
1498 |\declareencoding|\arg{string}\arg{etx}
1499 \end{decl}
1500 This declares which \etx file corresponds to which
1501 \texttt{CODINGSCHEME} string, and is used when reading metrics in \pl
1502 format. For example, \url{fontinst.sty} declares the following
1503 encoding strings:
1504 \begin{verbatim}
1505 \declareencoding{TEX TEXT}{ot1}
1506 \declareencoding{TEX TEXT WITHOUT F-LIGATURES}{ot1}
1507 \declareencoding{TEX TYPEWRITER TEXT}{ot1tt}
1508 \declareencoding{TEX MATH ITALIC}{oml}
1509 \declareencoding{TEX MATH SYMBOLS}{oms}
1510 \declareencoding{TEX MATH EXTENSION}{omx}
1511 \declareencoding{EXTENDED TEX FONT ENCODING - LATIN}{t1}
1512 \declareencoding{TEX TEXT COMPANION SYMBOLS 1---TS1}{ts1}
1513 \declareencoding{TEXBASE1ENCODING}{8r}
1514 \declareencoding{TEX TYPEWRITER AND WINDOWS ANSI}{8y}
1515 \end{verbatim}
1516
1517
1518 \subsection{Low-level conversion commands}
1519
1520 The following commands are the low-level commands which carry out
1521 various conversions. There's usually no need to bother about them
1522 unless you are hacking \fontinst, but you may see them in the header
1523 comments of files \fontinst generates, so here's a description of what
1524 they do and when they are used.
1525
1526 \begin{decl}
1527 |\afmtomtx|\marg{afmfile}\marg{mtxfile}\\
1528 |\generalpltomtx|\marg{plfile}\marg{mtxfile}%
1529 \marg{plsuffix}\marg{opt-enc}
1530 \end{decl}
1531 These handle importing font metric data to the \fontinst native \mtx
1532 format.
1533
1534 |\afmtomtx| converts metrics in \afm format. It uses the
1535 \texttt{minimumkern} integer variable and the |\slanteditalcorr| and
1536 |\uprightitalcorr| command variables.
1537
1538 |\generalpltomtx| converts metrics in \pl or \vpl format. If the
1539 \meta{opt-enc} string expression is nonempty then that is taken as the
1540 name of an \etx file that assigns glyph names to the slots in the font.
1541
1542 \begin{decl}
1543 |\mtxtomtx|\marg{source MTX}\marg{destination MTX}
1544 \end{decl}
1545 This is the heart of the |\transformfont| command. It makes use of the
1546 \texttt{x-scale}, \texttt{y-scale}, and \texttt{slant-scale} integer
1547 variables, and the \texttt{etx-name} string variable.
1548
1549 \begin{decl}
1550 |\mtxtopl|\marg{mtxfile}\marg{plfile}
1551 \end{decl}
1552 This converts \mtx metrics to \pl format; more precisely it generates
1553 \texttt{CHARACTER} property lists for |\setrawglyph| and
1554 |\setscaledrawglyph| commands. Kerning information is ignored.
1555
1556 The command is used immediately after an |\afmtomtx| or |\mtxtomtx|.
1557 The invariant is that if there can be some |\setrawglyph| or
1558 |\setscaledrawglyph| command which refers to a glyph in some font,
1559 then there must also be a \pl file with metrics for that font.
1560
1561 \begin{decl}
1562 |\etxtovpl|\marg{encoding list}\marg{vplfile}\\
1563 |\etxtopl|\marg{encoding list}\marg{plfile}
1564 \end{decl}
1565 These are the cores of |\installfont| and |\installrawfont|
1566 respectively. They don't really convert files---it's more like
1567 generating a \vpl or \pl under the control of the \etx.
1568
1569
1570
1571
1572
1573
1574 \subsection{Other}
1575
1576 The following commands also belong in this section, but don't belong
1577 to any of the major groups.
1578
1579 \begin{decl}
1580 |\recordtransforms|\marg{filename}\\
1581 |\endrecordtransforms|
1582 \end{decl}
1583 See Subsection~\ref{Ssec:MapFragments} for an explanation of how these
1584 are used.
1585
1586 \begin{decl}
1587 |\NOFILES|
1588 \end{decl}
1589 This command switches off file generation, and causes \fontinst to
1590 only generate empty files. It only affects the user level commands,
1591 so it is primarily of use when debugging commands that build on
1592 these, such as for example the |\latin|\-|family| command.
1593
1594
1595
1596
1597
1598 \section{Mapmaking commands}
1599 \label{Sec:Mapmaking}
1600
1601 The commands described in this section are for use with command files
1602 that input \texttt{finstmsc.sty}.
1603
1604
1605 \subsection{Mapfile command reference}
1606
1607 For an introduction to making map file entries, see
1608 Subsection~\ref{Ssec:MapFragments}.
1609
1610 \begin{decl}
1611 |\adddriver|\marg{driver name}\marg{fragment file name}
1612 \end{decl}
1613 This opens the file \meta{fragment file name} for writing mapfile
1614 entries to. The \meta{driver name} selects the format of these
1615 entries. \emph{Note} that if the \meta{fragment file name} does not
1616 include a suffix, it will get the suffix \setfilename{tex}, which is
1617 probably not what you want.
1618
1619 \begin{decl}
1620 |\makemapentry|\marg{\TeX\ font name}
1621 \end{decl}
1622 This causes a mapfile entry for the specified font to be written to
1623 all files currently open for receiving mapfile entries. These
1624 commands are usually automatically generated by \fontinst.
1625
1626 \begin{decl}
1627 |\donedrivers|
1628 \end{decl}
1629 This closes all files open for receiving mapfile entries.
1630
1631
1632 \subsection{Drivers}
1633
1634 The \meta{driver name}s that may be used with |\adddriver| are:
1635
1636 \begin{decl}
1637 |dvips|
1638 \end{decl}
1639 The \dvips driver. The mapfiles generated are useful also with
1640 pdf\TeX, but one does not always use the exact same file for both;
1641 sometimes they require different settings.
1642
1643 \begin{decl}
1644 |dvipdfm|
1645 \end{decl}
1646 The \setpackagename{dvipdfm} \dvi-to-\pdf driver. Not much tested,
1647 but appears to work.
1648
1649 \begin{decl}[v1.915]
1650 |pltotf|
1651 \end{decl}
1652 Not really a \dvi driver. The file that is generated is a shell
1653 script of \texttt{pltotf} commands for converting precisely those \pl
1654 files which are needed to \tfm files (\fontinst generally generates
1655 also a bunch of \pl files that in the end turn out to be
1656 unnecessary). The \texttt{TFMfileprefix} variable can be used to
1657 specify a path to the directory where these files should be placed.
1658
1659 \begin{decl}
1660 |debug|
1661 \end{decl}
1662 Not a \dvi driver either, but for each base font a report on the
1663 information that was available. Useful if you need to write the
1664 driver file yourself.
1665
1666 \begin{hackernote}
1667 Creating a new driver \meta{foo} is mostly a matter of suitably
1668 defining the |\make_|\meta{foo} command.
1669 \end{hackernote}
1670
1671
1672 \subsection{Configuration commands}
1673 \label{Ssec:MapConfig}
1674
1675 The following commands configure the generation of mapfile entries,
1676 mostly with respect to how various pieces of information are deduced
1677 from other pieces.
1678
1679 \begin{decl}
1680 |\AssumeAMSBSYY|\\
1681 |\AssumeBaKoMa|\\
1682 |\AssumeMetafont|
1683 \end{decl}
1684 These commands change what the map file writer does when it needs to
1685 know the \PS name for a font but only knows the \TeX\ name. This
1686 usually happen when the metrics came from a \pl file.
1687
1688 |\AssumeAMSBSYY| tells it to uppercase the \TeX\ name and use that as
1689 \PS name; this is correct for the AMS\slash Blue~Sky\slash Y\&Y
1690 conversions of the Computer Modern fonts.
1691
1692 |\AssumeBaKoMa| tells it to lowercase the \TeX\ name and use that as
1693 \PS name; this is correct for the BaKoMa conversions of the Computer
1694 Modern fonts.
1695
1696 |\AssumeMetafont| tells it to ignore base fonts for which no \PS name
1697 is known, on the assumption that they are \mf fonts.
1698
1699
1700 \begin{decl}
1701 |\AssumeLWFN|
1702 \end{decl}
1703 This commands changes what the map file writer does when it needs to
1704 know the name of the file in which a \PS font is stored. The file name
1705 is constructed from the \PS font name using the $5+3+3+\cdots$
1706 convention used in (Classic) Mac~OS.
1707
1708 By default \fontinst uses as \PS font file name the \TeX\ name of the
1709 font (i.e., the name of the source \afm or whatever file) and appends
1710 to that the contents of the \texttt{PSfontsuffix} string.
1711
1712 For fonts which fit neither of these schemes, one can give individual
1713 specifications using the command
1714 \begin{decl*}
1715 |\specifypsfont|\marg{PS font name}\marg{actions}
1716 \end{decl*}
1717 Note that the font is here identified using its \PS font name, not the
1718 \TeX\ font name.
1719
1720 An \meta{action} is one of\footnote{Additional actions can be added
1721 in the future, if there is a need for them. It is not a problem if not
1722 all driver can support an action, since all actions typically default
1723 to \cs{download}.}
1724 \begin{decl*}[v1.928]
1725 |\download|\marg{file}\\
1726 |\fulldownload|\marg{file}
1727 \end{decl*}
1728 where \meta{file} is a file to download (`download' typically means
1729 ``include in the generated \PS output or equivalent''). The difference
1730 between |\download| and |\fulldownload| have to do with how partial
1731 downloading (subsetting) of fonts should be handled. |\download| means
1732 use the driver's defaults (often settable via command line options)
1733 for this. |\fulldownload| means don't subset: always include the full
1734 font, if \fontinst knows how to express this in a map file entry for
1735 this particular driver.
1736
1737 If FooBar-Regular is a non-subsettable font, then you may specify this
1738 to \fontinst through a command like
1739 \begin{verbatim}
1740 \specifypsfont{FooBar-Regular}{\fulldownload{foobar.pfb}}
1741 \end{verbatim}
1742 To specify that the PDF ``base 14'' fonts do not require downloading,
1743 one would say
1744 \begin{verbatim}
1745 \specifypsfont{Courier}{}
1746 \specifypsfont{Courier-Bold}{}
1747 \specifypsfont{Courier-BoldOblique}{}
1748 \specifypsfont{Courier-Oblique}{}
1749 \specifypsfont{Helvetica}{}
1750 \specifypsfont{Helvetica-Bold}{}
1751 \specifypsfont{Helvetica-BoldOblique}{}
1752 \specifypsfont{Helvetica-Oblique}{}
1753 \specifypsfont{Times-Roman}{}
1754 \specifypsfont{Times-Bold}{}
1755 \specifypsfont{Times-Italic}{}
1756 \specifypsfont{Times-BoldItalic}{}
1757 \specifypsfont{Symbol}{}
1758 \specifypsfont{ZapfDingbats}{}
1759 \end{verbatim}
1760 When more than one action appears in the \meta{actions} argument,
1761 then it is usually the last that actually creates the font, whereas
1762 the others contain resources needed by the last.
1763
1764
1765 \begin{decl}
1766 |\declarepsencoding|\marg{etx}\marg{postscript name}\marg{action}
1767 \end{decl}
1768 This command specifies how reencoding using a particular \etx file
1769 should be performed by the driver. The \meta{postscript name} is the
1770 \PS name of the encoding vector used, whereas the \meta{action} is the
1771 action (as above) that the driver needs to perform to make the
1772 encoding known to whatever it is that it is serving (often a \PS
1773 interpreter).
1774
1775 Usually the right thing to do is to |\download| an \enc file, but
1776 there is also an action
1777 \begin{decl*}[v1.931]
1778 |\encodingdownload|\marg{file}
1779 \end{decl*}
1780 which tries to express the fact that the \meta{file} contains an
1781 encoding vector. In the case of \dvips this is only necessary if
1782 (i)~the font is being subsetted and (ii)~the \meta{file} name is
1783 nonstandard (does not end with \enc).
1784
1785 \begin{decl}[v1.931]
1786 |\providepsencoding|\marg{etx}\marg{postscript name}\marg{action}
1787 \end{decl}
1788 This command is the same as |\declarepsencoding|, except that it
1789 doesn't do anything if an encoding has already been declared for this
1790 \meta{etx}. It is used for autogenerated encoding declarations, so
1791 that these will not override one issued by the user.
1792
1793
1794
1795 \begin{decl}
1796 |\storemapdata|\marg{\TeX\ font name}\marg{source}\marg{transforms}
1797 \end{decl}
1798 This records information about how the font named \meta{\TeX\ font
1799 name} was generated. Such commands are usually found in the file of
1800 recorded transforms. If a font is encountered for which no
1801 information has been stored, then the corresponding \mtx file will be
1802 sourced, looking for a |\storemapdata| command there.
1803
1804 A \meta{source} is one of
1805 \begin{decl*}
1806 |\fromafm|\marg{\afm name}\marg{PS name}\\
1807 |\frompl|\marg{\pl name}\\
1808 |\frommtx|\marg{\mtx name}\\
1809 |\fromvpl|
1810 \end{decl*}
1811 Note that several of them have a different syntax and meaning than
1812 they do in fontmaking command files.
1813
1814 A \meta{transform} is one of
1815 \begin{decl*}
1816 |\reencodefont|\marg{etx}\\
1817 |\reglyphfont|\\
1818 |\transformfont|\marg{x-scale}\marg{slant-scale}
1819 \end{decl*}
1820 Note that all of these have a different meaning than they do in
1821 fontmaking command files.
1822
1823 \begin{decl}
1824 |\debugvalue|\arg{name}
1825 \end{decl}
1826 This adds a value to the list of those that are reported by the
1827 \texttt{debug} driver. Example:
1828 \begin{verbatim}
1829 \debugvalue{PS_font_file}
1830 \end{verbatim}
1831
1832
1833
1834 \subsection{Basic conversion commands}
1835
1836 Some of the basic ``convert an $X$ file to a $Y$ file'' commands in
1837 \fontinst are not useful as part of a fontmaking run, and are
1838 available only in \texttt{finstmsc.sty} to conserve some memory.
1839
1840 \begin{decl}
1841 |\enctoetx|\marg{encfile}\marg{etxfile}
1842 \end{decl}
1843 This reads the file \meta{encfile}\texttt{.enc} which should be
1844 simple \PS code defining a \PS encoding vector and generates a
1845 corresponding rudimentary \fontinst encoding file
1846 \meta{etxfile}\texttt{.etx}. It's a basic ``import encoding to
1847 \fontinst'' command.
1848
1849 \begin{decl}[v1.911]
1850 |\etxtoenc|\marg{etxfiles}\marg{encfile}
1851 \end{decl}
1852 This does the opposite of |\enctoetx|; the information in the \etx
1853 files that is converted is the correspondence between slots and glyph
1854 names.
1855 \NEWfeature{v1.927}
1856 The \meta{etxfiles} argument is a comma-separated list of encoding
1857 files which are superimposed to generate the \PS encoding. The first
1858 |\setslot| for a particular slot is the one which decides which glyph
1859 will be placed there.
1860
1861 \begin{decl}[v1.928]
1862 |\etxtocmap|\marg{etxfile}\marg{cmapfile}
1863 \end{decl}
1864 This reads an \etx file and generates a corresponding ToUnicode CMap
1865 file; the information that is converted is the map from slot numbers
1866 to |\Unicode| code points.
1867
1868
1869
1870
1871 \section{General commands}
1872
1873
1874
1875 This section describes commands and mechanisms that are the same in
1876 all file types. Commands that are particular for one type of file are
1877 described in subsequent sections.
1878
1879
1880 \subsection{Variables}
1881 \label{Ssec:Variables}
1882
1883 Many (but not all) of the activities \fontinst perform can be
1884 understood as either ``setting variables'' or ``formatting and writing
1885 to file data stored in some variable''. The accessing of variables is
1886 an important aspect of how \fontinst works.
1887
1888 Variables come in different types and variables of different types
1889 live in different namespaces; |\int{foo}|, |\str{foo}|, and
1890 |\dim{foo}| refer to three different variables which are all named
1891 |foo|. Variables are either set or not set. Unless the contrary is
1892 stated explicitly, each variable defaults to not being set. It is an
1893 error to access the value of a variable that has not been set.
1894 \Fontinst variable assignments are as a rule local, i.e., will be
1895 undone when the enclosing \TeX\ group is ended. Most command file
1896 commands that cause files to be read will begin a group before
1897 reading the file(s) and end the group at some point after having
1898 read them.
1899
1900 Taking string variables as an example, there are three commands for
1901 changing a string variable:
1902 \begin{decl*}
1903 |\setstr|\arg{name}\arg{string expression}\\
1904 |\resetstr|\arg{name}\arg{string expression}\\
1905 |\unsetstr|\arg{name}
1906 \end{decl*}
1907 The |\resetstr| command unconditionally sets the string variable
1908 \meta{name} to the full expansion of the \meta{string expression}.
1909 The |\unsetstr| command unconditionally renders the string variable
1910 \meta{name} unset. If the the string variable \meta{name} is
1911 currently unset then the |\setstr| command will set it to the full
1912 expansion of the \meta{string expression}, but if it already is set
1913 then |\setstr| does nothing.
1914
1915 This pattern with three commands, one |\set|\dots\ which only sets
1916 unset variables, one |\reset|\dots\ which sets variables regardless of
1917 whether they have been set or not, and one |\unset|\dots\ which unsets
1918 variables is recurring in \fontinst. Variables are most commonly set
1919 using some |\set|\dots\ command; this has the effect that the first
1920 command to try to set a variable is the one which actually sets it.
1921
1922 If |\set|\dots\ is the command for setting the value of a variable,
1923 the command for getting that value has the same name without the
1924 |set| part, e.g., |\setint|--|\int|, |\setglyph|--|\glyph|, etc.
1925 (Notable exceptions are |\setkern|, where the ``get'' command is
1926 called |\kerning|, and |\setcommand|, where no separate ``get''
1927 command is needed.) There
1928 are typically also conditionals for testing whether variables are
1929 set, and these take the form |\ifis|\dots\arg{name}|\then|.
1930
1931 \medskip
1932 % The following commands for changing the value of a variable can be
1933 % used anywhere:
1934
1935 \begin{decl}
1936 |\setdim|\arg{dim}\arg{dimension}\\
1937 |\setint|\arg{int}\arg{integer expression}\\
1938 |\setstr|\arg{str}\arg{string expression}
1939 \end{decl}
1940 If the dimension variable \m{dim} is currently undefined, it is
1941 defined to be the current value of \m{dimension}.
1942
1943 If the integer variable \m{int} is currently undefined, it is
1944 defined to be the current value of \m{integer expression}.
1945
1946 If the string variable \m{str} is currently undefined, it is
1947 defined to be the current value of \m{string expression}.
1948
1949 \begin{decl}
1950 |\setcommand|\arg{command}\meta{parameter text}\arg{replacement text}
1951 \end{decl}
1952 If the command \m{command} is currently undefined, it is defined to
1953 grab parameters as specified by the \meta{parameter text} and then
1954 expand to the \m{replacement text}. This uses the same syntax for
1955 parameters as the \TeX\ \verb|\def| command.
1956 \begin{center}
1957 \begin{tabular}{r l}
1958 Number of parameters& \meta{parameter text}\\
1959 0& (empty)\\
1960 1& |#1|\\
1961 2& |#1#2|\\
1962 3& |#1#2#3|\\
1963 \multicolumn{2}{c}{and so on.}
1964 \end{tabular}
1965 \end{center}
1966 Some examples:
1967 \begin{verbatim}
1968 \setcommand\lc#1#2{#2}
1969 \setcommand\lc#1#2{#1small}
1970 \end{verbatim}
1971 With the first definition, |\lc{A}{a}| expands to |a|, but with the
1972 second it expands to |Asmall|.
1973
1974 \begin{decl}
1975 |\resetdim|\arg{dim}\arg{dimension}\\
1976 |\resetint|\arg{int}\arg{integer expression}\\
1977 |\resetstr|\arg{str}\arg{string expression}
1978 \end{decl}
1979 The dimension variable \m{dim} is defined to be the current value
1980 of \m{dimension}.
1981
1982 The integer variable \m{int} is defined to be the current value of
1983 \m{integer expression}.
1984
1985 The string variable \m{str} is defined to be the current value of
1986 the \m{string expression}. (|\resetstr| mostly boils down to a \TeX\
1987 |\edef| command.)
1988
1989 \begin{decl}
1990 |\resetcommand|\arg{command}\meta{parameter text}\arg{replacement text}
1991 \end{decl}
1992 The command \m{command} is defined to grab parameters as specified by
1993 the \meta{parameter text} and then expand to the \m{replacement text}.
1994 This is a synonym for the \TeX\ \verb|\def| command.
1995
1996 \begin{decl}
1997 |\unsetdim|\arg{dim}\\
1998 |\unsetint|\arg{int}\\
1999 |\unsetstr|\arg{str}\\
2000 |\unsetcommand|\arg{command}
2001 \end{decl}
2002 Makes \m{dim}, \m{int}, \m{str}, or \m{command} an undefined
2003 dimension, integer, string or command.
2004
2005 \begin{decl}[v1.900]
2006 |\offcommand|\marg{command}\\
2007 |\oncommand|\marg{command}
2008 \end{decl}
2009 |\offcommand| turns off a command, i.e., it redefines it to do
2010 nothing (while still taking the same number of arguments).
2011 |\oncommand| turns a command back on, i.e., it restores the
2012 definition the command had before a previous |\offcommand|. Using
2013 |\offcommand| on a command that is already off or |\oncommand| on a
2014 command that is not off has no effect.
2015
2016
2017 \subsection{Argument types and expansion}
2018
2019 Most arguments of \fontinst commands belong to one of the following
2020 six categories:
2021 \begin{itemize}
2022 \item integer expressions,
2023 \item string expressions,
2024 \item comma-separated lists of string expressions,
2025 \item dimensions,
2026 \item commands (i.e., a single \TeX\ control sequence), and
2027 \item code (zero or more commands in sequence, each of which may
2028 have arguments of its own).
2029 \end{itemize}
2030 Integer expressions are explained in Subsection~\ref{Sec:integer}
2031 below.
2032
2033 The most common form of a string expression is simply a sequence of
2034 character tokens, but any balanced text which expands to such a
2035 sequence of tokens is legal. Several of the standard \etx files use
2036 macros in string expressions to make glyph names to some extent
2037 configurable. Besides such custom macros, the following \fontinst
2038 commands may be used to access variable values inside a string
2039 expression
2040 \begin{decl*}
2041 |\strint|\arg{int}\\
2042 |\str|\arg{str}\\
2043 |\dim|\arg{dim}
2044 \end{decl*}
2045 Incidentally, these \m{int}, \m{str}, and \m{dim} are themselves
2046 string expressions (for the names of integer, string, and dimen
2047 respectively variables).
2048
2049 Dimensions are simply \TeX\ \meta{dimen}s; their use is rather
2050 limited. \Fontinst does not provide for any sort of ``dimen
2051 expressions''. Most actual lengths are expressed as integer
2052 expressions, in AFM units ($1/1000$ of the font size).
2053
2054 Common to integer expressions, string expressions, and
2055 dimensions is that these argument types get expanded during
2056 evaluation (in the case of string expressions, this expansion
2057 \emph{is} the evaluation), which means one can use macros in
2058 arguments of these types. Command arguments do not get
2059 expanded---they are mainly used with commands that modify the
2060 definitions of other commands.
2061
2062 Comma-separated lists of string expressions are first split at commas
2063 (without prior expansion) and each element is then treated as a
2064 string expression (i.e., \emph{gets expanded}). (As remarked elsewhere,
2065 the \meta{metrics-list} argument of |\installfont| is not properly a
2066 comma-separated list of string expressions, even though it may look
2067 like one.)
2068
2069 Code arguments are generally expanded, but one should not make any
2070 presumptions about \emph{when} this will happen, and similarly not
2071 assume that code placed in such an argument will only be executed
2072 once. It is typically safe to use a macro in a code argument if the
2073 definition of that macro stays the same throughout, but one should
2074 otherwise not use any other commands in code arguments than those
2075 explicitly documented as legal there.
2076
2077 Finally, there are command arguments which do not fall into any of
2078 these categories. For these, one cannot give any rules: they
2079 might get expanded, but it could also happen that they won't.
2080
2081
2082
2083 \subsection{Integer expressions}
2084 \label{Sec:integer}
2085
2086 The \emph{integer expressions} provide a user-friendly syntax for
2087 \TeX\ arithmetic. They are used to manipulate any integers,
2088 including glyph dimensions (which are given in AFM units, that is
2089 1000 to the design size). \TeX\ \pl fonts have their dimensions
2090 converted to AFM units automatically.
2091
2092 The \emph{integer expressions} are:
2093
2094 \begin{decl}
2095 \m{number}
2096 \end{decl}
2097 Returns the value of a \TeX\ \m{number} (as explained in
2098 \emph{The \TeX book}). Typical examples of this kind of integer
2099 expression are |0|, |1000|, |538|, |-20|, |"9C|, |'177|, etc.
2100
2101 \begin{decl}
2102 |\int|\arg{int}
2103 \end{decl}
2104 Returns the value of the integer variable \m{int}.
2105
2106 \begin{decl}
2107 |\width|\arg{glyph}\\
2108 |\height|\arg{glyph}\\
2109 |\depth|\arg{glyph}\\
2110 |\italic|\arg{glyph}
2111 \end{decl}
2112 Returns the width, height, depth, or italic correction of the glyph
2113 variable \m{glyph}.
2114
2115 \begin{decl}
2116 |\kerning|\arg{left}\arg{right}
2117 \end{decl}
2118 Returns the kerning between the \m{left} and \m{right} glyphs. Unlike
2119 other types of variable accesses, where it is an error to access
2120 something that has not been explicitly set, this command returns |0|
2121 if no kern has been set between the two glyphs.
2122
2123 \begin{decl}
2124 |\neg|\arg{integer expression}\\
2125 |\add|\arg{integer expression}\arg{integer expression}\\
2126 |\sub|\arg{integer expression}\arg{integer expression}\\
2127 |\max|\arg{integer expression}\arg{integer expression}\\
2128 |\min|\arg{integer expression}\arg{integer expression}\\
2129 |\mul|\arg{integer expression}\arg{integer expression}\\
2130 |\div|\arg{integer expression}\arg{integer expression}\\
2131 |\scale|\arg{integer expression}\arg{integer expression}\\
2132 |\half|\arg{integer expression}\\
2133 |\otherhalf|\arg{integer expression}
2134 \end{decl}
2135 These commands evaluate their argument(s) and perform some arithmetic
2136 operations on the result(s).
2137
2138 |\neg| returns the negation of the \m{integer expression}.
2139
2140 |\add| returns the sum of the two \m{integer expression}s.
2141
2142 |\sub| returns the first \m{integer expression} minus the second.
2143
2144 |\max| returns the maximum of the two \m{integer expression}s.
2145
2146 |\min| returns the minimum of the two \m{integer expression}s.
2147
2148 |\mul| returns the product of the two \m{integer expression}s.
2149
2150 |\div| returns the first \m{integer expression} divided by the second.
2151
2152 |\scale| returns the first \m{integer expression} times the second,
2153 divided by 1000. |\scale| does better rounding than the corresponding
2154 combination of |\mul| and |\div|.
2155
2156 |\half| returns half the \m{integer expression}. It does better
2157 rounding than |\scale|\arg{integer expression}|{500}| or
2158 |\div|\arg{integer expression}|{2}|.
2159
2160 |\otherhalf| returns the ``other half'' of the \m{integer
2161 expression}, i.e., the sum of |\half| something and |\otherhalf| the
2162 same thing is that thing back.
2163
2164
2165 \subsection{Conditionals and loops}
2166
2167 \Fontinst has a rather extensive family of conditionals (|\if|s), and
2168 as of late also some convenient loop commands. The most common forms
2169 of a \fontinst conditional are
2170 \begin{decl*}
2171 |\if|\dots \meta{argument(s)}|\then| \meta{then branch} |\Fi|\\
2172 |\if|\dots \meta{argument(s)}|\then| \meta{then branch} |\Else|
2173 \meta{else branch} |\Fi|
2174 \end{decl*}
2175 i.e., \fontinst uses Plain\TeX\ style conditionals (with else and fi
2176 control sequences) rather than \LaTeX\ style conditionals (with
2177 separate arguments for the two branches). Every |\if|\dots\ command
2178 can be thought of as testing some condition.
2179 If the condition is true then the \meta{then branch} will be executed,
2180 but not the \meta{else branch} (if there is one).
2181 If the condition is false then the \meta{then branch} will not be
2182 executed, but if there is an \meta{else branch} then that will be
2183 executed. Conditionals may be nested (i.e., occur in the then or else
2184 branch).
2185
2186 \begin{hackernote}
2187 The |\then| is not just syntactic sugar, but a functional part of
2188 those conditionals which take arguments. Its purpose is to look
2189 like an |\if| to \TeX\ when the conditional occurs in a skipped
2190 branch of another conditional.
2191 \end{hackernote}
2192
2193 The most common conditionals are those which test if a variable is set.
2194 \begin{decl*}
2195 |\ifisint|\arg{int}|\then|\\
2196 |\ifisdim|\arg{dim}|\then|\\
2197 |\ifisstr|\arg{str}|\then|\\
2198 |\ifiscommand|\arg{command}|\then|
2199 \end{decl*}
2200 These cause the following \meta{then branch} to be executed if the
2201 specified variable is set, and the \meta{else branch} to be executed
2202 if the variable is not set. The \meta{int}, \meta{dim}, and
2203 \meta{str} are string expressions for the names of an integer,
2204 dimension, and string respectively variable. The \meta{command} is
2205 the actual control sequence (command variable) that should be tested.
2206
2207 \begin{decl}
2208 |\ifisglyph|\arg{glyph}|\then|
2209 \end{decl}
2210 This similarly tests if a glyph (also a variable of a kind) is set in
2211 the current glyph base. The glyph name \meta{glyph} is a string
2212 expression.
2213
2214 \begin{decl}[v1.917]
2215 |\ifareglyphs|\marg{glyph list}|\then|
2216 \end{decl}
2217 This command tests whether all the glyphs in the \meta{glyph list}
2218 (a comma-separated list of string expressions) are set in the current
2219 glyph base. If one of the glyphs is not set then the condition is
2220 false.
2221
2222 \begin{decl}[v1.900]
2223 |\ifnumber|\marg{integer expression}\meta{rel}%
2224 \marg{integer expression}|\then|
2225 \end{decl}
2226 The \meta{rel} is one of \texttt{<}, \texttt{=}, and \texttt{>}.
2227 This command evaluates the two \meta{integer expression}s and
2228 then tests whether the specified relation holds between their values.
2229
2230 \begin{decl}[v1.900]
2231 |\ifiskern|\marg{glyph1}\marg{glyph2}|\then|
2232 \end{decl}
2233 This tests whether a kern has been set with \meta{glyph1} on the left
2234 and \meta{glyph2} on the right (both arguments are string
2235 expressions). This is almost the negation of
2236 \begin{verbatim}
2237 \ifnumber{\kerning{<glyph1>}{<glyph2>}}={0}\then
2238 \end{verbatim}
2239 but |\ifiskern| can distinguish the case that an zero kern has been
2240 set (true) from the case that no such kern has been set (false),
2241 which |\kerning| can not. It is however unlikely that this
2242 distinction would ever be of use in a practical situation.
2243
2244 \begin{decl}[v1.924]
2245 |\ifoption|\marg{string}|\then|
2246 \end{decl}
2247 Test whether \meta{string} (a string expression) is among the current
2248 list of options. This list is by default empty, elements are added
2249 using |option| modifiers (cf.~the description of |\installfont|), and
2250 the list is cleared for each new file for which one can specify
2251 options.
2252
2253 \begin{decl}[v1.909]
2254 |\Else|
2255 |\Fi|
2256 \end{decl}
2257 For \fontinst, these two control sequences are precisely the same as
2258 the \TeX\ primitives |\else| and |\fi|, but things are a bit more
2259 complicated in \fontdoc. The mechanism in \fontdoc\ that allows it to
2260 present both branches of the conditional in the typeset output
2261 requires that |\Else| and |\Fi| generate typeset output. See also the
2262 |\showbranches| \fontdoc command.
2263
2264 \begin{hackernote}
2265 Before |\Else| and |\Fi| were introduced, the \TeX\ primitives
2266 |\else| and |\fi| were used instead for \fontinst conditionals.
2267 Back then, \fontdoc defined all conditionals to expand to |\iftrue|.
2268
2269 It used to be the case that all conditionals would be fully
2270 expandable (which in particular would have made it possible to use
2271 them in string expressions), but that is no longer the case.
2272 \end{hackernote}
2273
2274 The \fontdoc formatter for visible branches treats an |\Else|
2275 immediately followed by an `if' as an `else if', i.e., it assumes the
2276 entire else branch consists of the conditional begun at that `if' and
2277 leaves out one level of indentation. When that is not the case, you
2278 will upon typesetting get a \LaTeX\ error about |\begin{IfBranchDummy}|
2279 and |\end{IfBranch}|. In that case you need to help the formatter by
2280 placing something between the |\Else| and the `if'; as it turns out
2281 leaving an empty line there is sufficient (although just a single
2282 newline is not).
2283
2284
2285 \begin{decl}[v1.901]
2286 |\for|\parg{name}\marg{start}\marg{stop}\marg{step}
2287 \meta{body} |\endfor|\parg{name}
2288 \end{decl}
2289 will cause the \meta{body} code to be repeated some number of times.
2290 How many depends on the values of \meta{start}, \meta{stop}, and
2291 \meta{step}, which are integer expressions.
2292
2293 As a precaution, the \meta{body} is not allowed to contain any
2294 empty lines (|\par| tokens). If you want to have the visual
2295 separation (for sakes of legibility or otherwise), put a |%|
2296 somewhere on the line---that makes it nonempty.
2297
2298 \meta{name} should consist of character tokens only. It is used as
2299 the name of an integer variable, which will serve as loop variable.
2300 This variable gets reset to the value of \meta{start} before the first
2301 repetition of \meta{body code}. After each repetition but the last,
2302 it is incremented by \meta{step}. \meta{body} gets repeated if
2303 the value of \meta{name} has not gotten past that of \meta{stop}. To
2304 get past means to be bigger if \meta{step} is positive and to be
2305 smaller if \meta{step} is negative. In the case that \meta{step} is
2306 zero, the entire construction above will be equivalent to
2307 \begin{quote}
2308 |\resetint|\marg{name}\marg{start}\\
2309 \meta{body}
2310 \end{quote}
2311
2312 |\for| \textellipsis\ |\endfor| constructions can be nested.
2313 \meta{name} is used by |\for| to identify its matching |\endfor|, so
2314 they need to be identical in |\for| and |\endfor|. \textbf{Note} that
2315 the delimiters around the \meta{name} are parentheses, not braces.
2316
2317
2318 \begin{decl}[v1.901]
2319 |\foreach|\parg{name}\marg{csep-list}
2320 \meta{body} |\endfor|\parg{name}
2321 \end{decl}
2322 will cause the \meta{body} code to be repeated one time for each item
2323 in the \meta{csep-list}. \meta{csep-list} is a comma-separated list
2324 of string expressions.
2325
2326 As a precaution, the \meta{body} is not allowed to contain any
2327 empty lines (|\par| tokens). If you want to have the visual
2328 separation (for sakes of legibility or otherwise), put a |%|
2329 somewhere on the line---that makes it nonempty.
2330
2331 \meta{name} should consist of character tokens only. It is used as
2332 the name of a string variable, which will serve as loop variable.
2333 Before each repetition of the \meta{body code}, the loop variable will
2334 get reset to the next item in the \meta{csep-list}.
2335
2336 |\foreach|\textellipsis\ |\endfor| constructions can be nested.
2337 \meta{name} is used by |\foreach| to identify its matching |\endfor|,
2338 so they need to be identical in |\foreach| and |\endfor|.
2339 \textbf{Note} that the delimiters around the \meta{name} are
2340 parentheses, not braces.
2341
2342
2343
2344 \subsection{Other general commands}
2345
2346 \begin{decl}
2347 |\needsfontinstversion|\arg{version}
2348 \end{decl}
2349 This issues a warning if the current version of the \fontinst
2350 package is less than \m{version}.
2351
2352 \begin{decl}[v1.914]
2353 |\needsTeXextension|\marg{extension tests}\marg{who}
2354 \end{decl}
2355 The |\needsTeXextension| command issues a warning if \fontinst is not
2356 being run on one of the listed extensions of \TeX. This can be used to
2357 protect files that make use of features not present in base \TeX. As
2358 \meta{who} is preferably used the file name in which the command
2359 occurs; it should be the answer to ``who is issuing this warning?''
2360
2361 An extension test is one of:
2362 \begin{decl*}
2363 |\eTeX|\marg{version number}\\
2364 |\pdfTeX|\marg{version number}\marg{revision}
2365 \end{decl*}
2366 Multiple tests in sequence are \textsc{or}'ed together. If you rather
2367 need to \textsc{and} them, then use separate |\needsTeXextension|
2368 commands.
2369
2370 \begin{hackernote}
2371 At present there is no test for Omega. This is really a shame,
2372 because the extended character codes (outside the 0--255 range)
2373 provided by Omega is the existing extension that would be most
2374 useful for \fontinst, but Omega documentation does not give any
2375 indication of how such a test should be implemented. Code
2376 contributions are welcome.
2377 \end{hackernote}
2378
2379
2380 \begin{decl}[v1.915]
2381 |\fontinstcc|\\
2382 |\normalcc|
2383 \end{decl}
2384 |\fontinstcc| switches to the catcodes used in e.g.\@
2385 \texttt{fontinst.sty}: |_| and |@| are letters, space and newline are
2386 ignored, and |~| is a space. |\normalcc| switches back to normal
2387 catcodes.
2388
2389 \begin{decl}[v1.900]
2390 |\begincomment| \meta{text} |\endcomment|
2391 \end{decl}
2392 This hides the \meta{text} from \fontinst processing, but allows it
2393 to show up when the file is typeset with \fontdoc.
2394
2395 \begin{decl}[v1.906]
2396 |\fontinsterror|\marg{subsystem}\marg{error}\marg{help}\\
2397 |\fontinstwarning|\marg{subsystem}\marg{warning}\\
2398 |\fontinstwarningnoline|\marg{subsystem}\marg{warning}\\
2399 |\fontinstinfo|\marg{subsystem}\marg{info}
2400 \end{decl}
2401 General commands to convey information to the user, based on \LaTeX's
2402 |\PackageError|, |\PackageWarning|, etc.
2403
2404 \begin{decl}[v1.906]
2405 |\messagebreak|
2406 \end{decl}
2407 Used to start a new line in an \meta{error}, \meta{help},
2408 \meta{warning}, or \meta{info} message.
2409
2410
2411 Finally, there are two Plain\TeX\ commands which should be mentioned:
2412 \begin{decl*}
2413 |\input| \meta{file name}\\
2414 |\bye|
2415 \end{decl*}
2416 |\input| followed by a \meta{file name} (\emph{without} braces around)
2417 is the recommended way of inputting a \fontinst command file, or the
2418 \fontinst package itself (\texttt{fontinst.sty},
2419 \texttt{finstmsc.sty}, etc.). This is the only way to make things work
2420 regardless of whether the underlying format is \LaTeX, Plain\TeX, or
2421 even a raw Ini\TeX.
2422
2423 |\bye| is the command to use to terminate a \fontinst command file.
2424
2425
2426
2427
2428
2429 \section{Encoding files}
2430
2431 An \emph{encoding file} (or \texttt{.etx} file) is a \TeX\ document
2432 with the structure:
2433 \begin{quote}
2434 |\relax|\\
2435 \meta{ignored material}\\
2436 |\encoding|\\
2437 \meta{encoding commands}\\
2438 |\endencoding|\\
2439 \meta{ignored material}
2440 \end{quote}
2441 This describes the encoding of a font, using the \m{encoding commands}.
2442
2443 Since the encoding file ignores any material between \verb|\relax| and
2444 \verb|\encoding|, an \emph{encoding file} can also be a \LaTeX\
2445 document. The structure is then
2446 \begin{quote}
2447 |\relax|\\
2448 |\documentclass{article} %| Or some other class\\
2449 |\usepackage{fontdoc}|\\
2450 \meta{\LaTeX\ preamble}\\
2451 |\begin{document}|\\
2452 \meta{\LaTeX\ text}\\
2453 |\encoding|\\
2454 \m{encoding commands}\\
2455 |\endencoding|\\
2456 \meta{\LaTeX\ text}\\
2457 |\end{document}|
2458 \end{quote}
2459
2460
2461 See also the descriptions in \emph{Writing ETX format font encoding
2462 specifications} (\texttt{encspecs.tex}).
2463
2464
2465 \subsection{Encoding commands}
2466
2467 The \m{encoding commands} are:
2468
2469 \begin{decl}
2470 |\nextslot|\arg{integer expression}
2471 \end{decl}
2472 Sets the number of the next slot. If there is no \verb|\nextslot|
2473 command, the number is the successor of the previous slot. Immediately
2474 after |\encoding|, the next slot number is $0$.
2475
2476 \begin{decl}[v1.8]
2477 |\skipslots|\arg{integer expressions}
2478 \end{decl}
2479 Advances the number of the next slot.
2480
2481 \begin{decl}
2482 |\setslot|\arg{glyph} \m{slot commands} |\endsetslot|
2483 \end{decl}
2484 Assigns \m{glyph} to the current slot. The \m{slot commands} can be
2485 used to specify additional behaviour for the slot, and typically also
2486 contains comments about the glyph.
2487
2488 \begin{decl}[v1.9]
2489 |\setleftboundary|\marg{glyph} \m{slot commands}
2490 |\endsetleftboundary|
2491 \end{decl}
2492 Makes the beginning of a word (left boundary) behave like the right
2493 side of \m{glyph} with respect to kerning. |\ligature| commands in
2494 the \meta{slot commands} create beginning of word ligatures.
2495
2496 \begin{decl}[v1.9]
2497 |\setrightboundary|\marg{glyph}
2498 \end{decl}
2499 Makes the end of a word (right boundary) behave like the left
2500 side of \m{glyph} with respect to kerning and ligatures. The current
2501 slot position is left empty.
2502
2503 \begin{decl}
2504 |\inputetx|\arg{file}
2505 \end{decl}
2506 Inputs the \m{encoding commands} of \m{file}\texttt{.etx}.
2507
2508 \begin{decl}[v1.917]
2509 |\setfontdimen|\marg{fontdimen no.}\marg{integer variable}
2510 \end{decl}
2511 Sets up a correspondence between a font dimension and an integer
2512 variable. When generating a font, the font dimension value is taken
2513 from the integer variable. When converting a font from \pl or \vpl
2514 format, the fontdimen value will be recorded as a |\setint| command
2515 for the variable.
2516
2517 \begin{decl}[v1.924]
2518 |\ifdirect|
2519 \end{decl}
2520 Encoding files set up a correspondence between slot numbers and glyph
2521 names, which can be used in two different ways. In the \emph{direct}
2522 mode, encoding files map slot numbers to glyph names. In the
2523 \emph{inverse} mode, glyph names are mapped to slot numbers. The
2524 inverse mapping can in general be one-to-many, and when precisely one
2525 target slot is needed \fontinst chooses that arbitrarily. The |\ifdirect|
2526 conditional can be used to disambiguate the inverse mapping, by
2527 conditionalising all undesired |\setslot|s on that the file is being
2528 interpreted in the direct mode. For example:
2529 \begin{verbatim}
2530 \ifdirect
2531 \setslot{hyphen}
2532 \comment{Soft hyphen slot}
2533 \endsetslot
2534 \Else
2535 \skipslots{1}
2536 \Fi
2537 \end{verbatim}
2538
2539 Currently the only case in which encoding files are being read in
2540 the inverse mode is when reencoding fonts.
2541
2542 \begin{decl}[v1.8]
2543 |\setslotcomment|\marg{text}\\
2544 |\resetslotcomment|\marg{text}\\
2545 |\unsetslotcomment|
2546 \end{decl}
2547 These commands can be used to specify an automatic |\comment| text
2548 for all slots. They are ignored by \fontinst, but interpreted by
2549 \fontdoc.
2550
2551 \begin{decl}[v1.8]
2552 |\useexamplefont|\marg{font}
2553 \end{decl}
2554 This command is ignored by \fontinst. In \fontdoc it sets the font
2555 that is used by the |\slotexample| command. The \meta{font} argument
2556 has the same syntax for a font as the \TeX\ primitive |\font|.
2557
2558
2559
2560
2561 \subsection{Slot commands}
2562
2563 The \m{slot commands} are:
2564
2565 \begin{decl}
2566 |\comment|\arg{text}
2567 \end{decl}
2568 A comment, which is ignored by \fontinst, but typeset as a separate
2569 paragraph by \fontdoc.
2570
2571 \begin{decl}[v1.917]
2572 |\label|\arg{text}
2573 \end{decl}
2574 A reference label (like in \LaTeX), which records the slot number and
2575 glyph name. Ignored by \fontinst.
2576
2577 \begin{decl}
2578 |\ligature|\arg{ligtype}\arg{glyph1}\arg{glyph2}
2579 \end{decl}
2580 |\ligature| declares a ligature of type \m{ligtype}, which will take
2581 effect if the current glyph is immediately followed by \meta{glyph1}
2582 when \TeX\ is constructing a list of horizontal material. This
2583 ligature will then replace the two glyphs by the third glyph
2584 \meta{glyph2}. For example:
2585 \begin{verbatim}
2586 \setslot{ff}
2587 \comment{The `ff' ligature.}
2588 \ligature{LIG}{i}{ffi}
2589 \ligature{LIG}{l}{ffl}
2590 \endsetslot
2591 \end{verbatim}
2592 declares one ligature \(\texttt{ff}*\texttt{i} \longrightarrow
2593 \texttt{ffi}\) and one ligature \(\texttt{ff}*\texttt{l}
2594 \longrightarrow \texttt{ffl}\).
2595
2596 The eight \m{ligtype}s are the names of the underlying \pl
2597 properties, i.e.,:
2598 \begin{quote}
2599 \texttt{LIG}\hfil
2600 \texttt{/LIG}\hfil
2601 \texttt{/LIG>}\hfil
2602 \texttt{LIG/}\hfil
2603 \texttt{LIG/>}\hfil
2604 \texttt{/LIG/}\hfil
2605 \texttt{/LIG/>}\hfil
2606 \texttt{/LIG/>>}
2607 \end{quote}
2608 The basic \texttt{LIG} may be immediately preceded or followed by a
2609 slash, and then immediately followed by \texttt{>} characters not
2610 exceeding the number of slashes. The slashes specify retention of the
2611 left or right original glyph; the \texttt{>} signs specify passing
2612 over that many glyphs of the result without further ligature or kern
2613 processing.
2614
2615 \begin{decl}[v1.918]
2616 |\Ligature|\arg{ligtype}\arg{glyph}\arg{glyph}\\
2617 |\oddligature|\marg{note}\arg{ligtype}\arg{glyph}\arg{glyph}
2618 \end{decl}
2619 The |\Ligature| command is by default a synonym of |\ligature| (but
2620 \fontdoc may typeset them differently). The |\oddligature| command is
2621 by default ignored by \fontinst. See \setfilename{encspecs.tex} for
2622 an explanation of the semantic differences.
2623
2624 \begin{decl}
2625 |\makerightboundary|\arg{glyph}
2626 \end{decl}
2627 This makes the current slot the end of word (right boundary) marker
2628 with respect to ligatures and kerning, i.e., \TeX\ will kern and
2629 ligature as if there was an invisible occurrence of this character
2630 after the last character of every word. All kerns and ligatures with
2631 \meta{glyph} as the right part will apply for this slot.
2632
2633 It is preferable to use |\setrightboundary| to control end of word
2634 behaviour if you have an empty slot to spare.
2635
2636 \begin{decl}
2637 |\Unicode|\marg{code point}\marg{name}\\
2638 |\charseq|\marg{\cs{Unicode} commands}
2639 \end{decl}
2640 These commands declare a Unicode character or character sequence as
2641 possible interpretations of what is in this slot. They are ignored
2642 when making fonts, but \fontdoc give them a prominent role in
2643 encoding specifications and to |\etxtocmap| they are the primary
2644 properties of the slot.
2645
2646 \begin{decl}[Obsolete?!]
2647 |\usedas|\arg{type}\arg{control sequence}
2648 \end{decl}
2649 This command declares a \TeX\ control sequence for this slot, with
2650 the \emph{type} taken from:
2651 \begin{verbatim}
2652 char accent mathord
2653 mathbin mathrel mathopen
2654 mathclose mathpunct mathvariable
2655 mathaccent mathdelim
2656 \end{verbatim}
2657 There is currently no code in \fontinst which makes any use of this
2658 command. It might in principle be possible to autogenerate \LaTeX\
2659 output encoding definition (\meta{enc}\texttt{enc.def}) files and
2660 math symbol declarations from this information.
2661
2662 \begin{decl}
2663 |\nextlarger|\arg{glyph}
2664 \end{decl}
2665 Math font property: makes \meta{glyph} the \textsc{nextlarger} entry
2666 of the current slot.
2667
2668 \begin{decl}
2669 |\varchar|
2670 \m{varchar commands}
2671 |\endvarchar|
2672 \end{decl}
2673 Math font property: sets the \textsc{varchar} entry for the current
2674 slot, using the \m{varchar commands}. The possible \m{varchar
2675 commands} are:
2676 \begin{decl*}
2677 |\vartop|\arg{glyph}\\
2678 |\varmid|\arg{glyph}\\
2679 |\varbot|\arg{glyph}\\
2680 |\varrep|\arg{glyph}
2681 \end{decl*}
2682 Sets the top, middle, bottom, or repeated \m{glyph} of the
2683 \textsc{varchar}.
2684
2685
2686 \subsection{Other}
2687
2688 \begin{decl}[v1.9]
2689 |\ifisinslot|\marg{glyph}\marg{slot}|\then|
2690 \end{decl}
2691 During \vpl\slash\pl generation, this conditional tests whether glyph
2692 \meta{glyph} (a string expression) is put in the slot \meta{slot} (an
2693 integer expression). Since encoding files are normally read several
2694 times in that context, the exact behaviour of this command is a bit
2695 uncertain. It was intended to support collecting additional
2696 information about the fonts being generated, but at the time of
2697 writing this is probably only of academic interest.
2698
2699
2700 \begin{decl}[v1.931]
2701 |\declarepsencoding|\marg{etx-name}\marg{PS-encoding-name}%
2702 \marg{action}
2703 \end{decl}
2704 This command is placed in \etx files generated by |\enctoetx|, and has
2705 the same syntax as in a mapmaking command file (see
2706 Subsection~\ref{Ssec:MapConfig}). It records information about the
2707 source encoding file to assist the map file writer, but is mostly
2708 ignored by main \fontinst.
2709
2710
2711
2712
2713 \section{Metric files}
2714 \label{Sec:Metric}
2715
2716
2717 A \emph{metric file} (or \mtx file) is a \TeX\ document with the
2718 structure:
2719 \begin{quote}
2720 |\relax|\\
2721 \emph{ignored material}\\
2722 |\metrics|\\
2723 \m{metric commands}\\
2724 |\endmetrics|\\
2725 \emph{ignored material}
2726 \end{quote}
2727 This describes the glyphs in a font, using the \m{metric commands}.
2728 Like encoding files, metric files can simultaneously be \LaTeX\
2729 documents.
2730
2731 Metric files are usually either \emph{hand-crafted} or
2732 \emph{transformable}. The transformable metric files typically encode
2733 the metrics of one particular font and are automatically generated.
2734 Hand-crafted metric files (such as \setfilename{latin.mtx}) typically
2735 do not contain much explicit metric data, instead the code there makes
2736 use of metrics previously specified by other files to construct new
2737 glyphs or adjust metrics to meet special conditions. Whereas
2738 transformable metric files tend to be mere lists of metric data, the
2739 hand-crafted metric files are more like programs.
2740
2741
2742 \subsection{Metric commands}
2743
2744 The \m{metric commands} are as follows. All glyph name arguments are
2745 string expressions.
2746
2747 \begin{decl}
2748 |\setglyph|\arg{name} \m{glyph commands} |\endsetglyph|
2749 \end{decl}
2750 If the glyph called \m{name} is undefined, it is built using the
2751 \m{glyph commands}, for example:
2752 \begin{verbatim}
2753 \setglyph{IJ}
2754 \glyph{I}{1000}
2755 \glyph{J}{1000}
2756 \endsetglyph
2757
2758 \setglyph{Asmall}
2759 \glyph{A}{850}
2760 \endsetglyph
2761 \end{verbatim}
2762 The \meta{glyph commands} are not executed if the glyph has already
2763 been set.
2764
2765 \begin{decl}
2766 |\resetglyph|\arg{name}
2767 \m{glyph commands}
2768 |\endresetglyph|
2769 \end{decl}
2770 This builds a glyph using the \m{glyph commands}, and defines
2771 (at~|\endresetglyph|) \meta{name} to be that glyph, regardless of
2772 whether that glyph was already defined.
2773
2774 \begin{decl}
2775 |\unsetglyph|\arg{name}
2776 \end{decl}
2777 Makes the glyph called \m{name} undefined.
2778
2779 \begin{decl}
2780 |\setrawglyph|\arg{name}\arg{font}\arg{dimen}\arg{slot}\\
2781 \hspace*{1.5em}\arg{width}\arg{height}\arg{depth}\arg{italic
2782 correction}\\
2783 |\setscaledrawglyph|%
2784 \arg{name}\arg{font}\arg{dimen}\arg{scale}\arg{slot}\\
2785 \hspace*{1.5em}\arg{width}\arg{height}\arg{depth}\arg{italic
2786 correction}
2787 \end{decl}
2788 These commands will usually be
2789 generated automatically from an \afm or \pl file.
2790 If the glyph \meta{name} is undefined, then this sets it to be that
2791 which is found in slot \meta{slot} of font \meta{font}. The
2792 \meta{width}, \meta{height}, \meta{depth}, and \meta{italic} are
2793 saved away as the width, height, depth and italic correction
2794 respectively of the glyph.
2795
2796 The \meta{scale} is a scaling factor which has been applied to the
2797 font to give it the specified metrics.
2798 If the integer variable \texttt{rawscale} is set, another scaling by
2799 that amount will be applied to the glyph (this is how the |scaled|
2800 keyword in |\installfont| metrics-lists take effect).
2801
2802 The \meta{dimen} is the nominal \emph{design size} of the \meta{font},
2803 usually |10pt|; this information isn't really needed for anything, but
2804 the \vf format requires it to be specified and match what is in
2805 \meta{font}\setfilename{.tfm}, so a \dvi driver is allowed to error
2806 out on us if we don't get this value right.
2807
2808
2809 \begin{decl}
2810 |\setnotglyph|\arg{name}\arg{font}\arg{dimen}\arg{slot}\\
2811 \hspace*{1.5em}\arg{width}\arg{height}\arg{depth}\arg{italic
2812 correction}\\
2813 |\setscalednotglyph|%
2814 \arg{name}\arg{font}\arg{dimen}\arg{scale}\arg{slot}\\
2815 \hspace*{1.5em}\arg{width}\arg{height}\arg{depth}\arg{italic
2816 correction}
2817 \end{decl}
2818 These set a glyph called \m{name}\texttt{-not} (if that wasn't set
2819 already) to have the specified width, height, depth, and italic
2820 correction but be invisible in print.
2821
2822 Such commands are usually generated automatically from an \afm file,
2823 when a glyph is present in the \m{font} but is not in the default
2824 encoding. They take the same arguments as |\setrawglyph| and
2825 |\setscaledrawglyph| respectively (although the \meta{slot} will
2826 normally be |-1|), because
2827 reencoding a font can turn |\setrawglyph| commands into
2828 |\setnotglyph| commands and vice versa.
2829
2830
2831 \begin{decl}
2832 |\inputmtx|\arg{file}
2833 \end{decl}
2834 Inputs the \m{metric commands} of \m{file}\texttt{.mtx}.
2835
2836 \begin{decl}[v1.9]
2837 |\usemtxpackage|\marg{package~list}\\
2838 |\ProvidesMtxPackage|\marg{package~name}
2839 \end{decl}
2840 |\usemtxpackage| behaves like |\inputmtx|, but it will only input a
2841 file if no |\ProvidesMtxPackage| for that file has been issued. By
2842 putting a |\ProvidesMtxPackage| in an \mtx file one can |use| it in
2843 several places without having to worry about it being sourced more
2844 than once.
2845
2846 \begin{hackernote}
2847 |\ProvidesMtxPackage| declarations make local assignments, so the
2848 package is forgotten when the current group ends. In particular, the
2849 settings made with |\ProvidesMtxPackage| are forgotten when the
2850 current glyph base is flushed.
2851 \end{hackernote}
2852
2853
2854
2855 \subsection{Glyph commands}
2856
2857 The \m{glyph commands} add material to the glyph currently being
2858 constructed in a |\setglyph| \dots\ |\endsetglyph| or
2859 |\resetglyph| \dots\ |\endresetglyph|. They are:
2860
2861 \begin{decl}
2862 |\glyph|\arg{glyph}\arg{integer expression}
2863 \end{decl}
2864 Sets the named glyph \m{glyph} at the given scale, with 1000 as the
2865 natural size. This:
2866 \begin{itemize}
2867 \item
2868 Advances the current glyph width.
2869 \item
2870 Sets the current glyph height to be at least the height of the
2871 named glyph, adjusted for the current vertical offset.
2872 \item
2873 Sets the current glyph depth to be at least the depth of the
2874 named glyph, adjusted for the current vertical offset.
2875 \item
2876 Sets the current glyph italic correction to be the same as the
2877 set glyph.
2878 \end{itemize}
2879 The named glyph must have already been defined, otherwise an error
2880 will occur. For example:
2881 \begin{verbatim}
2882 \setglyph{fi}
2883 \glyph{f}{1000}
2884 \glyph{i}{1000}
2885 \endsetglyph
2886 \end{verbatim}
2887
2888 \begin{decl}
2889 |\glyphrule|\arg{integer expression}\arg{integer expression}
2890 \end{decl}
2891 Sets a rule of the given width and height, for example:
2892 \begin{verbatim}
2893 \setglyph{underline}
2894 \glyphrule{333}{40}
2895 \endsetglyph
2896 \end{verbatim}
2897
2898 \begin{decl}
2899 |\glyphspecial|\arg{string expression}
2900 \end{decl}
2901 Sets a driver-dependent \verb|\special|, for example:
2902 \begin{verbatim}
2903 \setglyph{crest}
2904 \glyphspecial{Filename: crest.eps}
2905 \endsetglyph
2906 \end{verbatim}
2907
2908 \begin{decl}
2909 |\glyphwarning|\arg{string expression}
2910 \end{decl}
2911 Sets a warning \verb|\special|, and produces a warning message each
2912 time the glyph is used, for example:
2913 \begin{verbatim}
2914 \setglyph{missingglyph}
2915 \glyphrule{500}{500}
2916 \glyphwarning{Missing glyph `missingglyph'}
2917 \endsetglyph
2918 \end{verbatim}
2919
2920 \begin{decl}
2921 |\movert|\arg{integer expression}
2922 \end{decl}
2923 Moves right by the given amount, and advances the current glyph width,
2924 for example:
2925 \begin{verbatim}
2926 \setglyph{Asmall}
2927 \movert{50}
2928 \glyph{A}{700}
2929 \movert{50}
2930 \endsetglyph
2931 \end{verbatim}
2932
2933 \begin{decl}
2934 |\moveup|\arg{integer expression}
2935 \end{decl}
2936 Moves up by the given amount, and advances the current vertical
2937 offset. Each glyph should always end at vertical offset zero, for
2938 example:
2939 \begin{verbatim}
2940 \setglyph{onehalf}
2941 \moveup{500}
2942 \glyph{one}{700}
2943 \moveup{-500}
2944 \glyph{slash}{1000}
2945 \moveup{-200}
2946 \glyph{two}{700}
2947 \moveup{200}
2948 \endsetglyph
2949 \end{verbatim}
2950
2951 \begin{decl}
2952 |\push| \m{glyph commands} |\pop|
2953 \end{decl}
2954 Performs the \m{glyph commands}, but at the |\pop| the current
2955 position and glyph width are restored to what they were at the |\push|,
2956 for example:
2957 \begin{verbatim}
2958 \setglyph{aacute}
2959 \push
2960 \movert{\half{\sub{\width{a}}{\width{acute}}}}
2961 \glyph{acute}{1000}
2962 \pop
2963 \glyph{a}{1000}
2964 \endsetglyph
2965 \end{verbatim}
2966
2967 \begin{decl}
2968 |\glyphpcc|\arg{glyph}\arg{integer expression}\arg{integer expression}
2969 \end{decl}
2970 This is generated from \texttt{PCC} instructions in an \afm file, and
2971 is syntactic sugar for:
2972 \begin{quote}
2973 \small
2974 |\push|\\
2975 |\movert|\arg{first integer expression}\\
2976 |\moveup|\arg{second integer expression}\\
2977 |\glyph|\arg{glyph}|{1000}|\\
2978 |\pop|
2979 \end{quote}
2980
2981 \begin{decl}
2982 |\resetwidth|\arg{integer expression}\\
2983 |\resetheight|\arg{integer expression}\\
2984 |\resetdepth|\arg{integer expression}\\
2985 |\resetitalic|\arg{integer expression}
2986 \end{decl}
2987 Sets the width, height, depth, or italic correction of the current
2988 glyph.
2989
2990 \begin{decl}
2991 |\samesize|\arg{glyph}
2992 \end{decl}
2993 Sets the dimensions of the current glyph to be the same as \m{glyph}.
2994
2995 \bigskip
2996
2997 Inside a |\setglyph| definition of \m{glyph}, you can use expressions
2998 such as |\width|\arg{glyph} to refer to the glyph defined so far.
2999 For example, a display summation sign can be defined to be a text
3000 summation $\sum$ scaled 120\% with 0.5\,pt extra height and depth
3001 using:
3002 \begin{verbatim}
3003 \setglyph{summationdisplay}
3004 \glyph{summationtext}{1200}
3005 \resetheight{\add{\height{summationdisplay}}{50}}
3006 \resetdepth{\add{\depth{summationdisplay}}{50}}
3007 \endsetglyph
3008 \end{verbatim}
3009 Within a |\resetglyph|, these expressions will refer to the previous
3010 definition of the glyph. For example, you can add sidebearings to the
3011 letter `A' with:
3012 \begin{verbatim}
3013 \resetglyph{A}
3014 \movert{25}
3015 \glyph{A}{1000}
3016 \movert{25}
3017 \endresetglyph
3018 \end{verbatim}
3019
3020
3021 \subsection{Kerning commands}
3022
3023 The kerning commands may be used anywhere in a metrics file.
3024
3025 \begin{decl}
3026 |\setkern|\arg{glyph}\arg{glyph}\arg{integer expression}
3027 \end{decl}
3028 This sets a kern between the two glyphs, scaled by the current
3029 value of \texttt{rawscale}, unless such a kern already has been set.
3030
3031 \begin{decl}[v1.9]
3032 |\resetkern|\arg{glyph}\arg{glyph}\arg{integer expression}
3033 \end{decl}
3034 |\resetkern| unconditionally sets a kern between the two glyphs,
3035 scaled by the current value of \texttt{rawscale}.
3036
3037 \begin{decl}
3038 |\setleftkerning|\arg{glyph}\arg{glyph}\arg{integer expression}\\
3039 |\setrightkerning|\arg{glyph}\arg{glyph}\arg{integer expression}
3040 \end{decl}
3041 Sets the amount by which the first glyph should mimic how the second
3042 glyph kerns on the left or right, for example:
3043 \begin{verbatim}
3044 \setleftkerning{Asmall}{A}{850}
3045 \setrightkerning{Asmall}{A}{850}
3046 \setleftkerning{IJ}{I}{1000}
3047 \setrightkerning{IJ}{J}{1000}
3048 \end{verbatim}
3049 The commands work by copying kerning pairs containing the first glyph.
3050 As the names indicates, these commands do not override kerning pairs
3051 previously set.
3052
3053 \begin{decl}[v1.8]
3054 |\setleftrightkerning|\arg{glyph}\arg{glyph}\arg{integer expression}
3055 \end{decl}
3056 Sets the amount by which the first glyph should mimic how the second
3057 glyph kerns on both sides, for example:
3058 \begin{verbatim}
3059 \setleftrightkerning{Asmall}{A}{850}
3060 \end{verbatim}
3061 This command is equivalent to doing first a |\setleftkerning| and
3062 then a |\setrightkerning|.
3063
3064 \begin{decl}[v1.906]
3065 |\noleftkerning|\arg{glyph}\\
3066 |\norightkerning|\arg{glyph}\\
3067 |\noleftrightkerning|\arg{glyph}
3068 \end{decl}
3069 Removes all kerning on the specified side(s) of the \meta{glyph}.
3070
3071 \begin{decl}[v1.9]
3072 |\unsetkerns|\marg{left~glyph~list}\marg{right~glyph~list}
3073 \end{decl}
3074 Removes all kerns with one glyph in the \meta{left glyph list} on the
3075 left and one glyph in the \meta{right glyph list} on the right.
3076
3077
3078
3079 \subsection{Other}
3080
3081 \begin{decl}[v1.915]
3082 |\aliased|\marg{font's name}\marg{alias name}
3083 \end{decl}
3084 This command, which syntactically counts as a \meta{string
3085 expression}, is meant to be used in glyph name arguments of commands
3086 one may find in metric files. It was added to support combining
3087 mapfile entry generation with a custom form of reglyphing that has
3088 been developed for the \texttt{T2} bundle (Cyrillic font support).
3089 This does however not necessarily mean that the \texttt{T2} bundle
3090 has been updated to take advantage of this feature.
3091
3092 The basic problem is that cyrillic fonts display a much greater
3093 variation in how the glyphs are named than latin fonts do.%
3094 \footnote{The Adobe guidelines have not been as prevailing here as
3095 in the latin range, but this isn't entirely surprising when they
3096 give opaque suggestions such as using the name \texttt{afii10018}
3097 for \texttt{U+0411} (\textsc{cyrillic capital letter be}). The
3098 suggestion made some sense though; AFII (Association for Font
3099 Information Interchange) maintained a glyph registry.}
3100 This complicates writing files similar to \setfilename{latin.mtx}, so
3101 the author of the \texttt{T2} bundle took the route to regularize the
3102 glyph names at the \afm to \mtx conversion step. Since \TeX\ does not
3103 know anything about glyph names, this makes no difference for the
3104 virtual fonts that are built.
3105 The glyph names do however make a difference for base fonts that are
3106 reencoded, since \PS encoding vectors list explicit glyph names that
3107 have to be the same as in the font. \Fontinst's choice of encoding
3108 vector for a mapfile entry is based on which \etx file was used in the
3109 reencoding, and hence the glyph names used when reencoding must match
3110 those actually used in the font, or problems will follow.
3111
3112 The |\aliased| command can be used to preserve the information
3113 necessary for such reencodings. If a glyph name is specified as for
3114 example
3115 \begin{verbatim}
3116 \aliased{afii10018}{CYRB}
3117 \end{verbatim}
3118 then \fontinst will behave as if the glyph name is \texttt{CYRB}
3119 (i.e., the \meta{alias name}) for all purposes \emph{except}
3120 reencoding, where instead \fontinst behaves as if the glyph name is
3121 the \meta{font's name} \texttt{afii10018}. This makes it possible to
3122 use \etx files when reencoding which can be correctly translated to
3123 the right encoding vectors.
3124
3125
3126 \begin{decl}[v1.931]
3127 |\providepsencoding|\marg{etx}\marg{postscript name}\marg{action}
3128 \end{decl}
3129 If this command occurs in an \mtx file then it was placed there by a
3130 |\declare|\-|ps|\-|encoding| in an \etx file that was used to
3131 reencode this \mtx. It is meant for consumption by the mapfile writer,
3132 and is ignored by main \fontinst.
3133
3134
3135
3136 \section{\textsf{fontdoc} commands}
3137
3138 The following commands are defined by \fontdoc but are unknown to
3139 \fontinst.
3140
3141
3142 \subsection{Comment commands}
3143
3144 \begin{decl}
3145 |\plaindiv|\\
3146 |\plainint|\\
3147 |\plainmax|\\
3148 |\plainmin|\\
3149 |\plainneg|
3150 \end{decl}
3151 These are the \LaTeX\ definitions of |\div|, |\int|, |\max|, |\min|,
3152 and |\neg| respectively. They are provided under these names because
3153 \fontinst uses the normal names for integer expression constructions.
3154
3155 \begin{decl}[v1.8]
3156 |\slotexample|
3157 \end{decl}
3158 This typesets the character in the current slot from the example font
3159 (cf.~|\use|\-|example|\-|font|).
3160
3161 \begin{decl}[v1.916]
3162 |\macroparameter|\marg{digit}
3163 \end{decl}
3164 This can be used in integer and string expressions. It typesets as
3165 \textit{\#n}, where `\textit{n}' is the \meta{digit}.
3166
3167 \begin{decl}[v1.918]
3168 |\textunicode|\marg{code point}\marg{name}
3169 \end{decl}
3170 This generates a reference to a particular Unicode character, for use
3171 within a |\comment| or similar.
3172
3173
3174 \subsection{Style control commands}
3175
3176 \begin{decl}[v1.909]
3177 |\showbranches|
3178 \end{decl}
3179 The is the main switch that turns on displaying both branches of
3180 \fontinst conditionals. If you use this command in an encoding or
3181 metrics file, you \textbf{must} use |\Else| and |\Fi| to delimit the
3182 conditionals in that file. If you do not use this command in an
3183 encoding or metrics file, then the conditionals will not generate any
3184 typeset material and neither will their \meta{else branch}es.
3185
3186
3187
3188
3189 \section{\fontinst variables}
3190 \label{Sec:Variables}
3191
3192 The following is a list of the \fontinst variables that are
3193 accessible for the user through the |\set|\textellipsis,
3194 |\reset|\textellipsis, |\unset|\textellipsis, etc.\ commands. You may
3195 of course set or use other variables in the \mtx and \etx files you
3196 write yourself, as does for example the standard \mtx file
3197 \texttt{latin.mtx}, but all variables that \fontinst commands
3198 implicitly use or set are listed below.
3199
3200 % \begin{list}{}{%
3201 % \setlength\labelwidth{0pt}%
3202 % \setlength\itemindent{-\leftmargin}%
3203 % \setlength\parsep{0pt}
3204 % \def\makelabel#1{\hspace\labelsep \normalfont\ttfamily #1}%
3205 % }
3206 \begin{itemize}
3207 \item[acccapheight] (integer denoting length)
3208 \begin{smalldes}
3209 \item[Description] The height of accented full capitals.
3210 \item[Set by] \mtx files.
3211 \item[Used by] Some \etx and \mtx files.
3212 \end{smalldes}
3213 \item[address] (string)
3214 \begin{smalldes}
3215 \item[Description] Snailmail address put in \BibTeX-style file
3216 header of automatically generated \enc files. No
3217 \texttt{address} field is written unless the \texttt{address}
3218 string is set. Quotes are not automatically inserted around
3219 the \texttt{address} string.
3220 \item[Set by] \etx files.
3221 \item[Used by] The \etx-to-\enc converter.
3222 \end{smalldes}
3223 \item[afm-name] (string)
3224 \begin{smalldes}
3225 \item[Description] Name of source font. Internal variable.
3226 \item[Set by] |\from|\dots\ commands.
3227 \item[Used by] The |\transform|\-|font|, |\install|\-|font|,
3228 |\install|\-|raw|\-|font|, and |\reglyph|\-|font| commands.
3229 \end{smalldes}
3230 \item[ascender] (integer denoting length)
3231 \begin{smalldes}
3232 \item[Description] The ascender height of the font.
3233 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3234 |\setint| commands for this integer.
3235 \item[Used by] Some \mtx and \etx files.
3236 \end{smalldes}
3237 \item[author] (string)
3238 \begin{smalldes}
3239 \item[Description] Author name(s) put in \BibTeX-style file
3240 header of automatically generated \enc files. See the macro
3241 |\ref_to_sourcefile| for more details.
3242 \item[Set by] \etx files.
3243 \item[Used by] The \etx-to-\enc converter. When not set, the
3244 value \texttt{"See file }\meta{etx name}\texttt{"} is used
3245 instead.
3246 \end{smalldes}
3247 \item[\cs{autoinstallfamily}] (command)
3248 \begin{smalldes}
3249 \item[Description] Command called by the font installation
3250 commands, as
3251 \begin{quote}
3252 |\autoinstallfamily|\marg{encoding}\marg{family}
3253 \end{quote}
3254 when they are asked to install a font with a combination of
3255 \meta{encoding} and \meta{family} that has not been seen
3256 before (there was no explicit |\installfamily|).
3257 \item[Set by] Explicit commands. Defaults to calling
3258 |\installfamily|.
3259 \item[Used by] Font installation commands.
3260 \end{smalldes}
3261 \item[axisheight] (integer denoting length)
3262 \begin{smalldes}
3263 \item[Description] Math formula parameter $\sigma\sb{22}$.
3264 \item[Set by] \mtx files.
3265 \item[Used by] Some \etx and \mtx files.
3266 \end{smalldes}
3267 \item[baselineskip] (integer denoting length)
3268 \begin{smalldes}
3269 \item[Description]
3270 The font designer's recommendation for natural length of the
3271 \TeX\ parameter |\baselineskip|.
3272 \item[Set by] \mtx files.
3273 \item[Used by] Some \etx and \mtx files.
3274 \end{smalldes}
3275 \item[bigopspacing1] (integer denoting length)
3276 \begin{smalldes}
3277 \item[Description] Math formula parameter $\xi\sb{9}$.
3278 \item[Set by] \mtx files.
3279 \item[Used by] Some \etx and \mtx files.
3280 \end{smalldes}
3281 \item[bigopspacing2] (integer denoting length)
3282 \begin{smalldes}
3283 \item[Description] Math formula parameter $\xi\sb{10}$.
3284 \item[Set by] \mtx files.
3285 \item[Used by] Some \etx and \mtx files.
3286 \end{smalldes}
3287 \item[bigopspacing3] (integer denoting length)
3288 \begin{smalldes}
3289 \item[Description] Math formula parameter $\xi\sb{11}$.
3290 \item[Set by] \mtx files.
3291 \item[Used by] Some \etx and \mtx files.
3292 \end{smalldes}
3293 \item[bigopspacing4] (integer denoting length)
3294 \begin{smalldes}
3295 \item[Description] Math formula parameter $\xi\sb{12}$.
3296 \item[Set by] \mtx files.
3297 \item[Used by] Some \etx and \mtx files.
3298 \end{smalldes}
3299 \item[bigopspacing5] (integer denoting length)
3300 \begin{smalldes}
3301 \item[Description] Math formula parameter $\xi\sb{13}$.
3302 \item[Set by] \mtx files.
3303 \item[Used by] Some \etx and \mtx files.
3304 \end{smalldes}
3305 \item[capheight] (integer denoting length)
3306 \begin{smalldes}
3307 \item[Description] The height of the font's full capitals.
3308 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3309 |\setint| commands for this variable.
3310 \item[Used by] Some \mtx and \etx files.
3311 \end{smalldes}
3312 \item[cmapname] (string)
3313 \begin{smalldes}
3314 \item[Description] The name given to the CMap generated from
3315 an \etx file.
3316 \item[Set by] \etx files.
3317 \item[Used by] The \etx-to-CMap converter. When not set, the
3318 value |fontinst-|\nolinebreak[1]\meta{cmap file name} is
3319 used instead.
3320 \end{smalldes}
3321 \item[codingscheme] (string)
3322 \begin{smalldes}
3323 \item[Description] The codingscheme name.
3324 \item[Set by] \etx files.
3325 \item[Used by] The \cvpl writer. When not set, the
3326 value \texttt{UNKNOWN} is used instead.
3327 \end{smalldes}
3328 \item[defaultrulethickness] (integer denoting length)
3329 \begin{smalldes}
3330 \item[Description] Math formula parameter $\xi\sb{8}$.
3331 \item[Set by] \mtx files.
3332 \item[Used by] Some \etx and \mtx files.
3333 \end{smalldes}
3334 \item[delim1] (integer denoting length)
3335 \begin{smalldes}
3336 \item[Description] Math formula parameter $\sigma\sb{20}$.
3337 \item[Set by] \mtx files.
3338 \item[Used by] Some \etx and \mtx files.
3339 \end{smalldes}
3340 \item[delim2] (integer denoting length)
3341 \begin{smalldes}
3342 \item[Description] Math formula parameter $\sigma\sb{21}$.
3343 \item[Set by] \mtx files.
3344 \item[Used by] Some \etx and \mtx files.
3345 \end{smalldes}
3346 \item[denom1] (integer denoting length)
3347 \begin{smalldes}
3348 \item[Description] Math formula parameter $\sigma\sb{11}$.
3349 \item[Set by] \mtx files.
3350 \item[Used by] Some \etx and \mtx files.
3351 \end{smalldes}
3352 \item[denom2] (integer denoting length)
3353 \begin{smalldes}
3354 \item[Description] Math formula parameter $\sigma\sb{12}$.
3355 \item[Set by] \mtx files.
3356 \item[Used by] Some \etx and \mtx files.
3357 \end{smalldes}
3358 \item[descender] (integer denoting length)
3359 \begin{smalldes}
3360 \item[Description] The depth of lower case letters with descenders.
3361 \item[Set by] \mtx files.
3362 \item[Used by] Some \etx and \mtx files.
3363 \end{smalldes}
3364 \item[descender\_neg] (integer denoting length)
3365 \begin{smalldes}
3366 \item[Description] The vertical position of the descender line
3367 of the font, i.e., the negative of the font's descender depth.
3368 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3369 |\setint| commands for this variable.
3370 \item[Used by] Some \mtx and \etx files.
3371 \end{smalldes}
3372 \item[designsize] (dimension)
3373 \begin{smalldes}
3374 \item[Description] The design size of the font.
3375 \item[Set by] \mtx files. The \cvpl-to-\mtx converter usually writes
3376 |\setdim| commands for this variable.
3377 \item[Used by] The \cvpl writer. The design size defaults to
3378 $10\,\mathrm{pt}$ if this variable is not set.
3379 \item[Note] The value of this variable has no effect on how
3380 the font is declared to \LaTeX.
3381 \end{smalldes}
3382 \item[designunits] (dimension denoting a real number)
3383 \begin{smalldes}
3384 \item[Description] The design size of a font expressed in the
3385 design unit used in a \cvpl file.
3386 \item[Set by] \mtx files. The \cvpl-to-\mtx converter usually writes
3387 |\setdim| commands for this variable.
3388 \item[Used by] Nothing. If this variable is set, but to any
3389 value other than $1\,\mathrm{pt}$, then some metrics are most
3390 likely wrong.
3391 \end{smalldes}
3392 \item[digitwidth] (integer denoting length)
3393 \begin{smalldes}
3394 \item[Description] The median width of the digits in the font.
3395 \item[Set by] \mtx files.
3396 \item[Used by] Some \etx and \mtx files.
3397 \end{smalldes}
3398 \item[email] (string)
3399 \begin{smalldes}
3400 \item[Description] Email address put in \BibTeX-style file
3401 header of automatically generated \enc files. See the macro
3402 |\ref_to_sourcefile| for more details.
3403 \item[Set by] \etx files.
3404 \item[Used by] The \etx-to-\enc converter. When not set, the
3405 value \texttt{"See file }\meta{etx name}\texttt{"} is used
3406 instead.
3407 \end{smalldes}
3408 \item[encodingname] (string)
3409 \begin{smalldes}
3410 \item[Description] The name by which the encoding in question is
3411 made known to a Postscript interpreter.
3412 \item[Set by] \etx files.
3413 \item[Used by] The \etx-to-\enc converter. When not set, the
3414 value |fontinst-|\nolinebreak[1]|autoenc-|\nolinebreak[1]%
3415 \meta{etx name} is used instead.
3416 \end{smalldes}
3417 \item[etx-name] (string)
3418 \begin{smalldes}
3419 \item[Description] Name of \etx file. Internal variable in
3420 |\transform|\-|font|.
3421 \item[Set by] The |\reencodefont| command.
3422 \item[Used by] The |\mtxtomtx| command.
3423 \end{smalldes}
3424 \item[extraspace] (integer denoting length)
3425 \begin{smalldes}
3426 \item[Description]
3427 The natural width of extra interword glue at the end of a
3428 sentence.
3429 \item[Set by] \mtx files.
3430 \item[Used by] Some \etx and \mtx files.
3431 \end{smalldes}
3432 \item[fontdimen($n$)] (integer)
3433 \begin{smalldes}
3434 \item[Description] Family of semi-internal variables that store
3435 the values to use for font dimension $n$. It is preferred
3436 that the newer |\set|\-|font|\-|dimen| interface is used for
3437 setting these values.
3438 \item[Set by] \etx files.
3439 \item[Used by] The \cvpl writer.
3440 \end{smalldes}
3441 \item[\cs{iftokeep}] (macro)
3442 \begin{smalldes}
3443 \item[Description] |\iftokeep|\,\#1\,|\then|, where \#1 will
3444 be a \meta{number}, behaves like a switch and decides whether
3445 a glyph is kept or not while reglyphing.
3446 \item[Set by] Explicit commands. Defaults to
3447 $$
3448 \mbox{\cs{iftokeep}\,\#1\,\cs{then}} \mapsto
3449 \mbox{\cs{ifnum}\,\texttt{-1<}\#1}
3450 $$
3451 \item[Used by] The |\reglyphfont| command.
3452 \end{smalldes}
3453 \item[interword] (integer denoting length)
3454 \begin{smalldes}
3455 \item[Description] The natural width of interword glue (spaces).
3456 \item[Set by] \mtx files.
3457 \item[Used by] Some \etx and \mtx files.
3458 \end{smalldes}
3459 \item[italicslant] (integer denoting factor)
3460 \begin{smalldes}
3461 \item[Description] The italic slant of a font.
3462 \item[Set by] \mtx files generated from \afm or \cvpl files. \mtx
3463 files generated by |\transformfont|. Locally in the \afm-to-\mtx
3464 converter for possible use in |\uprightitalcorr| or
3465 |\slanteditalcorr|.
3466 \item[Used by] \mtx files (\texttt{latin.mtx} and the like). \etx
3467 files (for determining \texttt{fontdimen(1)}).
3468 \end{smalldes}
3469 \item[killweight] (integer)
3470 \begin{smalldes}
3471 \item[Description] Weight for glyphs that are killed.
3472 \item[Set by] Explicit commands. Defaults to $-10$ if not set.
3473 \item[Used by] The |\kill|\-|glyph| command; indirectly
3474 the |\reglyphfont| command.
3475 \end{smalldes}
3476 \item[letterspacing] (integer denoting length)
3477 \begin{smalldes}
3478 \item[Description] Extra width added to all glyphs of a font.
3479 \item[Set by] \mtx (preferred) or \etx files.
3480 \item[Used by] The \cvpl writer. Defaults to $0$ if not set.
3481 \end{smalldes}
3482 \item[maxdepth] (integer denoting length)
3483 \begin{smalldes}
3484 \item[Description] The maximal depth over all slots in the font.
3485 \item[Set by] \mtx files.
3486 \item[Used by] Some \etx and \mtx files.
3487 \end{smalldes}
3488 \item[maxdepth\_neg] (integer denoting length)
3489 \begin{smalldes}
3490 \item[Description] The negative of the maximal depth of a glyph in
3491 the font.
3492 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3493 |\setint| commands for this variable.
3494 \item[Used by] Some \etx and \mtx files.
3495 \end{smalldes}
3496 \item[maxheight] (integer denoting length)
3497 \begin{smalldes}
3498 \item[Description] The maximal height of a glyph in the font.
3499 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3500 |\setint| commands for this variable.
3501 \item[Used by] Some \etx and \mtx files.
3502 \end{smalldes}
3503 \item[minimumkern] (integer denoting length)
3504 \begin{smalldes}
3505 \item[Description] Kerns whose size in absolute value is less
3506 than or equal to this variable are ignored.
3507 \item[Set by] Command files or \mtx files.
3508 \item[Used by] The \afm-to-\mtx converter and the \cvpl file
3509 generator. When not set, the value $0$ is used instead.
3510 \end{smalldes}
3511 \item[monowidth] (flag integer)
3512 \begin{smalldes}
3513 \item[Description] Set if this font is monowidth, unset otherwise.
3514 \item[Set by] \mtx files. The \afm-to-\mtx converter writes a
3515 |\setint| command for this variable if the \afm specifies
3516 \texttt{IsFixedPitch true}.
3517 \item[Used by] Some \mtx files (\texttt{latin.mtx} and the like),
3518 \etx files.
3519 \end{smalldes}
3520 \item[num1] (integer denoting length)
3521 \begin{smalldes}
3522 \item[Description] Math formula parameter $\sigma\sb{8}$.
3523 \item[Set by] \mtx files.
3524 \item[Used by] Some \etx and \mtx files.
3525 \end{smalldes}
3526 \item[num2] (integer denoting length)
3527 \begin{smalldes}
3528 \item[Description] Math formula parameter $\sigma\sb{9}$.
3529 \item[Set by] \mtx files.
3530 \item[Used by] Some \etx and \mtx files.
3531 \end{smalldes}
3532 \item[num3] (integer denoting length)
3533 \begin{smalldes}
3534 \item[Description] Math formula parameter $\sigma\sb{10}$.
3535 \item[Set by] \mtx files.
3536 \item[Used by] Some \etx and \mtx files.
3537 \end{smalldes}
3538 \item[quad] (integer denoting length)
3539 \begin{smalldes}
3540 \item[Description]
3541 The quad width of the font, normally approximately equal to
3542 the font size and\slash or the width of an `M'.
3543 \item[Set by] \mtx files.
3544 \item[Used by] Some \etx and \mtx files.
3545 \item[Note]
3546 It is the quad width in the symbol math font (family~|2|)
3547 that \TeX\ uses as reference when translating |mu|s to
3548 ordinary lengths. Hence that quad can be considered a math
3549 font designer's scaling factor for |mu|.
3550 \end{smalldes}
3551 \item[PSfontsuffix] (string)
3552 \begin{smalldes}
3553 \item[Description] Suffix added to font names to form name of
3554 file to download to include font.
3555 \item[Set by] Explicit commands in mapmaking command
3556 files. Defaults to `\texttt{.pfa}'.
3557 \item[Used by] The map file fragments writer.
3558 \end{smalldes}
3559 \item[rawscale] (integer denoting factor)
3560 \begin{smalldes}
3561 \item[Description] Scaling factor applied to raw glyphs.
3562 \item[Set by] The |\installfont| command (\texttt{scaled}
3563 clauses in argument \#2). Unset for metric files listed
3564 without a \texttt{scaled} clause.
3565 \item[Used by] The |\set|\-|raw|\-|glyph|,
3566 |\set|\-|not|\-|glyph|, |\set|\-|scaled|\-|raw|\-|glyph|,
3567 |\set|\-|scaled|\-|not|\-|glyph|, |\set|\-|kern|, and
3568 |\reset|\-|kern| commands.
3569 \end{smalldes}
3570 \item[renameweight] (integer)
3571 \begin{smalldes}
3572 \item[Description] Weight for glyphs that are renamed.
3573 \item[Set by] Explicit commands. Defaults to $1$ if not set.
3574 \item[Used by] The |\rename|\-|glyph| command; indirectly
3575 the |\reglyphfont| command.
3576 \end{smalldes}
3577 \item[requireglyphs] (flag integer)
3578 \begin{smalldes}
3579 \item[Description] Set if warnings are to be generated for
3580 glyphs listed in \etx files but not present in the glyph
3581 base.
3582 \item[Set by] Explicit commands. By default not set.
3583 \item[Used by] The \cvpl file generator.
3584 \end{smalldes}
3585 \item[rightboundary] (string)
3586 \begin{smalldes}
3587 \item[Description] The name of a glyph with the property that
3588 kerns on the left may be intended as right word boundary kerns.
3589 \item[Set by] \mtx files. The \cvpl-to-\mtx converter can write
3590 |\setstr| commands for this variable.
3591 \item[Used by] Some \mtx files.
3592 \end{smalldes}
3593 \item[shrinkword] (integer denoting length)
3594 \begin{smalldes}
3595 \item[Description]
3596 The (finite) shrink component of interword glue.
3597 \item[Set by] \mtx files.
3598 \item[Used by] Some \etx and \mtx files.
3599 \end{smalldes}
3600 \item[slant-scale] (integer denoting factor)
3601 \begin{smalldes}
3602 \item[Description] Factor to slant by.
3603 Internal variable in |\transform|\-|font|.
3604 \item[Set by] The |\slant|\-|font|, |\xscale|\-|font|, and
3605 |\scale|\-|font| commands.
3606 \item[Used by] The |\mtxtomtx| command.
3607 \end{smalldes}
3608 \item[\cs{SlantAmount}] (macro expanding to an integer expression)
3609 \begin{smalldes}
3610 \item[Description] Slant factor used for faking oblique shape.
3611 \item[Set by] Explicit commands. Defaults to \texttt{167}.
3612 \item[Used by] The |\latinfamily| command.
3613 \end{smalldes}
3614 \item[\cs{slanteditalcorr}]
3615 (macro expanding to an integer expression)
3616 \begin{smalldes}
3617 \item[Description] The integer expression used to calculate a
3618 guess for the italic correction of glyphs in a font with
3619 positive slant. It has the syntax
3620 \begin{quote}
3621 \cs{slanteditalcorr}\marg{width}\marg{left}\marg{right}%
3622 \marg{bottom}\marg{top}
3623 \end{quote}
3624 where \meta{width} is the glyph's advance width, and the
3625 remaining arguments are coordinates of sides of the glyph's
3626 bounding box. The \texttt{italicslant} integer provides the
3627 italic slant of the font.
3628 \item[Set by] Explicit commands in \textsf{fontinst} command
3629 files. Defaults to
3630 $$
3631 \max\{0, \mathit{right}-\mathit{width}\}.
3632 $$
3633 \item[Used by] The \afm-to-\mtx converter.
3634 \end{smalldes}
3635 \item[stretchword] (integer denoting length)
3636 \begin{smalldes}
3637 \item[Description]
3638 The (finite) stretch component of interword glue.
3639 \item[Set by] \mtx files.
3640 \item[Used by] Some \etx and \mtx files.
3641 \end{smalldes}
3642 \item[sub1] (integer denoting length)
3643 \begin{smalldes}
3644 \item[Description] Math formula parameter $\sigma\sb{16}$.
3645 \item[Set by] \mtx files.
3646 \item[Used by] Some \etx and \mtx files.
3647 \end{smalldes}
3648 \item[sub2] (integer denoting length)
3649 \begin{smalldes}
3650 \item[Description] Math formula parameter $\sigma\sb{17}$.
3651 \item[Set by] \mtx files.
3652 \item[Used by] Some \etx and \mtx files.
3653 \end{smalldes}
3654 \item[subdrop] (integer denoting length)
3655 \begin{smalldes}
3656 \item[Description] Math formula parameter $\sigma\sb{19}$.
3657 \item[Set by] \mtx files.
3658 \item[Used by] Some \etx and \mtx files.
3659 \end{smalldes}
3660 \item[sup1] (integer denoting length)
3661 \begin{smalldes}
3662 \item[Description] Math formula parameter $\sigma\sb{13}$.
3663 \item[Set by] \mtx files.
3664 \item[Used by] Some \etx and \mtx files.
3665 \end{smalldes}
3666 \item[sup2] (integer denoting length)
3667 \begin{smalldes}
3668 \item[Description] Math formula parameter $\sigma\sb{14}$.
3669 \item[Set by] \mtx files.
3670 \item[Used by] Some \etx and \mtx files.
3671 \end{smalldes}
3672 \item[sup3] (integer denoting length)
3673 \begin{smalldes}
3674 \item[Description] Math formula parameter $\sigma\sb{15}$.
3675 \item[Set by] \mtx files.
3676 \item[Used by] Some \etx and \mtx files.
3677 \end{smalldes}
3678 \item[supdrop] (integer denoting length)
3679 \begin{smalldes}
3680 \item[Description] Math formula parameter $\sigma\sb{18}$.
3681 \item[Set by] \mtx files.
3682 \item[Used by] Some \etx and \mtx files.
3683 \end{smalldes}
3684 \item[TFMfileprefix] (string)
3685 \begin{smalldes}
3686 \item[Description] Prefix (typically a path) added to names of
3687 TFM files.
3688 \item[Set by] Explicit commands in mapmaking command
3689 files. By default not set, which is equivalent to being empty.
3690 \item[Used by] The \texttt{pltotf} ``map file fragments writer''.
3691 \end{smalldes}
3692 \item[underlinethickness] (integer denoting length)
3693 \begin{smalldes}
3694 \item[Description] The recommended thickness of an underlining
3695 rule.
3696 \item[Set by] \mtx files. The \afm-to-\mtx converter usually writes
3697 |\setint| commands for this variable.
3698 \item[Used by] Some \mtx files (\texttt{latin.mtx} and the like).
3699 \end{smalldes}
3700 \item[\cs{uprightitalcorr}]
3701 (macro expanding to an integer expression)
3702 \begin{smalldes}
3703 \item[Description] The integer expression used to calculate a
3704 guess for the italic correction of glyphs in a font with
3705 non-positive slant. It has the syntax
3706 \begin{quote}
3707 \cs{uprightitalcorr}\marg{width}\marg{left}\marg{right}%
3708 \marg{bottom}\marg{top}
3709 \end{quote}
3710 where \meta{width} is the glyph's advance width, and the
3711 remaining arguments are coordinates of sides of the glyph's
3712 bounding box. The \texttt{italicslant} integer provides the
3713 italic slant of the font.
3714 \item[Set by] Explicit commands in \textsf{fontinst} command
3715 files. Defaults to $0$.
3716 \item[Used by] The \afm-to-\mtx converter.
3717 \end{smalldes}
3718 \item[version] (string)
3719 \begin{smalldes}
3720 \item[Description] Version number put in \BibTeX-style file
3721 header of automatically generated \enc files. See the macro
3722 |\ref_to_sourcefile| for more details.
3723 \item[Set by] \etx files.
3724 \item[Used by] The \etx-to-\enc converter. When not set, the
3725 value \texttt{"See file }\meta{etx name}\texttt{"} is used
3726 instead.
3727 \end{smalldes}
3728 \item[verticalstem] (integer denoting length)
3729 \begin{smalldes}
3730 \item[Description] The dominant width of vertical stems
3731 (usually the width of stems of lower case letters).
3732 \item[Set by] \mtx files. The \afm-to-\mtx converter writes
3733 |\setint| commands for this variable if the \afm file specifies
3734 \texttt{StdVW}.
3735 \item[Used by] Currently nothing.
3736 \end{smalldes}
3737 \item[\texttt{warningspecials}] (switch)
3738 \begin{smalldes}
3739 \item[Description] Controls whether |\glyphwarning| commands
3740 will generate \vpl \texttt{SPECIAL}s. Defaults to `true'.
3741 \item[Set by] Explicit commands (|\warningspecialstrue| and
3742 |\warningspecialsfalse|).
3743 \item[Used by] The \cvpl file generator.
3744 \end{smalldes}
3745 \item[x-scale] (integer denoting factor)
3746 \begin{smalldes}
3747 \item[Description] Horizontal scaling factor.
3748 Internal variable in |\transform|\-|font|.
3749 \item[Set by] The |\xscale|\-|font| and |\scale|\-|font| commands.
3750 \item[Used by] The |\mtxtomtx| command.
3751 \end{smalldes}
3752 \item[xheight] (integer denoting length)
3753 \begin{smalldes}
3754 \item[Description] The x-height of the font.
3755 \item[Set by] \mtx files. The \afm-to-\mtx and \cvpl-to-\mtx
3756 converters usually write |\setint| commands for this variable.
3757 \item[Used by] \mtx files, and \etx files (for determining
3758 \texttt{fontdimen(5)}).
3759 \end{smalldes}
3760 \item[y-scale] (integer denoting factor)
3761 \begin{smalldes}
3762 \item[Description] Vertical scaling factor.
3763 Internal variable in |\transform|\-|font|.
3764 \item[Set by] The |\yscale|\-|font| and |\scale|\-|font| commands.
3765 \item[Used by] The |\mtxtomtx| command.
3766 \end{smalldes}
3767 \item[\meta{\rmfamily glyph}-spacing] (integer denoting length)
3768 \begin{smalldes}
3769 \item[Description] Glyph-specific override for
3770 \texttt{letterspacing}; extra width added to the glyph
3771 \meta{glyph} as part of the process of writing a \vpl
3772 file.
3773 \item[Set by] \etx or \mtx files.
3774 \item[Used by] The \cvpl writer. Defaults to $0$ if not set.
3775 \end{smalldes}
3776 \end{itemize}
3777 % \end{list}
3778 Besides these, the |\latinfamily| command provides a whole range of
3779 helper macros (|\latin_weights|, |\latin_widths|, |\latin_shapes|,
3780 etc.) that are often used somewhat like variables. That subject
3781 does however deserve to be treated separately.
3782
3783
3784
3785 \section{Customisation}
3786
3787 The \fontinst package reads a file \texttt{fontinst.rc} if it
3788 exists. This can contain your own customisations. The catcodes that
3789 are in force when this file is read are the same as those selected by
3790 |\fontinstcc|.
3791
3792 Similarly \texttt{finstmsc.sty} reads \texttt{finstmsc.rc} and the
3793 \fontdoc package reads \texttt{fontdoc.cfg}.
3794
3795 You can create a \texttt{fontinst} format by running ini\TeX{} on
3796 \texttt{fontinst.sty} then saying \verb|\dump|.
3797
3798
3799 \section{Notes on features new with v\,1.9}
3800
3801 The following notes are copied from \texttt{fisource.tex}; they were
3802 written to explain new \fontinst features to old \fontinst users.
3803
3804
3805 \subsection{Metric packages}
3806
3807 \Fontinst has traditionally come with a collection of \mtx
3808 files that complement the \mtx files generated from base font metrics,
3809 in that they build glyphs that may be missing from the base fonts or
3810 in some other way needs to be improved. The most well-known of these
3811 is the \texttt{latin.mtx} file; other examples include
3812 \texttt{textcomp.mtx}, \texttt{mathit.mtx}, and \texttt{latinsc.mtx}.
3813 A problem with these is however that they cannot produce optimal
3814 results for all fonts simply because there are irregular differences
3815 in how fonts are set up by the foundries. Most glyphs come out all right,
3816 but there are usually a few for which the parameters used are more or
3817 less wrong. Therefore most high quality font installations are made
3818 with modified versions of these files, where the parameters have been
3819 tuned to the specific font design.
3820
3821 Modifying in particular \texttt{latin.mtx} is however not an entirely
3822 easy task, because this is a rather large file (with plenty of
3823 archaic pieces of code in curious places). Doing it once is no big
3824 problem, but if one has to do it several times (maybe because some
3825 errors are discovered in the original \texttt{latin.mtx}) then it is
3826 probably no fun anymore. Furthermore, if one has two or three
3827 modified copies of this file because one has made high quality
3828 installations of that many different fonts then even a trivial bugfix
3829 might start to feel like entirely too much work.
3830
3831 If one has to make modifications then it is usually easier to deal
3832 with several small files (many of which can be used unchanged) than
3833 one big file. Thus it would be better if these big files were split up
3834 into several smaller ones.
3835 The main problem with splitting up something like \texttt{latin.mtx}
3836 is that there are some commands which are defined at the top and
3837 which are then used in almost all sections of the file. One must make
3838 certain that these commands are always loaded, which makes the metric
3839 files somewhat harder to use (especially if the one who tries to use
3840 them is not the one who wrote them).
3841
3842 One strategy is to include all definitions needed for a metric file in
3843 it. This has the slight disadvantage that the commands will have to be
3844 defined several times. What is worse however, is that the command
3845 definitions will appear in several files, so if one finds a bug in one
3846 of them, one cannot simply correct this bug in one place. As the number
3847 of files can soon become quite large, correcting such bugs can become
3848 a boring procedure indeed.
3849
3850 Another strategy is to put all the command definitions in one file
3851 and then explicitly include it in the \meta{file-list} argument of
3852 |\installfont|. This eliminates the repeated bug fixing problem, but
3853 requires the user to do something that the computer can actually do
3854 just as well.
3855
3856 A third strategy is to put the command definitions in one or several
3857 files and then in each metric file the user explicitly mentions load
3858 the command definitions needed for that particular file. Metric
3859 packages uses an improved version of this strategy, since they also
3860 make it possible for \fontinst to remember which packages (i.e., sets
3861 of command definitions) that have already been loaded, so that they
3862 are not unnecessarily loaded again. The \texttt{newlatin.mtx} file is
3863 an alternative to \texttt{latin.mtx} that implements this strategy.
3864 Most of the actual code is located in the following metric packages:
3865 \begin{center}
3866 \begin{tabular}{l p{0.7\linewidth}}
3867 \texttt{ltcmds.mtx}& Defines some common commands used by the other
3868 files.\\
3869 \texttt{llbuild.mtx}& Builds the latin lower case alphabet
3870 (unaccented letters are `unfakable', the rest are constructed if
3871 not present in the base fonts).\\
3872 \texttt{lubuild.mtx}& Builds the latin upper case alphabet.\\
3873 \texttt{lsbuild.mtx}& Builds accented letters in the latin
3874 smallcaps alphabet, but only if there are unaccented letters to
3875 build them from in the base fonts.\\
3876 \texttt{lsfake.mtx}& Fakes a latin smallcaps alphabet by shrinking
3877 the upper case alphabet, but only if the glyph had not already
3878 been manufactured.\\
3879 \texttt{lsmisc.mtx}& Make some miscellaneous smallcaps glyphs
3880 (mostly ``smallcaps f-ligatures'').\\
3881 \texttt{ltpunct.mtx}& Makes digits, punctuation marks, and other
3882 symbols (mostly by marking as ``unfakable'').
3883 \end{tabular}
3884 \end{center}
3885 \noindent All of these are easy to use as components of equivalents
3886 of a modified \texttt{latin.mtx} files, and all dependencies of one
3887 package upon another are handled via explicit |\usemtxpackage|
3888 commands.
3889
3890 % For information on the syntax etcetera of commands related to metric
3891 % packages, see Section~\ref{Sec:Metric files}.
3892
3893
3894 \subsection{Word boundary ligatures and kerns}
3895
3896 One of the new features added in \TeX~3 was that of ligatures and
3897 kerns with word boundaries. \Fontinst has had an interface
3898 for making such ligatures and kerns, but it has been completely
3899 redesigned in v\,1.9 and the old interface (setting the integer
3900 |boundarychar|) is no longer recognized by \fontinst. Files
3901 which use the old interface can still be processed with
3902 \texttt{cfntinst.sty}, though.
3903
3904 Before considering the new commands, it is suitable to make a
3905 distinction between proper glyphs and pseudoglyphs. A proper glyph has
3906 been set using one of the commands |\setrawglyph|, |\setglyph|, and
3907 |\resetglyph|. A pseudoglyph is any name used in the context of a
3908 glyph name which does not denote a proper glyph. If a pseudoglyph
3909 |g-not| was set using the |\setnotglyph| command, then
3910 |\ifisglyph{g-not}\then| will evaluate to true, but something can be
3911 a pseudoglyph even if an |\ifisglyph| test evaluates to false. The
3912 interesting point about pseudoglyphs when considering word boundaries
3913 however, is that a pseudoglyph can have ligatures and kerns.
3914
3915 Kerns and ligatures at the left word boundary (beginning of word) are
3916 specified using the commands |\setleftboundary| and
3917 |\endsetleftboundary|, which are syntactically identical to
3918 |\setslot| and |\endsetslot| respectively. One important difference is
3919 however that the argument to |\setslot| must be a proper glyph, while
3920 the argument to |\setleftboundary| may be any glyph, hence any
3921 pseudoglyph will do just fine.
3922
3923 |\ligature| commands between |\setleftboundary| and
3924 |\endsetleftboundary| will generate beginning of word ligatures. Kerns
3925 on the right of the glyph specified in |\setleftboundary| will become
3926 beginning of word kerns.
3927
3928 Kerns and ligatures at the right word boundary (end of word) are
3929 trickier, due to the asymmetrical nature of the ligkern table in a \pl
3930 file. What a font can do is to specify that the right word boundary,
3931 for purposes of kerning and ligatures, should be interpreted as
3932 character $n$. By including a kern or ligature with character $n$ on
3933 the right, that kern or ligature will be used at the end of a word,
3934 but it will also be used each time the next character is character
3935 $n$. Because of this, one usually wants the slot $n$, which the right
3936 word boundary is interpreted as being, to be empty whenever the
3937 encoding allows this.
3938
3939 The command
3940 \begin{quote}
3941 |\setrightboundary|\marg{glyph}
3942 \end{quote}
3943 will mark the current slot as used to denote the right word boundary,
3944 and leave the slot empty, increasing the current slot number by one
3945 just like a |\setslot| \textellipsis\ |\endsetslot| block does. Kerns on
3946 the left of \meta{glyph} will be end of word kerns and |\ligature|
3947 commands with \meta{glyph} as the second argument will be for the end
3948 of a word.
3949
3950 The command
3951 \begin{quote}
3952 |\makerightboundary|\marg{glyph}
3953 \end{quote}
3954 is similar to |\setrightboundary|, but it is a slot command which may
3955 only be used between a |\setslot| and the matching |\endsetslot|. Like
3956 |\setrightboundary|, it marks the current slot as used to denote the
3957 right word boundary, but the glyph specified in the enclosing |\setslot|
3958 will be written to that slot. Ligatures for the glyph specified by the
3959 |\setslot| and ligatures for the glyph specified by the
3960 |\makerightboundary| will both be for this single slot. Kerns on the
3961 right of the |\setslot| glyph and the |\makerightboundary| glyph will
3962 similarly both be for this single slot. The idea is that the |\setslot|
3963 glyph should be used when making a kern or ligature for that glyph,
3964 while the |\makerightboundary| glyph should be used when making a kern
3965 or ligature for the end of a word. \Fontinst will warn you if
3966 these two uses of the slot directly contradict each other.
3967
3968
3969 \subsection{Changing the names of glyphs}
3970 \label{Ssec:Des:Reglyph}
3971
3972 Sometimes, primarily when making a virtual font from more than one raw
3973 font and two of the raw fonts contain different glyphs with the same
3974 name, it becomes necessary to change the names of some glyphs to make
3975 some sense out of it. The main source of this kind of trouble is the
3976 ``caps and small caps'' (SC) and ``oldstyle figures'' (OsF) fonts
3977 within many commercial font families. The typical problem is that what
3978 is typographically different glyphs---such as the lowercase `a'
3979 (\texttt{a}, for \fontinst) and the smallcaps `\textsc{a}'
3980 (\texttt{Asmall}, for \fontinst)---are given the same name by
3981 the foundry.
3982
3983 One way to get round this is to say for example
3984 \begin{quote}
3985 |\setglyph{Asmall} \glyph{a}{1000} \endsetglyph|\\
3986 |\setleftrightkerning{Asmall}{a}{1000}|\\
3987 |\unsetglyph{a}|\\
3988 |\noleftrightkerning{a}|
3989 \end{quote}
3990 and continuing like that for all the duplicate glyph names. This is
3991 however a rather prolix method and if the number of glyphs is large
3992 then it is usually simpler to use the |\reglyphfont| command.
3993
3994 To reglyph one or several fonts, one writes
3995 \begin{quote}
3996 |\reglyphfonts|\\
3997 \vadjust{}\quad \meta{reglyphing commands}\\
3998 |\endreglyphfonts|
3999 \end{quote}
4000 There are two types of reglyphing commands: the |\reglyphfont|
4001 command, and the commands that modify what |\reglyphfont| will do to
4002 the fonts it operates on. The syntax of |\reglyphfont| is
4003 \begin{quote}
4004 |\reglyphfont|\marg{destination font}\marg{source font}
4005 \end{quote}
4006 The \meta{source font} font here is the name (suffix not included, of
4007 course) of the font metric file one wants to change the glyph names in.
4008 This font metric file can be in any of the formats \mtx, \pl, \afm, and
4009 \vpl, and it will be converted to \mtx format if it isn't already in
4010 that format (this happens just as for files listed in the second
4011 argument of |\installfont|). \meta{destination font} (which must be
4012 different from \meta{source font}) will be taken as the name for a
4013 new \texttt{.mtx} file that will be generated. The destination font
4014 can differ from the source font only in two ways: the names of some
4015 glyphs in the source font might be changed, and some of the commands
4016 from the source font might not have been copied to the destination
4017 font. To what extent the fonts are different is determined by what
4018 modifying commands have been executed; when no modifying commands
4019 have been executed, the source and destination font are equal.
4020
4021 The modifying reglyphing commands are
4022 \begin{quote}
4023 |\renameglyph|\marg{to}\marg{from}\\
4024 |\renameglyphweighted|\marg{to}\marg{from}\marg{weight}\\
4025 |\killglyph|\marg{glyph}\\
4026 |\killglyphweighted|\marg{glyph}\marg{weight}\\
4027 |\offmtxcommand|\marg{command}\\
4028 |\onmtxcommand|\marg{command}
4029 \end{quote}
4030 |\renameglyph| simply declares that occurrences of the glyph name
4031 \meta{from} should be replaced by the glyph name \meta{to}. To each
4032 glyph name is also assigned a \emph{weight}, which is used by a
4033 mechanism which conditions copying of commands from the source font to
4034 the destination font by the set of glyphs that command mentions. The
4035 details of this mechanism are however somewhat tricky, so those
4036 interested in the full generality should read the comments in the
4037 source of \fontinst. Here it needs only be noted that if one applies
4038 |\killglyph| to a glyph name, then (under most circumstances) commands
4039 that refer to that glyph name will not be copied to the destination
4040 font.
4041
4042 |\offmtxcommand| and |\onmtxcommand| also control whether commands are
4043 copied to the destination font, but they look at the actual command
4044 rather than the glyphs it refers to. For example, after the command
4045 \begin{quote}
4046 |\offmtxcommand{\setkern}|
4047 \end{quote}
4048 no |\setkern| commands will be copied. By using |\offmtxcommand|, it
4049 is possible to achieve effects similar to those of the files
4050 \texttt{kernoff.mtx} and \texttt{glyphoff.mtx}---the difference is
4051 that with |\offmtxcommand|, it happens at an earlier stage of the font
4052 generation. As expected, |\onmtxcommand| undoes the effect of
4053 |\offmtxcommand|.
4054
4055 A special rule pertains to the |\set|\-|raw|\-|glyph|,
4056 |\set|\-|not|\-|glyph|, |\set|\-|scaled|\-|raw|\-|glyph|, and
4057 |\set|\-|scaled|\-|not|\-|glyph| commands, since |\transformfont|
4058 doesn't care what something was in the source font when it generates
4059 the transformed font. To turn these commands off while reglyphing,
4060 you use |\offmtx|\-|command| on |\set|\-|scaled|\-|raw|\-|glyph|.
4061
4062 The effects of modifying reglyphing commands are delimited by
4063 |\reglyphfonts| and |\endreglyphfonts|, which starts and ends a group
4064 respectively.
4065
4066 As we expect the most common reglyphing operation will be to go from SC
4067 glyph names to expert glyph names, there is a file \texttt{csc2x.tex}
4068 in the \fontinst distribution which contains the modifying
4069 reglyphing commands needed for setting up that conversion. Thus you
4070 can write for example
4071 \begin{quote}
4072 |\reglyphfonts|\\
4073 | \input csc2x|\\
4074 | \reglyphfont{padrcx8r}{padrc8r}|\\
4075 | \reglyphfont{padscx8r}{padsc8r}|\\
4076 |\endreglyphfonts|
4077 \end{quote}
4078 to alter the glyph names in the SC fonts in the Adobe Garamond
4079 (\texttt{pad}) family.
4080 Note that the names of the destination fonts here really are rather
4081 arbitrary, since they will only exist as \texttt{.mtx} files, and
4082 thus only need to work within your local file system. In particular,
4083 all the |\setrawglyph| commands in the destination font files still
4084 refer to the source font, so it is that font which the drivers need
4085 to know about.
4086
4087
4088 \subsection{Making map file fragments}
4089 \label{Ssec:MapFragments}
4090
4091 A \emph{map file fragment} is the lines\footnote{Not in general an
4092 entire map file, hence the word \emph{fragment}.} of a map file that
4093 the corresponding driver would need for handling some set of fonts.
4094 When told to, \fontinst can (in a fairly automatic way) create
4095 the map file fragment which is needed for the set of raw fonts
4096 \fontinst has (i) installed directly (using |\installrawfont|)
4097 or (ii) used as a base font for some installed virtual font (generated
4098 by |\installfont|). \Fontinst does not support the map file
4099 syntaxes of every existing driver, but the system is designed to be
4100 extendable and contributions that extend its capabilities are welcome.
4101 Nor can \fontinst examine your \TeX\ system and
4102 determine every piece of information needed to make the correct map
4103 file fragments, but you can tell it roughly how your installation
4104 looks, it can make guesses which work most of the time, and you can
4105 specify most things explicitly if the guesses turn out to be wrong.
4106 Should the available options for configuring the process turn out to
4107 be inadequate for your needs, then please write to the
4108 \fontinst mailing list about this---there is probably a way
4109 to improve the system so that your needs can be met.
4110
4111 Now what does one have to do to use this map file fragment writer,
4112 then? First you need to tell \fontinst to record the
4113 information the map file fragment writer needs. You do this by giving
4114 the command
4115 \begin{quote}
4116 |\recordtransforms{whatever.tex}|
4117 \end{quote}
4118 at the beginning of the run. Here \texttt{whatever.tex} is the name of
4119 a file that will be created, so you can use some other name if you
4120 like. After that you do all the calls to |\transform|\-|font|,
4121 |\install|\-|font|, |\install|\-|raw|\-|font|, |\latin|\-|family|,
4122 etc.\ you need to make the fonts you want. When you're done, you give
4123 the command
4124 \begin{quote}
4125 |\endrecordtransforms|
4126 \end{quote}
4127 and end the run (say |\bye|). The file \texttt{whatever.tex} will now
4128 contain the information about which fonts were used and what needs to
4129 be done with them.
4130
4131 The second step is to actually run the map file fragment writer.
4132 Observe that it is located in the file \texttt{finstmsc.sty}, not
4133 \texttt{fontinst.sty}! The commands you need to give it can be so few
4134 that you can type them in at \TeX's \texttt{*} prompt, but if you are
4135 writing a command file then it should typically have the following
4136 structure (comments not necessary, of course):
4137 \begin{center}
4138 \begin{tabular}{ll}
4139 |\input finstmsc.sty|& |%| Input command definitions\\
4140 \meta{general settings} & |%| See below\\
4141 |\adddriver|\marg{driver name}\marg{output file}&
4142 |%| Open output file\\
4143 |\input whatever.tex|& |%| Writes to output file(s)\\
4144 |\donedrivers|& |%| Close output file(s), tidy up\\
4145 |\bye|& |%| Quit
4146 \end{tabular}
4147 \end{center}
4148 The |\adddriver| command gives the order ``write map file entries for
4149 the \meta{driver name} \dvi driver to the file \meta{output file}.'' The
4150 plan is that it should be possible to use the name of just about any
4151 major driver (\texttt{dvips}, \texttt{xdvi},\footnote{Or
4152 does that use the same map file as \texttt{dvips}? I heard somewhere
4153 that it did. /LH} \texttt{pdftex},\footnote{pdf\TeX\ can read
4154 the map files generated for \texttt{dvips}, but a separate driver is
4155 desirable because the formats are not completely identical.}
4156 \texttt{OzTeX}, etc.) here and get suitable map file entries for that
4157 driver as output, but for the moment only the \texttt{dvips} and
4158 \texttt{dvipdfm}\footnote{Whose support I made very much to illustrate
4159 that you \emph{don't} have to be a big and ancient driver like
4160 \texttt{dvips} to have supporting code put into \fontinst.
4161 (The fact that I just happened to have printed out the documentation and
4162 that is was easy to read also helped, of course.) Note, however, that
4163 there won't be any support for a driver unless someone sits down and
4164 writes the code for it! Don't assume I will. /LH} drivers are supported.
4165
4166 You may also use \texttt{debug} or \texttt{pltotf} for \meta{driver name}.
4167 The \texttt{debug} ``\dvi driver'' file simply contains all the available
4168 information about each font (hence it should come handy for debugging
4169 code writing entries for real drivers) in a format that should be easy
4170 to interpret for a human. It could be the right choice if you're going
4171 to write the map file manually, as the combined effects of several
4172 font transformations are not always easy to compute manually. The
4173 file generated for the \texttt{pltotf} ``driver'' is actually a shell
4174 script consisting of a sequence of \pltotf commands. These commands
4175 perform the \pl to \tfm conversion for precisely those fonts that are
4176 actually needed (\fontinst usually generates \pl files also for a
4177 number of fonts at intermediate stages of transformation, and many of
4178 these need not be converted to \tfm files). The \texttt{TFMfileprefix}
4179 string can be used to add a directory path to the \tfm file names,
4180 perhaps saving the step of moving them to their proper location later.
4181
4182 The file \texttt{whatever.tex} in the above example contains the
4183 commands (|\make|\-|map|\-|entry| commands) that actually cause entries
4184 to be written to the output file. It also contains a number of
4185 |\store|\-|map|\-|data| commands---these describe how some given font
4186 was made. If some metric file you have used contains
4187 |\set|\-|raw|\-|glyph| commands that were not automatically generated
4188 by \fontinst, then there might not be a |\store|\-|map|\-|data| for
4189 the font they refer to in \texttt{whatever.tex}, so you will have to
4190 include such a command yourself somewhere. This can for example be done
4191 in the \meta{general settings} part of the above example file.
4192
4193 Another class of things that will typically appear in the
4194 \meta{general settings} part above is commands that will inform the
4195 routines actually writing output about your \TeX\ system, about the set
4196 of fonts you are using on this run, or about something else that might
4197 be useful. Some such commands are of a general nature and affect what
4198 assumptions \fontinst will make in certain conditions when no
4199 specific information is available. For the moment there commands are:
4200 \begin{description}
4201 \item[\cs{AssumeMetafont}] Assume all fonts with \pl metrics are
4202 bitmaps generated by Metafont, and therefore make no entries for
4203 them.
4204 \item[\cs{AssumeAMSBSYY}] Assume all fonts with \pl metrics have their
4205 \TeX\ names in all upper case as postscript names---just like the
4206 Computer Modern fonts in the AMS\slash Blue~Sky\slash Y\&Y
4207 distribution.
4208 \item[\cs{AssumeBaKoMa}] Assume all fonts with \pl metrics have their
4209 \TeX\ names in all lower case as postscript names---just like the
4210 Computer Modern fonts in the BaKoMa distribution.
4211 \end{description}
4212 Otherwise the default action of the routine for finding out the
4213 postscript name of a font simply is to observe that it hasn't got a clue
4214 about what the right value is when the metrics were taken from a \pl
4215 file, and therefore it writes `\texttt{??????}' for the postscript name.
4216 \begin{description}
4217 \item[\cs{AssumeLWFN}] Assume postscript fonts for which nothing
4218 else has been specified are stored in files which are named
4219 according to the \mbox{MacOS} scheme for
4220 \texttt{LWFN}s.%\footnote{LaserWriter FoNt}
4221 \end{description}
4222 Otherwise the default action is to use the name of the \afm or \pl from
4223 which the metrics were originally taken, and add the file suffix stored
4224 in the string \texttt{PSfontsuffix}. The default value of this string
4225 is \texttt{.pfa}, but it can be changed using |\resetstr|.
4226
4227 If neither the default nor the LWFN scheme produce correct results
4228 then you may use the more specific |\specifypsfont| command, which
4229 describes exactly which file (or files, if any) a given font is stored
4230 in. The syntax of this command is
4231 \begin{quote}
4232 |\specifypsfont|\marg{PS font name}\marg{actions}
4233 \end{quote}
4234 where the \meta{actions} is a sequence of ``action commands''.
4235 Currently the only such command is
4236 \begin{quote}
4237 |\download|\marg{file}
4238 \end{quote}
4239 which instructs the map file writer to include in any entry using
4240 that PS font and ``instruction'' that the specified file should be
4241 downloaded. Some examples are
4242 \begin{verbatim}
4243 \specifypsfont{Times-Roman}{}
4244 \specifypsfont{Shareware-Cyrillic-Regular}{\download{fcyr.gsf}}
4245 \specifypsfont{zmnl8ac6}{%
4246 \download{MinionMM.pfb}\download{zmnl8ac6.pro}%
4247 }
4248 \end{verbatim}
4249 Many \dvi drivers (for example \dvips) have more than one style of
4250 font downloading (e.g., partial and full downloading). This interface
4251 could be extended to control also such finer details (for example by
4252 adding a |\fulldownload| command to force full download of a font),
4253 but requests for this has so far been scarce.
4254
4255 Finally, there is the |\declarepsencoding| command which is used to
4256 link \etx files to postscript encodings. If no postscript encoding has
4257 been linked to a given \etx file then \fontinst will
4258 automatically create a postscript encoding (\texttt{.enc}) file for
4259 that encoding, and use this file for all reencoding commands.
4260 The \texttt{8r} encoding is predeclared, and it doesn't
4261 matter if an encoding is undeclared if you never use it to reencode
4262 fonts, but there is potentially a problem with not having declared
4263 encodings you have installed and use for reencoding, as you may then
4264 find yourself having two files with identical names that define
4265 encodings that do not have the same name (as far as postscript is
4266 concerned).
4267
4268
4269
4270 \subsection{Tuning accent positions---an application of loops}
4271
4272 The accent placements made by \texttt{latin.mtx} certainly aren't
4273 perfect for all fonts, and the only way to find out where they should
4274 be put is through trying in text the accented letters you get for a
4275 couple of values for the position parameter and deciding which one
4276 works best. Since to try one parameter value you need to (i) edit it
4277 into an \mtx file, (ii) run \fontinst, (iii) run
4278 \vptovf, (iv) run \TeX\ on some test text, and (v) print that
4279 text, trying one parameter value can take annoyingly much time.
4280 Repeating the same procedure ten times to test ten values is not
4281 something one does without being bored (unless one scripts it, of
4282 course), but it is possible to try ten parameter values in a single
4283 virtual font, and without doing very much typing.
4284
4285 Say you're not too happy with how \texttt{latin.mtx} positions the
4286 accent in the \texttt{ohungarumlaut} glyph:
4287 \begin{quote}
4288 |\setglyph{ohungarumlaut}|\\
4289 | \topaccent{o}{hungarumlaut}{500}|\\
4290 |\endsetglyph|
4291 \end{quote}
4292 The |500| is the horizontal position (in thousandths of the width of
4293 the \texttt{o}) that the centre of \texttt{hungarumlaut} in the glyph
4294 constructed will have, so that is the position parameter value that
4295 you want to change. Create an \mtx file containing the code
4296 \begin{quote}
4297 |\for(pos){250}{750}{50}|\\
4298 | \setglyph{ohungarumlaut\strint{pos}}|\\
4299 | \topaccent{o}{hungarumlaut}{\int{pos}}|\\
4300 | \endsetglyph|\\
4301 | \setleftrightkerning{ohungarumlaut\strint{pos}}|\\
4302 | {ohungarumlaut}{1000}|\\
4303 |\endfor(pos)|
4304 \end{quote}
4305 This will set eleven glyphs \texttt{ohungarumlaut250},
4306 \texttt{ohungarumlaut300}, \texttt{ohungarumlaut350}, \textellipsis\,,
4307 \texttt{ohungarumlaut750}, each being an Hungarianly umlauted `o'
4308 (i.e., an `\H{o}') but all having that umlaut in slightly different
4309 positions. In order to put them in a font, you also need to make an
4310 encoding that contains them. Therefore create an \etx file which
4311 contains the code
4312 \begin{quote}
4313 |\relax\encoding|\\
4314 |\nextslot{"C0}|\\
4315 |\for(pos){250}{750}{50}|\\
4316 | \setslot{ohungarumlaut\strint{pos}}|\\
4317 | \endsetslot|\\
4318 |\endfor(pos)|\\
4319 |\endencoding|
4320 \end{quote}
4321 The command for installing this experiment font would be something like
4322 \begin{quote}
4323 |\installfont|\marg{some name}|{|\meta{the normal list of metrics}%
4324 |,|\penalty0\meta{the new \mtx}|}|\penalty0
4325 |{ot1,|\meta{the new \etx}|}|\penalty0|{OT1}|\textellipsis
4326 \end{quote}
4327 The reason for including \texttt{ot1} in the third argument above is
4328 that you'll need letters other than `\H{o}' against which you can
4329 compare the experimental glyphs. It would not have been possible to
4330 use \texttt{t1} instead of \texttt{ot1} (even though that has more
4331 Hungarian letters) since that would set all slots in the font and
4332 leave none for these experimental \texttt{ohungarumlaut}s.
4333
4334 It is even possible to use a loop for making the test text. The
4335 \LaTeX\ macros
4336 \begin{verbatim}
4337 \newcount\slotcount
4338 \newcommand\testtext[3]{%
4339 \slotcount=#1\relax
4340 \begin{description}%
4341 \loop\item[\the\slotcount]#3%
4342 \ifnum #2>>\slotcount \advance \slotcount 1 \repeat
4343 \end{description}%
4344 }
4345 \DeclareTextCompositeCommand{\H}{OT1}{o}{\char\slotcount}
4346 \end{verbatim}
4347 will let you write
4348 \begin{quote}
4349 |\testtext|\marg{first}\marg{last}\marg{text}
4350 \end{quote}
4351 to get the text \meta{text} typeset once for each slot from
4352 \meta{first} to \meta{last} inclusive, with |\H{o}| ranging through the
4353 glyphs in this interval. Thus in this case
4354 |\testtext|\penalty\hyphenpenalty|{"C0}|\penalty\hyphenpenalty|{"CA}|%
4355 \penalty\hyphenpenalty|{Erd\H{o}s}| would be a trivial test.
4356
4357
4358 \subsection{Font installation commands}
4359 \label{Ssec:FontInstCmds}
4360
4361 The |\installfont|, |\installrawfont|, and |\installfontas| commands
4362 have the respective syntaxes
4363 \begin{isyntax}
4364 |\installfont|\marg{font-name}\marg{metrics}\marg{etx-list}\penalty0
4365 \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
4366 |\installrawfont|\marg{font-name}\marg{metrics}\marg{etx-list}%
4367 \penalty0
4368 \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
4369 |\installfontas|\marg{font-name}\penalty0\marg{encoding}%
4370 \marg{family}\marg{series}\marg{shape}\marg{size}
4371 \end{isyntax}
4372 The \meta{font-name} argument and the last five arguments are common
4373 to all these commands. The first argument is the name of a \TeX\ font
4374 to install. The last five arguments are the NFSS attributes under which
4375 that font will be declared to \LaTeX---encoding, family, series, shape,
4376 and size. It is worth observing that encoding names are usually in
4377 upper case, whereas the family, series, and shape are usually in lower
4378 case. The size argument is either a shorthand (declared using
4379 |\declaresize|) for a particular font
4380 size (or range of font sizes), or an explicit list of font sizes or
4381 ranges of sizes, which is copied directly to the font declaration.
4382 The most common case is to let the size argument be empty, as that is
4383 declared as a shorthand for ``any size''.
4384
4385 The |\installfontas| command does not itself create the font, it just
4386 makes a note that the specified font declaration should be written to
4387 the proper FD file at |\end|\-|install|\-|fonts|. The
4388 |\install|\-|font| and |\install|\-|raw|\-|font| commands do however
4389 produce the font, in the sense that they write a \vpl and \pl
4390 respectively file for the font. It depends solely on the \meta{metrics}
4391 and \meta{etx-list} arguments what this font will contain. Many
4392 features of these arguments are new with \fontinst v\,1.9;
4393 therefore the complete syntaxes are described below.
4394
4395 Both arguments are comma-separated lists of basically file names (not
4396 including an extension). The files listed in the \meta{metrics} are
4397 font metric files which together build up a \emph{glyph base}
4398 (definitions of glyphs and metrics related to one or several glyphs),
4399 whereas the files listed in the \meta{etx-list} are encoding definition
4400 files that select a subset of the glyph base for turning into a
4401 \TeX\ font. The font metrics can be in either of the four formats
4402 \mtx, \pl, \afm, and \vpl, which are considered in that order. If the
4403 metrics are not originally in \mtx format then they will be converted
4404 to this format (a new file will be created) before they are used.
4405 The encoding definitions must be in \etx format. The files actually
4406 read will have a suffix \texttt{.mtx}, \texttt{.pl}, \texttt{.afm},
4407 \texttt{.vpl}, or \texttt{.etx} appended to the name given, depending
4408 on which format is expected.
4409
4410 Within each element of the comma-separated list, the actual file name
4411 is followed by zero or more \emph{modifier clause}s. A \meta{modifier
4412 clause} consists of a \emph{keyword} followed by some number (usually
4413 one) of \emph{arguments}, separated by spaces. The whole thing looks
4414 a lot like the \meta{rule specifications} of e.g.\ the |\vrule|
4415 command, but here the spaces are mandatory. The currently defined
4416 \meta{modifier clause}s are
4417 \begin{description}
4418 \item[\mdseries\textvisiblespace\texttt{option}\textvisiblespace
4419 \meta{string}]
4420 Available for metric and encoding files. This adds \meta{string}
4421 to the list of options for this file, which may affect what code
4422 the file executes. The file can then test, using the |\ifoption|
4423 command, whether a specific string is one of the options it was
4424 given.
4425 \item[\mdseries\textvisiblespace\texttt{scaled}\textvisiblespace
4426 \meta{factor}]
4427 Available for metric files. Causes the \texttt{rawscale} integer
4428 variable to be set to the \meta{factor} (an integer expression)
4429 while the file is being read. This scales glyphs and kerns that
4430 are added to the glyph base by the \meta{factor}.
4431 \item[\mdseries\textvisiblespace\texttt{suffix}\textvisiblespace
4432 \meta{suffix}]
4433 Available for metric files. Causes \meta{suffix} to be appended
4434 to every glyph name appearing in a glyph or kern that file adds
4435 to the glyph base. Thus ``\texttt{suffix /2}'' effectively
4436 changes a
4437 \begin{quote}
4438 |\setrawglyph{a}|\dots
4439 \end{quote}
4440 to a
4441 \begin{quote}
4442 |\setrawglyph{a/2}|\dots
4443 \end{quote}
4444 \item[\mdseries\textvisiblespace\texttt{encoding}\textvisiblespace
4445 \meta{etx-name}]
4446 Available for metric files, and forces \fontinst to
4447 only consider the \pl and \vpl formats for this font.
4448 As these file formats do not contain glyph names, an \etx file
4449 is used to assign glyph names to the slots in the font.
4450 This \etx file is usually selected according to the
4451 \texttt{CODINGSCHEME} property of the \pl or \vpl (using the
4452 correspondences set up via the |\declare|\-|encoding| command),
4453 but that information is not always as one would want it (there
4454 are even fonts for which it is quite wrong). An \texttt{encoding}
4455 clause bypasses this automatic mechanism, so that the file
4456 \meta{etx-name}\texttt{.etx} is used instead.
4457
4458 % % The following is no longer true as of v1.926:
4459 % \textbf{Note:} The first time that a file in PL or VPL format is
4460 % used in a \meta{metrics} argument, a corresponding \mtx file is
4461 % generated. This means that if the same file reference is used
4462 % another time then the reference will be to the \mtx file, not to
4463 % the original PL or VPL, and thus \texttt{encoding} clauses on
4464 % subsequent uses will have no effect. Each font only has one
4465 % encoding, so it usually makes no sense to switch the \etx file
4466 % used to interpret a font, but since \mtx files are not
4467 % automatically deleted between runs there is a risk that this
4468 % takes away the intended effect of an \texttt{encoding} clause.
4469
4470 \item[\mdseries\textvisiblespace\texttt{mtxasetx}]
4471 This is available for files in the \meta{etx-list}. The actual
4472 function of a
4473 \begin{quote}
4474 \meta{file-name} \texttt{mtxasetx}
4475 \end{quote}
4476 item in the \meta{etx-list} is that the file
4477 \meta{file-name}\texttt{.mtx} is inputted (\emph{not}
4478 \meta{file-name}\texttt{.etx}) and that the correspondence
4479 between glyph names and slot numbers set up in
4480 |\set|\-|raw|\-|glyph| or |\set|\-|scaled|\-|raw|\-|glyph|
4481 commands in this file is treated as if it had been set up by
4482 |\setslot| commands in an \etx file. Provided the \mtx file is
4483 transformable, the glyph base will be unaffected.
4484
4485 The purpose of this feature is to simplify quick and dirty
4486 installations of odd fonts for which no suitable \etx file is
4487 available. This can be useful in early stages of the design of
4488 a new font, but is inferior to installation using proper \etx
4489 files since one for example cannot specify any ligatures in
4490 \mtx files.
4491 \end{description}
4492 Furthermore there is a special exception for the \meta{metrics}: if
4493 the first token in one of the list items is the control sequence
4494 |\metrics|, then the rest of that item is interpreted as explicit
4495 metric commands to execute.
4496
4497 If the \meta{metrics} of two subsequent |\install|\-|font|
4498 or |\install|\-|raw|\-|font| commands are identical then the glyph
4499 bases will be identical as well. This creates an opportunity for
4500 optimization, which \fontinst makes use of by caching glyph
4501 bases from one installation command to the next so that the glyph
4502 base does not have to be rebuilt in these cases. A side-effect of
4503 this caching is that local assignments made between two font
4504 installation commands are cleared out with the glyph base, but
4505 |\setint| and similar \fontinst commands make global
4506 assignments when used in such positions.
4507
4508 Some examples might be in order. The first is an adaptation of an
4509 installation command from \texttt{mfnt-0.59} %~\cite{mfnt}
4510 by Matthias Clasen and Ulrik Vieth: the installation command for the
4511 8-bit math font \texttt{xma1000} (which can be thought of as being
4512 to \texttt{cmmi10} sort of as \texttt{ecrm1000} is to \texttt{cmr10}).
4513 The first three \texttt{encoding} clauses are more fine-tuning---without
4514 them, a few glyphs would get incorrect names---but the last two are
4515 quite essential, as the \texttt{msam10} and \texttt{msbm10} fonts
4516 incorrectly claim to have the coding scheme \texttt{TEX MATH
4517 SYMBOLS}.
4518 \begin{verbatim}
4519 \installfont{xma1000}{%
4520 yma1000 encoding mcin,%
4521 cmr10 encoding ot1upright,%
4522 cmmi10,%
4523 cmsy10 encoding omscal,%
4524 msam10 encoding msam,%
4525 msbm10 encoding msbm,%
4526 mccmhax,mccmkern,mcmissing,%
4527 cmsy10-base,cmsy10-extra%
4528 }{mc}{MC}{cm}{m}{n}{<<10->>}
4529 \end{verbatim}
4530 Also note the explicit \LaTeX\ size specification for the range
4531 ``10\,pt and up''.
4532
4533 The second example makes use of a \texttt{suffix} clause to combine
4534 the letters from one font with the digits from another.
4535 \begin{verbatim}
4536 \installfont{msbrj8t}{msbr8r,msbrc8r suffix /2,latin}{digit2,t1}
4537 {T1}{msbj}{m}{n}{}
4538 \end{verbatim}
4539 In this case, the glyph base contains the glyphs of Monotype Sabon
4540 (SabonMT)---under names such as \texttt{A} for `A', \texttt{a} for
4541 `a', and \texttt{one} for a lining digit one---as well as the
4542 glyphs of Monotype Sabon Small Caps and Oldstyle Figures
4543 (SabonMT-SCOSF)---under names such as \texttt{A/2} for `A',
4544 \texttt{a/2} for `\textsc{a}', and \texttt{one/2} for a hanging
4545 digit one. The \texttt{digit2.etx} file simply makes the definition
4546 \begin{verbatim}
4547 \setcommand\digit#1{#1/2}
4548 \end{verbatim}
4549 which causes \texttt{t1.etx} to put \texttt{zero/2} in slot 48 (digit
4550 zero), \texttt{one/2} in slot 49 etc., instead of as it normally
4551 would \texttt{zero} in slot 48, \texttt{one} in slot 49 and so on.
4552 The net effect is that the digits in the generated \texttt{msbrj8t}
4553 is from \texttt{msbrc8r} (SabonMT-SCOSF) but everything else is from
4554 \texttt{msbr8r} (SabonMT).
4555
4556 The third example makes use of an \texttt{mtxasetx} clause to install
4557 (with its default encoding) a font for which creating an appropriate
4558 \etx file seems not worth the trouble.
4559 \begin{verbatim}
4560 \installrawfont{psyr}{psyr,\metrics
4561 \setint{xheight}{\height{alpha}}
4562 }{txtfdmns,psyr mtxasetx}{U}{psy}{m}{n}{}
4563 \end{verbatim}
4564 The effect of the second \texttt{psyr} is that \texttt{psyr.mtx} is
4565 read (in case there was no \texttt{psyr.mtx} then it is created from
4566 (hopefully) \texttt{psyr.afm}) and the information in it will form
4567 the glyph base. Because of the |\metrics| control sequence, the rest
4568 of that item will be interpreted as explicit metric commands
4569 modifying the glyph base, and thus the |\setint| command can provide
4570 a value for the \texttt{xheight} variable (there doesn't seem to be
4571 such a value in the \afm). Once the glyph base is completed, the
4572 |\install|\-|raw|\-|font| starts writing the file \texttt{psyr.pl}
4573 (that's for the first \texttt{psyr}). The encoding of that font will,
4574 because of the \texttt{psyr mtxasetx}, be the same as that used in
4575 \texttt{psyr.mtx}. Finally, the \texttt{txtfdmns} is for
4576 \texttt{txtfdmns.etx}, an \etx file which sets fontdimens 1--16 as for
4577 a \texttt{T1} encoded font but does not set any slots. Since
4578 \texttt{psyr.mtx} reinterpreted as an \etx file sets slots but no
4579 fontdimens, these complement each other nicely.
4580
4581
4582
4583 \subsection{Bounding boxes}
4584
4585 Han The Thanh has created an implementation of bounding box support
4586 for \fontinst, and it is a modified form of that support
4587 is distributed with \fontinst as the file \texttt{bbox.sty}. To load
4588 this, begin your command file with
4589 \begin{verbatim}
4590 \input fontinst.sty
4591 \input bbox.sty
4592 \end{verbatim}
4593 The reason for not making it default is that keeping track of bounding
4594 boxes increases some of \fontinst's memory requirements quite a lot.
4595
4596 One important
4597 characteristic of this implementation is that the dimensions of the
4598 bounding box are not bundled into the same data structure (the
4599 |\g-|\meta{glyph} macros) as the glyph's width, height, depth, and
4600 italic correction are, but stored in a separate data structure (the
4601 |\gb-|\meta{glyph} macros). A glyph doesn't need to have its bounding
4602 box set, it is simply a piece of information that \fontinst
4603 will store if you tell it to and which you can later retrieve.
4604
4605 The bounding box will be stored as coordinates of the sides in the
4606 normal AFM coordinate system. The commands for retrieving these
4607 coordinates are
4608 \begin{center}
4609 \begin{tabular}{ll}
4610 \textbf{Command}& \textbf{Side}\\
4611 |\bbtop|\marg{glyph}& top ($y$-coordinate)\\
4612 |\bbbottom|\marg{glyph}& bottom ($y$-coordinate)\\
4613 |\bbleft|\marg{glyph}& left ($x$-coordinate)\\
4614 |\bbright|\marg{glyph}& right ($x$-coordinate)
4615 \end{tabular}
4616 \end{center}
4617 In Thanh's implementation the command names were |\ury|, |\lly|,
4618 |\llx|, and |\urx| respectively instead, but I think the former are
4619 easier to remember. If no bounding box has been set for a glyph then
4620 the above commands will instead report the corresponding coordinate of
4621 the glyph's \TeX\ box (i.e.\ |\height|\marg{glyph},
4622 |\neg{\depth|\marg{glyph}|}|, |0|, and |\width|\marg{glyph}
4623 respectively).
4624
4625 The command for setting the bounding box of a glyph is
4626 \begin{quote}
4627 |\setglyphbb|\marg{glyph}\marg{left}\marg{bottom}\marg{right}%
4628 \marg{top}
4629 \end{quote}
4630
4631
4632
4633
4634
4635 \section*{Acknowledgements}
4636
4637 We'd like to thank all of the \fontinst $\alpha$-testers, especially
4638 Karl Berry, Damian Cugley, Steve Grahthwohl, Yannis Haralambous, Alan
4639 Hoenig, Rob Hutchings, Constantin Kahn, Peter Busk Laursen, Ciar{\'a}n {\'O}
4640 Duibh{\'\i}n, Hilmar Schlegel, Paul Thompson, Norman Walsh and John Wells,
4641 who made excellent bug-catchers!
4642
4643 Thanks to Barry Smith, Frank Mittelbach, and especially Sebastian
4644 Rahtz for many useful email discussions on how virtual fonts should
4645 interact with \LaTeXe.
4646
4647 Thanks to Karl Berry and Damain Cugley for detailed comments on this
4648 documentation.
4649
4650 Thanks to David Carlisle for the use of his \texttt{trig} macros for
4651 calculating trigonometry.
4652
4653
4654 % \section*{Warranty and distribution}
4655 %
4656 % There is no warranty for the \fontinst package, to the extent
4657 % permitted by applicable law. Except when otherwise stated in writing,
4658 % the author provides the program `as is' without warranty of any kind,
4659 % either expressed or implied, including, but not limited to, the
4660 % implied warranties of merchantability and fitness for a particular
4661 % purpose. The entire risk as to the quality and performance of the
4662 % program is with you. Should the package prove defective, you assume
4663 % the cost of all necessary servicing, repair or correction.
4664 %
4665 % In no event unless required by applicable law or agreed to in writing
4666 % will the author be liable to you for damages, including any general,
4667 % special, incidental or consequential damages arising out of the use or
4668 % inability to use the program (including but not limited to loss of
4669 % data or data being rendered inaccurate or losses sustained by you or
4670 % third parties or a failure of the program to operate with any other
4671 % programs), even if such holder or other party has been advised of the
4672 % possibility of such damages.
4673 %
4674 % Redistribution of unchanged files is allowed provided that all files
4675 % listed in the \texttt{MANIFEST} file are distributed.
4676 %
4677 % If you receive only some of these files from someone, or if you
4678 % receieve altered files, then complain!
4679
4680 \end{document}