Debian Codegraph @

texmf-dist/source/fontinst/base/fimain.dtx

raw
1 % \CheckSum{4056}
2 % \iffalse meta-comment
3 %
4 % Copyright 1993, 1994, 1995, 1996 Alan Jeffrey,
5 % hacked and maintained 1997, 1998 Sebastian Rahtz,
6 % copyright 1998, 1999, 2000 the fontinst maintenance team and any
7 % individual authors listed elsewhere in this file. All rights reserved.
8 %
9 % This file is part of the fontinst system version 1.9.
10 % -----------------------------------------------------
11 %
12 % It may be distributed under the terms of the LaTeX Project Public
13 % License, as described in lppl.txt in the base LaTeX distribution.
14 % Either version 1.1 or, at your option, any later version.
15 %
16 %%% From file: fimain.dtx
17 %
18 %<*driver>
19 \documentclass{ltxdoc}
20 \usepackage{fisource}
21 \title{The \package{fontinst} utility}
22 \author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om}
23 \begin{document}
24 \maketitle
25 \tableofcontents
26 \DocInput{fimain.dtx}
27 \end{document}
28 %</driver>
29 % \fi
30 %
31 % \StopEventually{}
32 %
33 %
34 % \section{Encoding files}
35 %
36 % \changes{1.911}{1999/11/21}{Definitions of encoding file commands
37 % added to \protect\protect\protect\Module{misc}. (LH)}
38 %
39 % \DescribeMacro{\inputetx}
40 % The macro
41 % \begin{quote}
42 % |\inputetx|\marg{filename}
43 % \end{quote}
44 % inputs \meta{filename}|.etx|, ignoring anything between |\relax|
45 % and |\encoding|, and anything after |\endencoding|.
46 %
47 % The file name is transformed to lowercase before opening.
48 %
49 % \begin{macro}{\inputetx}
50 % \begin{macro}{\encoding}
51 % \changes{1.900}{1999/02/07}
52 % {Changed group in fontdoc to \cs{begingroup} type. (LH)}
53 % \usechange{raggedright}
54 % \begin{macro}{\endencoding}
55 % \changes{1.900}{1999/02/07}{Made it outer. (LH)}
56 % \usechange{raggedright}
57 % \begin{macrocode}
58 %<*pkg|misc>
59 \def\inputetx#1{
60 \edef\lowercase_file{\lowercase{
61 \edef\noexpand\lowercase_file{#1}}}
62 \lowercase_file
63 \slot_number=0
64 \def\relax{\let\relax=\x_relax\iffalse}
65 \let\encoding=\fi
66 \primitiveinput \lowercase_file.etx\x_relax
67 \let\relax=\x_relax
68 }
69 \let\encoding=\relax
70 \outer\def\endencoding{\endinput}
71 %</pkg|misc>
72 % \end{macrocode}
73 %
74 % Things are a bit more complicated in \package{fontdoc}, since the
75 % |\relax| \textellipsis\ |\encoding| \textellipsis\ |\endencoding|
76 % markup must be able to work in two different ways. In the main file
77 % only |\encoding| actually does anything---it sets |\slot@number| to
78 % zero. In a file that is being |\inputetx|ed, they must work as with
79 % \package{fontinst}: Everything between |\relax| and |\encoding|,
80 % and everything after |\endencoding| must be ignored.
81 % \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27}
82 % {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)}
83 % \multchanges{\cs{encoding}\cs{endencoding}}{1.918}{2001/06/19}
84 % {Added \cs{par} and \cs{addvspace} to \package{fontdoc}
85 % definitions. (LH)}
86 % \multchanges{\cs{endencoding}}{1.919}{2001/09/01}
87 % {Added setting of \cs{parindent} to 1\,em to \package{fontdoc}
88 % definition. (LH)}
89 % \begin{macrocode}
90 %<*doc>
91 \def\inputetx#1{%
92 \begingroup
93 \edef\lowercase@file{\lowercase{%
94 \edef\noexpand\lowercase@file{#1}%
95 }}%
96 \lowercase@file
97 \global\slot@number=0%
98 \FD@slot@known@true
99 \IfFileExists{\[email protected]}{%
100 \FD@relax@encoding@tricks
101 \@@input \@filef@und
102 \let\relax=\x@relax
103 }{%
104 \PackageError{fontdoc}{File #1.etx not found}%
105 {\@eha\MessageBreak You can \protect\inputetx\space
106 some other file now, if you want.}%
107 }
108 \endgroup
109 }
110 % \end{macrocode}
111 % \begin{macro}{\FD@relax@encoding@tricks}
112 % There is a problem with |\if| \dots\ |\fi| nesting in the
113 % redefinition of |\relax| and |\encoding|, which interacts badly
114 % with |\IfFileExists|. To work around that, these redefinitions
115 % are hidden in the |\FD@relax@encoding@tricks| macro.
116 % \changes{1.928}{2004/11/24}{Macro added, to fix bug reported by
117 % Peter Dyballa. (LH)}
118 % \begin{macrocode}
119 \def\FD@relax@encoding@tricks{%
120 \def\relax{\let\relax=\x@relax\iffalse}%
121 \let\encoding=\fi
122 \outer\x@cs\def{endencoding}{\endinput}%
123 }
124 % \end{macrocode}
125 % \end{macro}
126 % \begin{macrocode}
127 \def\encoding{%
128 \par
129 \ifFD@spec@ \addvspace{\bigskipamount}\fi
130 \begin{flushleft}
131 \global\slot@number=\z@
132 }
133 \outer\def\endencoding{%
134 \end{flushleft}
135 \ifFD@spec@ \addvspace{\bigskipamount}\fi
136 }
137 %</doc>
138 % \end{macrocode}
139 % \end{macro} \end{macro} \end{macro}
140 %
141 %
142 % \begin{macro}{\setslot}
143 % \changes{1.917}{2001/03/23}{Made slots referencable using
144 % \cs{label}. (LH)}
145 % \begin{macro}{\endsetslot}
146 % \begin{macro}{\slot_name}
147 % |\setslot|\marg{name} \meta{slot commands} |\endsetslot|
148 %
149 % In \package{fontinst}, this sets |\slot_name| to \meta{name} and
150 % calls |\do_slot| at the beginning of the slot and it calls
151 % |\end_do_slot| and increments |\slot_number| by one at the end.
152 % By default, |\do_slot| and |\end_do_slot| do nothing, but this is
153 % over-ridden later.
154 %
155 % \begin{macrocode}
156 %<*pkg|misc>
157 \def\setslot#1{\edef\slot_name{#1}\do_slot}
158 \def\endsetslot{\end_do_slot\advance\slot_number by 1\x_relax}
159 %</pkg|misc>
160 % \end{macrocode}
161 % \end{macro}
162 %
163 % \begin{macro}{\slot@name}
164 % \changes{1.917}{2001/03/23}{Now storing the printable form of the
165 % name, rather than the raw code. (LH)}
166 % In \package{fontdoc}, the same code converts \meta{name} to a
167 % printable string and stores the result in |\slot@name|, prints an
168 % |\Aheading| heading for the slot which show the name and number
169 % of the slot, and prints the current automatic slot comment (if
170 % one has been set) at the beginning of the slot. At the end of
171 % the slot, it simply increments |\slot@number| by one.
172 %
173 % \begin{macrocode}
174 %<*doc>
175 \newcommand\setslot[1]{%
176 \protected@edef\slot@name{%
177 \noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}%
178 }%
179 \slot@name
180 \FD@tight@true
181 \Aheading{Slot
182 \ifFD@slot@known@
183 \the\slot@number\space
184 \else
185 \(\FD@slot@expression + \the\slot@number\)
186 \fi
187 `\FD@typeset@string{\slot@name}'%
188 }%
189 \protected@edef\@currentlabel{%
190 \ifFD@slot@known@
191 \the\slot@number
192 \else
193 \protect\(%
194 \FD@slot@expression+\the\slot@number
195 \protect\)%
196 \fi
197 \space(\protect\FD@typeset@string{\slot@name})%
198 }%
199 \ifFD@slot@known@ \ifslot@comment@ \comment{\slot@comment}\fi\fi
200 }
201 \def\endsetslot{%
202 \global\advance \slot@number \@ne
203 \FD@tight@false
204 }
205 %</doc>
206 % \end{macrocode}
207 % \end{macro}\end{macro}\end{macro}
208 %
209 % \begin{macro}{\do_slot}
210 % \begin{macro}{\end_do_slot}
211 % \begin{macrocode}
212 %<*pkg|misc>
213 \let\do_slot\empty_command
214 \let\end_do_slot\empty_command
215 % \end{macrocode}
216 % \end{macro} \end{macro}
217 % \multchanges{\cs{do_new_slot}}{1.910}{1999/11/01}{Macro removed. (LH)}
218 %
219 % \begin{macro}{\nextslot}
220 % \begin{macro}{\skipslots}
221 % \begin{macro}{\slot_number}
222 % \begin{macro}{\slot@number}
223 % \begin{switch}{FD@slot@known@}
224 % \begin{macro}{\FD@slot@expression}
225 % |\nextslot|\marg{integer expression}\\
226 % |\skipslots|\marg{integer expression}
227 %
228 % In \package{fontinst}, |\nextslot| sets the |\slot_number| and
229 % |\skipslots| addvances the |\slot_number|.
230 %
231 % \begin{macrocode}
232 \newcount\slot_number
233 \def\nextslot#1{\eval_expr_to\slot_number{#1}}
234 \def\skipslots#1{\eval_expr{#1} \advance\slot_number by \result}
235 %</pkg|misc>
236 % \end{macrocode}
237 %
238 % The commands do the same in \package{fontdoc} as in
239 % \package{fontinst}, although they do it to |\slot@number| instead of
240 % |\slot_number|.
241 %
242 % \begin{macrocode}
243 %<*doc>
244 \newcount\slot@number
245 \def\FD@slot@known@true{\global\let\ifFD@slot@known@\iftrue}
246 \def\FD@slot@known@false{\global\let\ifFD@slot@known@\iffalse}
247 \FD@slot@known@true
248 \newcommand\nextslot[1]{%
249 \FD@evaluate@true
250 \FD@eval@expr{#1}%
251 \ifFD@evaluate@
252 \global\slot@number=\FD@result
253 \FD@slot@known@true
254 \else
255 \global\let\FD@slot@expression=\FD@expression
256 \global\slot@number=\z@
257 \FD@slot@known@false
258 \fi
259 }
260 \newcommand\skipslots[1]{%
261 \FD@evaluate@true
262 \FD@eval@expr{#1}%
263 \ifFD@evaluate@
264 \global\advance \slot@number \FD@result
265 \else
266 \ifFD@slot@known@
267 \global\let\FD@slot@expression=\FD@expression
268 \else
269 \protected@xdef\FD@slot@expression{%
270 \FD@slot@expression+\FD@expression
271 }%
272 \fi
273 \FD@slot@known@false
274 \fi
275 }
276 %</doc>
277 % \end{macrocode}
278 %
279 % There has been some ambiguity concerning what is allowed as
280 % arguments of \cs{nextslot} and \cs{skipslots}. At least since
281 % v\,1.335 the comments in the source has said it was an integer
282 % expression, but the implementation was for a \TeX\ number.
283 % Alan's v\,1.5 manual and Rowland's v\,1.8 manual both say the
284 % arguments must be numbers. Allowing arbitrary integer
285 % expressions with \package{fontinst} is trivial, the above
286 % implementation copes with that, but \package{fontdoc} gets in
287 % trouble, so what should we do about it? /LH
288 %
289 % AFAIK, all instances of |\nextslot| or |\skipslots| appearing in
290 % present |*.etx| files are explicit numbers, no fancy constructs. /UV
291 %
292 % No, but if a |\setslot| command appears in a |\for| loop then the
293 % slot number in that command will depend on the values of various
294 % integer expressions anyway, so we might as well deal with it. /LH
295 %
296 % The matter was finally resolved when \package{fontdoc} was
297 % augmented to handle (and typeset) arbtrary integer expressions.
298 %
299 % \multchanges{\cs{nextslot}\cs{skipslots}}{1.900}{1999/02/07}^^A
300 % {Made changes of \cs{slot@number} global. (LH)}
301 % \end{macro}\end{switch}\end{macro}\end{macro}\end{macro}\end{macro}
302 %
303 % \begin{macro}{\setleftboundary}
304 % \multchanges{\cs{setleftboundary}\cs{endsetleftboundary}}^^A
305 % {1.909}{1999/10/19}{\package{fontdoc} definition added. (LH)}
306 % \changes{1.917}{2001/03/23}{Made the left boundary referencable
307 % using \cs{label}. (LH)}
308 % \begin{macro}{\endsetleftboundary}
309 % \begin{macro}{\do_boundary}
310 % |\setleftboundary|\marg{glyph} \meta{slot commands}
311 % |\endsetleftboundary|
312 %
313 % These macros are like |\setslot| and |\endsetslot|, but they merely
314 % set the left boundary ligkern program, they do not cause any
315 % |CHARACTER| property list to be written. Thus the only metric
316 % information connected to the \meta{glyph} argument that is ever used
317 % is the kerns with this glyph on the left.
318 %
319 % |\do_boundary| and |\endsetleftboundary| are initally |\relax|, but
320 % are later redefined.
321 %
322 % \begin{macrocode}
323 %<*pkg>
324 \def\setleftboundary#1{\edef\slot_name{#1}\do_boundary}
325 \let\endsetleftboundary\x_relax
326 \let\do_boundary\x_relax
327 %</pkg>
328 %<*doc>
329 \newcommand\setleftboundary[1]{%
330 \protected@edef\slot@name{%
331 \noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}%
332 }%
333 \slot@name
334 \FD@tight@true
335 \Aheading{Left boundary `\FD@typeset@string{\slot@name}'}%
336 \protected@edef\@currentlabel{%
337 left boundary (\protect\FD@typeset@string{\slot@name})%
338 }%
339 }
340 \let\endsetleftboundary=\FD@tight@false
341 %</doc>
342 %<*misc>
343 \let\setleftboundary=\gobble_one
344 \let\endsetleftboundary=\x_relax
345 %</misc>
346 % \end{macrocode}
347 % \end{macro}\end{macro}\end{macro}
348 %
349 %
350 % \begin{macro}{\setrightboundary}
351 % |\setrightboundary|\marg{glyph}
352 %
353 % The |\setrightboundary| macro should be used to set which slot in
354 % the font is used as right boundary marker if that slot is empty. It
355 % advances |\slot_number| just like a |\setslot| \textellipsis\
356 % |\endsetslot| pair, but since the slot will be left empty, there is
357 % no need for any \meta{slot commands}, and hence there is no need for
358 % a closing |\endset|\textellipsis\ command either.
359 %
360 % If the right boundary marker slot is not to be left empty (often
361 % unavoidable), then one should use the slot command
362 % |\makerightboundary| instead.
363 %
364 % \changes{1.909}{1999/10/19}{doc definition added. (LH)}
365 % \begin{macrocode}
366 %<*pkg|misc>
367 \def\setrightboundary#1{
368 \makerightboundary{#1}
369 \advance \slot_number 1\x_relax
370 }
371 %</pkg|misc>
372 %<*doc>
373 \newcommand\setrightboundary[1]{%
374 \Aheading{Right boundary slot
375 \ifFD@slot@known@
376 \the\slot@number\space
377 \else
378 \(\FD@slot@expression + \the\slot@number\)
379 \fi
380 `\TypesetStringExpression{#1}'%
381 }%
382 \global\advance \slot@number \@ne
383 }
384 %</doc>
385 % \end{macrocode}
386 % \end{macro}
387 %
388 %
389 % \DescribeMacro{\ligature}
390 % \DescribeMacro{\Ligature}
391 % \DescribeMacro{\oddligature}
392 % \DescribeMacro{\nextlarger}
393 % \DescribeMacro{\varchar}
394 % \DescribeMacro{\endvarchar}
395 % \DescribeMacro{\usedas}
396 % \DescribeMacro{\makerightboundary}
397 % \DescribeMacro{\Unicode}
398 % The \meta{slot commands} are:
399 % \begin{quote}
400 % |\ligature|\marg{lig}\marg{glyph}\marg{glyph}\\
401 % |\Ligature|\marg{lig}\marg{glyph}\marg{glyph}\\
402 % |\oddligature|\marg{note}\marg{lig}\marg{glyph}\marg{glyph}\\
403 % |\nextlarger|\marg{glyph}\\
404 % |\varchar| \meta{varchar commands} |\endvarchar|\\
405 % |\usedas|\marg{command}\marg{type}\\
406 % |\makerightboundary|\marg{glyph}\\
407 % |\Unicode|\marg{code point}\marg{name}
408 % \end{quote}
409 % By default, these do nothing in \package{fontinst}, but most of
410 % those defaults are overridden locally in those situations where one
411 % wants them to do something. Exceptions are \cs{usedas},
412 % which is never used at all AFAIK,\footnote{It was intended to be
413 % used for math font encodings, but that never got off the
414 % \texttt{TODO} list. /LH} and |\oddligature| and |\Unicode|,
415 % which are purely documentation commands. In \package{fontdoc},
416 % they generate descriptive headings.
417 %
418 % \begin{macro}{\ligature}
419 % \begin{macro}{\Ligature}
420 % \changes{1.917}{2001/03/31}{Command added. (LH)}
421 % \begin{macro}{\oddligature}
422 % \changes{1.918}{2001/05/31}{Command added. (LH)}
423 % The |\ligature| and |\Ligature| commands have the same syntax and
424 % meaning to \package{fontinst}, but \package{fontdoc} can give them
425 % slightly different treatment. In a specification ETX file, the
426 % |\Ligature| command gets the heading ``Mandatory ligature'', whereas
427 % the |\ligature| command gets the heading ``Ordinary ligature''.
428 %
429 % The |\oddligature| command takes a fourth argument which contains a
430 % short note on when the ligature might be appropriate. The entire
431 % command is always ignored by \package{fontinst}.
432 % \begin{macrocode}
433 %<pkg|misc>\let\ligature=\gobble_three
434 %<pkg|misc>\def\Ligature{\ligature}
435 %<pkg|misc>\def\oddligature#1#2#3#4{}
436 %<*doc>
437 \newcommand\ligature[3]{%
438 \Bheading{\ifFD@spec@ Ordinary ligature\else Ligature\fi}
439 \@nameuse{FD@lig-#1}{#2}{#3}%
440 }
441 \newcommand\Ligature[3]{%
442 \Bheading{\ifFD@spec@ Mandatory ligature\else Ligature\fi}
443 \@nameuse{FD@lig-#1}{#2}{#3}%
444 }
445 \newcommand\oddligature[4]{%
446 \Bheading{Odd\footnote{#1} ligature}
447 \@nameuse{FD@lig-#2}{#3}{#4}%
448 }
449 % \end{macrocode}
450 %
451 % Symbolic typesetting of |\ligature| programs requires
452 % special processing.\describecsfamily{FD@lig-\meta{lig}}
453 % \multchanges{\cs{FD@lig-/LIG\PrintChar{`>}}\cs
454 % {FD@lig-LIG/\PrintChar{`>}}\cs{FD@lig-/LIG/\PrintChar{`>}}\cs
455 % {FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.917}
456 % {2001/03/31}{Changed how \package{fontdoc} marks the current
457 % position after a ligature instruction, from $+$ to
458 % $*\lfloor$. (LH)}
459 % \multchanges{\cs{FD@lig-/LIG}}{1.927}
460 % {2004/06/21}{Fixed a typo. (LH) Reported by Werner Lemberg.}
461 % \multchanges{\cs{FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.927}
462 % {2004/06/24}{Fixed a typo. (LH) Reported by Werner Lemberg.}
463 %
464 % \begin{macrocode}
465 \x@cs\def{FD@lig-LIG}#1#2{%
466 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
467 ${}\rightarrow{}$\typeset@glyph{#2}%
468 }
469 \x@cs\def{FD@lig-/LIG}#1#2{%
470 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
471 ${}\rightarrow{}$%
472 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#2}%
473 }
474 \x@cs\def{FD@lig-LIG/}#1#2{%
475 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
476 ${}\rightarrow{}$%
477 \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
478 }
479 \x@cs\def{FD@lig-/LIG/}#1#2{%
480 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
481 ${}\rightarrow{}$%
482 \FD@typeset@string{\slot@name}${}*{}$%
483 \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
484 }
485 \x@cs\def{FD@lig-/LIG>}#1#2{%
486 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
487 ${}\rightarrow{}$%
488 \FD@typeset@string{\slot@name}${}*\lfloor$\typeset@glyph{#2}%
489 }
490 \x@cs\def{FD@lig-LIG/>}#1#2{%
491 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
492 ${}\rightarrow{}$%
493 \typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}%
494 }
495 \x@cs\def{FD@lig-/LIG/>}#1#2{%
496 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
497 ${}\rightarrow{}$%
498 \FD@typeset@string{\slot@name}${}*\lfloor$%
499 \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}%
500 }
501 \x@cs\def{FD@lig-/LIG/>>}#1#2{%
502 \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}%
503 ${}\rightarrow{}$%
504 \FD@typeset@string{\slot@name}${}*{}$%
505 \typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}%
506 }
507 %</doc>
508 % \end{macrocode}
509 % \end{macro}\end{macro}\end{macro}
510 %
511 %
512 % \begin{macro}{\nextlarger}
513 % \begin{macro}{\usedas}
514 % \begin{macro}{\makerightboundary}
515 % \begin{macrocode}
516 %<*pkg|misc>
517 \let\nextlarger=\gobble_one
518 \let\usedas=\gobble_two
519 \let\makerightboundary=\gobble_one
520 %</pkg|misc>
521 % \end{macrocode}
522 % \begin{macrocode}
523 %<*doc>
524 \def\nextlarger#1{\Bheading{Next larger} \typeset@glyph{#1}}
525 \def\makerightboundary#1{%
526 \Bheading{Right boundary marker slot} designation \typeset@glyph{#1}%
527 }
528 %</doc>
529 % \end{macrocode}
530 % \missing{doc}{\usedas}
531 % \end{macro} \end{macro} \end{macro}
532 %
533 %
534 % \begin{macro}{\Unicode}
535 % \changes{1.917}{2001/03/13}{Command added. (LH)}
536 % \changes{1.917}{2001/03/31}{Added setting of \cs{linepenalty} and
537 % \cs{spaceskip}. (LH)}
538 % \begin{macro}{\textunicode}
539 % \changes{1.918}{2001/06/17}{Command added. (LH)}
540 % \begin{macro}{\FD@codepoint}
541 % \changes{1.918}{2001/06/17}{Macro added. (LH)}
542 % \begin{macro}{\FD@charname}
543 % \changes{1.918}{2001/06/17}{Macro added. (LH)}
544 % Since ISO\,10646\slash Unicode has become the primary reference for
545 % identifying characters, we provide a special comment command for
546 % specifying which Unicode character corresponds to a particular slot
547 % in an encoding. \label{Unicode} The syntax is
548 % \begin{quote}
549 % |\Unicode|\marg{code point}\marg{name}
550 % \end{quote}
551 % where the \meta{code point} is the four hexadecimal digits that
552 % identify the code point of the character and \meta{name} is the
553 % name of the character. An example is
554 % \begin{quote}
555 % |\Unicode{0041}{LATIN CAPITAL LETTER A}|
556 % \end{quote}
557 % which is typeset as
558 % \begin{quote}
559 % Unicode character \texttt{U+0041}, \textsc{latin capital letter a}.
560 % \end{quote}
561 % The \meta{name} field may be left empty.
562 %
563 % The |\Unicode| command makes a whole |\comment|, but it is also
564 % useful to have a similar command for writing such data as part of a
565 % longer paragraph. The |\textunicode| command, which has the same
566 % argument structure as |\Unicode|, is provided for this. If you write
567 % \begin{quote}
568 % |see also \textunicode{0041}{LATIN CAPITAL LETTER A} for|
569 % \end{quote}
570 % then this is typeset as
571 % \begin{quote}
572 % see also \texttt{U+0041} (\textsc{latin capital letter a}) for
573 % \end{quote}
574 %
575 % As case is not significant in the character names and they
576 % furthermore usually seem to be written in capitals, I have chosen
577 % to typeset them using small capitals only. This is done by
578 % |\FD@charname|. The |\FD@codepoint| macro similarly handles
579 % typesetting of code points. See also the \texttt{hypertex} option
580 % to the \package{fontdoc} package.
581 %
582 % The \package{fontinst} and \package{finstmsc} definitions of
583 % |\Unicode| are to gobble the arguments.
584 % \begin{macrocode}
585 %<pkg|misc>\let\Unicode=\gobble_two
586 %<*doc>
587 \newcommand*\Unicode[2]{%
588 \comment{%
589 \spaceskip=\fontdimen2\font minus 1.1\fontdimen4\font
590 Unicode character \FD@codepoint{#1}%
591 \ifx \par#2\par \else , \FD@charname{#2}\fi.%
592 \linepenalty=300\par
593 }%
594 }
595 \newcommand*\textunicode[2]{%
596 \FD@codepoint{#1} \ifx\par#2\par\else(\FD@charname{#2})\fi
597 }
598 \providecommand*\FD@codepoint[1]{\texttt{U+\uppercase{#1}}}
599 \providecommand*\FD@charname[1]{\textsc{\lowercase{#1}}}
600 %</doc>
601 % \end{macrocode}
602 % \end{macro}\end{macro}\end{macro}\end{macro}
603 %
604 % \begin{macro}{\charseq}
605 % Most commonly occurring glyphs correspond to one |\Unicode|
606 % character, but this is not at all true in general---in fact there
607 % may even be letters which cannot be encoded as single characters,
608 % as they do not exist in precomposed form but have to be expressed
609 % with a base letter and combining diacritical mark. Reasonable
610 % compliance with the standard requires supporting character
611 % sequences as well as individual characters.
612 % \changes{1.928}{2004/11/27}{Command added. (LH)}
613 % \changes{1.928}{2004/12/16}{Typeset form changed, from paragraph to
614 % a one-item-per-line list. (LH)}
615 %
616 % In \package{fontinst}, the |\charseq| command is used to specify
617 % such a character sequence. The syntax is
618 % \begin{quote}
619 % |\charseq|\marg{\cs{Unicode} commands}
620 % \end{quote}
621 % where the \meta{\cs{Unicode} commands} is one or several |\Unicode|
622 % commands. This means the sequence of those characters. For example
623 % \begin{quote}
624 % |\charseq{|\\
625 % | \Unicode{0066}{LATIN SMALL LETTER F}|\\
626 % | \Unicode{0069}{LATIN SMALL LETTER I}|\\
627 % |}|
628 % \end{quote}
629 % is typeset as
630 % \begin{quote}
631 % Unicode character sequence:\\
632 % \vadjust{}\quad\texttt{U+0066} (\textsc{latin small letter f})\\
633 % \vadjust{}\quad\texttt{U+0069} (\textsc{latin small letter i})
634 % \end{quote}
635 % This indentation is made using the \texttt{IfBranch} environment,
636 % which could be considered a bit hackish.
637 %
638 % |\charseq| is gobbled in \Module{pkg} and \Module{misc}, but in the
639 % latter case it might get redefined.
640 % \begin{macrocode}
641 %<pkg|misc>\let\charseq=\gobble_one
642 % \end{macrocode}
643 % Note how the environment group restores the definition
644 % of |\Unicode|.
645 % \begin{macrocode}
646 %<*doc>
647 \newcommand\charseq[1]{%
648 \comment{Unicode character sequence:}%
649 \begin{IfBranch}%
650 \def\Unicode##1##2{%
651 \noindent\FD@codepoint{##1}
652 \ifx\par##2\par\else(\FD@charname{##2})\fi
653 \par
654 }%
655 #1%
656 \end{IfBranch}%
657 }
658 %</doc>
659 % \end{macrocode}
660 % \end{macro}
661 %
662 %
663 % \DescribeMacro{\vartop}
664 % \DescribeMacro{\varmid}
665 % \DescribeMacro{\varbot}
666 % \DescribeMacro{\varrep}
667 % The \meta{varchar commands} are:
668 % \begin{quote}
669 % |\vartop|\marg{glyph}\\
670 % |\varmid|\marg{glyph}\\
671 % |\varbot|\marg{glyph}\\
672 % |\varrep|\marg{glyph}
673 % \end{quote}
674 % These too do by default, which is overridden later, nothing in
675 % \package{fontinst} but typeset descriptive headings in \package{fontdoc}.
676 %
677 % \begin{macro}{\varchar}
678 % \begin{macro}{\vartop}
679 % \begin{macro}{\varmid}
680 % \begin{macro}{\varbot}
681 % \begin{macro}{\varrep}
682 % \begin{macro}{\endvarchar}
683 % \begin{macrocode}
684 %<*pkg|misc>
685 \let\varchar=\empty_command
686 \let\vartop=\gobble_one
687 \let\varmid=\gobble_one
688 \let\varbot=\gobble_one
689 \let\varrep=\gobble_one
690 \let\endvarchar=\empty_command
691 %</pkg|misc>
692 % \end{macrocode}
693 % \begin{macrocode}
694 %<*doc>
695 \def\varchar{\Bheading{Extensible glyph:}}
696 \def\vartop#1{\Bheading{Top} \typeset@glyph{#1}}
697 \def\varmid#1{\Bheading{Middle} \typeset@glyph{#1}}
698 \def\varbot#1{\Bheading{Bottom} \typeset@glyph{#1}}
699 \def\varrep#1{\Bheading{Repeated} \typeset@glyph{#1}}
700 \let\endvarchar\relax
701 %</doc>
702 % \end{macrocode}
703 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
704 %
705 %
706 % \begin{macro}{\useexamplefont}
707 % \begin{macro}{\slotexample}
708 % \begin{macro}{\setslotcomment}
709 % \begin{macro}{\resetslotcomment}
710 % \begin{macro}{\unsetslotcomment}
711 % \begin{macro}{\slot@comment}
712 % \begin{macro}{\slot@font}
713 % As of v\,1.8 of \package{fontinst}, we have added an interface
714 % for automatic documentation of encoding files, which has been
715 % developed by Matthias Clasen as part of his work on math fonts.
716 % The implementation was slightly modified and integrated into
717 % this version by Ulrik Vieth.
718 %
719 % |\setslotcomment| defines a default slot comment, stored in the
720 % variable |\slot@comment|, which is subsequently used to annotate
721 % all |\setslot| commands. The slot comment can be changed by
722 % |\resetslotcomment| or turned off by |\unsetslotcomment|.
723 %
724 % |\useexamplefont| defines a default font, |\slot@font|, which
725 % may be referenced by calling |\slotexample| in slot comments to
726 % display the character or symbol allocated to the current slot.
727 %
728 % Taking advantage of this mechanism, it is possible to write:
729 % \begin{quote}
730 % |\useexamplefont{FONT}|\\[0.5\baselineskip]
731 % |\setslotcomment{The symbol `\slotexample'.}|\\
732 % |\setslot{FOO}\endsetslot|\\
733 % |\setslot{BAR}\endsetslot|\\
734 % |\resetslotcomment{The character `\slotexample'.}|\\
735 % |\setslot{BAZ}\endsetslot|
736 % \end{quote}
737 % instead of having to write:
738 % \begin{quote}
739 % |\usepackage{PACKAGE-to-use-symbols-from-FONT}|\\[0.5\baselineskip]
740 % |\setslot{FOO}\comment{The symbol `\foo'.}\endsetslot|\\
741 % |\setslot{BAR}\comment{The symbol `\bar'.}\endsetslot|\\
742 % |\setslot{BAZ}\comment{The character `\baz'.}\endsetslot|
743 % \end{quote}
744 %
745 % These macros never do anything in \package{fontinst}, they just
746 % gobble their arguments.
747 % \begin{macrocode}
748 %<*pkg|misc>
749 \let\useexamplefont=\gobble_one
750 \let\slotexample=\empty_command
751 \let\setslotcomment=\gobble_one
752 \let\resetslotcomment=\gobble_one
753 \let\unsetslotcomment=\empty_command
754 %</pkg|misc>
755 % \end{macrocode}
756 % \begin{macrocode}
757 %<*doc>
758 \newif\ifslot@comment@
759 \slot@comment@false
760 \def\slot@comment{}
761 \newcommand\setslotcomment[1]{%
762 \slot@comment@true
763 \gdef\slot@comment{#1}%
764 }
765 \newcommand\resetslotcomment[1]{\gdef\slot@comment{#1}}
766 \newcommand\unsetslotcomment{%
767 \slot@comment@false
768 \global\let\slot@comment\@empty
769 }
770 % \end{macrocode}
771 %
772 % \begin{macrocode}
773 \let\slot@font=\nullfont
774 \newcommand\useexamplefont[1]{\font\slot@font=#1 }
775 \newcommand\slotexample{%
776 \ifFD@slot@known@{\slot@font\char\slot@number}\fi
777 }
778 %</doc>
779 % \end{macrocode}
780 % \end{macro}
781 % \end{macro}
782 % \end{macro}
783 % \end{macro}
784 % \end{macro}
785 % \end{macro}
786 % \end{macro}
787 %
788 % \begin{macro}{\setfontdimen}
789 % \changes{1.917}{2001/03/16}{Command added. (LH)}
790 % The |\setfontdimen| command is used in an ETX file to set a font
791 % dimen. The syntax is
792 % \begin{quote}
793 % |\setfontdimen|\marg{fontdimen no.}\marg{integer}
794 % \end{quote}
795 % where \meta{fontdimen no.} and \meta{integer} are \emph{string}
796 % expressions. \meta{fontdimen no.} specifies the fontdimen to set.
797 % \meta{integer} is the name of the integer variable to whose value
798 % the fontdimen will be set.
799 %
800 % When used in font installation, the above |\setfontdimen| command
801 % is equivalent to
802 % \changes{1.923}{2002/10/25}{Leave the fontdimen unset when the
803 % integer variable has not been set. (LH)}
804 % \begin{quote}
805 % |\ifisint|\marg{integer}|\then|\\
806 % | \setint{fontdimen(|\meta{fontdimen no.}|)}{\int{|^^A
807 % \meta{integer}|}}|\\
808 % |\fi|
809 % \end{quote}
810 % but |\setfontdimen| is also understood by the (V)PL-to-MTX
811 % converter as declaring an integer that the generated MTX file
812 % should set to the value of the fontdimen in the (V)PL.
813 % \begin{macrocode}
814 %<*pkg>
815 \def\setfontdimen#1#2{
816 \ifisint{#2}\then \setint{fontdimen(#1)}{\int{#2}} \fi
817 }
818 %</pkg>
819 %<misc>\let\setfontdimen\gobble_two
820 %<*doc>
821 \newcommand\setfontdimen[2]{%
822 \Bheading{Fontdimen} \TypesetStringExpression{#1} is
823 \(\TypesetIntegerExpression{\int{#2}}\)%
824 }
825 %</doc>
826 % \end{macrocode}
827 % \end{macro}
828 %
829 % \begin{macro}{\label}
830 % \changes{1.917}{2001/03/23}{Macro added. (LH)}
831 % \package{fontinst} and \package{finstmsc} defines the \LaTeX\
832 % |\label| command to gobble its argument, so that one can use it to
833 % reference slots.
834 % \begin{macrocode}
835 %<pkg|misc>\let\label=\gobble_one
836 % \end{macrocode}
837 % \end{macro}
838 %
839 % \begin{switch}{direct}
840 % The encoding aspect of a font can to a large extent be understood
841 % as a mapping from the set of slots to the set of glyphs---such
842 % mappings are for example realised by PostScript encoding vectors
843 % (mapping slots to glyph names) and virtual fonts (mapping slots to
844 % DVI commands for drawing a glyph). In some cases however, encodings
845 % are rather used to specify an inverse mapping going the opposite
846 % way. Since encodings are in general many-to-one, this means there
847 % need not be a proper inverse to a given encoding; instead the
848 % inverse image of a glyph is in practice chosen randomly\footnote{In
849 % the sense: according to a very deterministic (but not particularly
850 % useful) rule which depends completely on details in the
851 % implementation, and therefore should not be relied upon anyway.}
852 % among the slots that are mapped to it. This is not always desirable.
853 %
854 % The \texttt{direct} switch can be used to check whether an encoding
855 % is interpreted in the direct (slots to glyphs) or inverse (glyphs to
856 % slots) manner. If those |\setslot| commands which are undesirable
857 % under the inverse interpretation are put inside an |\ifdirect|
858 % \dots\ |\Fi| construction, then these will be ignored in that
859 % circumstance, thus allowing the programmer to exactly specify both
860 % the direct and the inverse mappings.
861 % \changes{1.924}{2003/02/08}{Command added. (LH)}
862 %
863 % In \package{fontinst}, this command is a switch, which is usually
864 % true.
865 % \begin{macrocode}
866 %<pkg|misc>\newif\ifdirect \directtrue
867 % \end{macrocode}
868 % In \package{fontdoc}, this is a conditional that will be typeset
869 % if |\showbranches| is being used.
870 % \begin{macrocode}
871 %<doc>\newcommand\ifdirect{\generic@if{direct}}
872 % \end{macrocode}
873 % \end{switch}
874 %
875 % \begin{macro}{\input_mtx_as_etx}
876 % The |\input_mtx_as_etx| command is syntactically similar to the
877 % |\inputetx| command, but it inputs an MTX file instead of an ETX
878 % file and redefines |\setscaledrawglyph| so that it expands to a
879 % |\nextslot| followed by a |\setslot| \dots\ |\endsetslot|. This is
880 % useful when making proofs of fonts with nonstandard encodings, as
881 % the MTX of a font can be used to specify ``the default encoding''
882 % of that font.
883 %
884 % \textbf{Warning:} Since this macro redefines a lot of the metric
885 % commands, you'll probably only want to call it inside a group.
886 % \changes{1.923}{2002/10/24}{Macro added. (LH)}
887 % \begin{macrocode}
888 %<*pkg|misc>
889 \def\input_mtx_as_etx#1{
890 \def\setscaledrawglyph##1##2##3##4##5##6##7##8##9{
891 \nextslot{##5}
892 \setslot{##1}\endsetslot
893 }
894 \offcommand\setscalednotglyph
895 \let\setglyph=\gobble_glyph
896 \offcommand\setkern
897 \inputmtx{#1}
898 }
899 %</pkg|misc>
900 % \end{macrocode}
901 % \end{macro}
902 %
903 %
904 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
905 %
906 % \section{Metric files}
907 % \label{Sec:Metric files}
908 %
909 % \changes{1.911}{1999/11/17}{Definitions of metric file commands
910 % added to \protect\protect\protect\Module{misc}. (LH)}
911 %
912 % \DescribeMacro{\inputmtx}
913 % The macro
914 % \begin{quote}
915 % |\inputmtx|\marg{filename}
916 % \end{quote}
917 % inputs \meta{filename}|.mtx|, ignoring anything between |\relax| and
918 % |\metrics|, and anything after |\endmetrics|.
919 %
920 % \begin{macro}{\inputmtx}
921 % \begin{macro}{\metrics}
922 % \changes{1.914}{2000/05/26}{Fixed typo: \cs{x@relax} instead of
923 % \cs{x_relax}. (LH)}
924 % \usechange{raggedright}
925 % \begin{macro}{\endmetrics}
926 % \changes{1.900}{1999/02/08}{Made it outer. (LH)}
927 % \usechange{raggedright}
928 % \begin{macro}{\endmetrics_text}
929 % \begin{macro}{\endmetrics@hook}
930 % The |\endmetrics_text| macro expands to |\endmetrics| (eleven
931 % `other' tokens, not one control sequence token). It is used instead
932 % of |\string\endmetrics|, which does not work since |\endmetrics| is
933 % outer.
934 % \begin{macrocode}
935 %<*pkg|misc>
936 \def\inputmtx#1{
937 \def\relax{\let\relax=\x_relax\iffalse}
938 \let\metrics=\fi
939 \primitiveinput #1.mtx\x_relax
940 \let\relax=\x_relax
941 }
942 \let\metrics=\x_relax
943 \edef\endmetrics_text{\string\endmetrics}
944 \outer\def\endmetrics{\endinput}
945 %</pkg|misc>
946 % \end{macrocode}
947 % |\inputmtx| used to set |\a_count|, but we haven't been able to
948 % find a reason for this, so it was removed.
949 %
950 % In \package{fontdoc}, the |\metrics| and |\endmetrics| macros
951 % initially just define a group, but |\inputmtx| redefines them to
952 % work as they do in \package{fontinst}. |\endmetrics@hook| is a
953 % macro that gets executed just before the |\endgroup| in
954 % |\endmetrics|; it is normally |\@empty|, and it is set to this value
955 % at each |\metrics|, but the metric package system redefines it.
956 % \multchanges{\cs{endmetrics_hook}}{1.914}{2000/05/27}{Macro added.
957 % (LH)}
958 % \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27}
959 % {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)}
960 % \begin{macrocode}
961 %<*doc>
962 \def\inputmtx#1{%
963 \begingroup
964 \edef\lowercase@file{\lowercase{%
965 \edef\noexpand\lowercase@file{#1}%
966 }}%
967 \lowercase@file
968 \let\endmetrics@hook=\@empty
969 \IfFileExists{\[email protected]}{%
970 \skip@mtx@preamble
971 \@@input \@filef@und
972 \let\relax=\x@relax
973 }{%
974 \PackageError{fontdoc}{File #1.mtx not found}%
975 {\@eha\MessageBreak You can \protect\inputmtx\space
976 some other file now, if you want.}%
977 }
978 \endmetrics@hook
979 \endgroup
980 }
981 \def\skip@mtx@preamble{%
982 \def\relax{\let\relax=\x@relax\iffalse}%
983 \let\metrics=\fi
984 \outer\x@cs\def{endmetrics}{\endinput}%
985 }
986 \def\metrics{%
987 \begin{flushleft}%
988 \let\endmetrics@hook=\@empty
989 }
990 \outer\def\endmetrics{%
991 \endmetrics@hook
992 \end{flushleft}%
993 }
994 %</doc>
995 % \end{macrocode}
996 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
997 %
998 %
999 % \begin{macro}{\ProvidesMtxPackage}
1000 % \changes{1.923}{2003/01/05}{Redesigned the headings for metric
1001 % packages, since they interact poorly with \cs{section} headings.
1002 % (LH)}
1003 % \begin{switch}{@mtxpackage@headed@}
1004 % \begin{macro}{\announce@package}
1005 % \begin{macro}{\finish@package}
1006 % \multchanges{\cs{ProvidesMtxPackage}\cs{usemtxpackage}}{1.914}
1007 % {2000/05/27}{New \package{fontdoc} implementation---the packages
1008 % are actually loaded (they have to, since they can define
1009 % commands). Multiple loading is prevented as in
1010 % \package{fontinst}. (LH)}
1011 % The call
1012 % \begin{quote}
1013 % |\ProvidesMtxPackage|\marg{package~name}
1014 % \end{quote}
1015 % signals to the package managing system that there is no need to load
1016 % this package again.
1017 % \begin{macrocode}
1018 %<pkg>\def\ProvidesMtxPackage#1{\x_cs\let{pack-#1}P}
1019 %<*doc>
1020 \def\ProvidesMtxPackage#1{%
1021 \endmetrics@hook
1022 % \@mtxpackage@headed@false
1023 % \everypar={
1024 \announce@package{#1}%
1025 % }%
1026 \def\endmetrics@hook{\finish@package{#1}}
1027 \global\x@cs\let{FD@pack-#1}\@empty
1028 }
1029 % \end{macrocode}
1030 % \begin{macrocode}
1031 % \newif\if@mtxpackage@headed@
1032 % \end{macrocode}
1033 % \begin{macrocode}
1034 \def\announce@package#1{%
1035 % \everypar={}%
1036 % \@mtxpackage@headed@true
1037 \Aheading{[Start of metric package \textsf{#1}.}%
1038 }
1039 % \end{macrocode}
1040 % \begin{macrocode}
1041 \def\finish@package#1{%
1042 % \if@mtxpackage@headed@
1043 \Aheading{End of metric package \textsf{#1}.]}%
1044 % \else
1045 % \everypar={}%
1046 % \Aheading{(Metric package \textsf{#1}.)}%
1047 % \fi
1048 \par\addvspace\medskipamount
1049 }
1050 %</doc>
1051 % \end{macrocode}
1052 % \end{macro}\end{macro}\end{switch}\end{macro}
1053 %
1054 %
1055 % \begin{macro}{\usemtxpackage}
1056 % The call
1057 % \begin{quote}
1058 % |\usemtxpackage|\marg{package~list}
1059 % \end{quote}
1060 % inputs those of the packages in the list that have not been loaded
1061 % yet (i.e., those for which no |\ProvidesMtxPackage| has been made).
1062 % Each package is assumed to reside in the metric file that
1063 % |\inputmtx| loads when given the name of the package as argument.
1064 %
1065 % The call
1066 % \begin{quote}
1067 % |\usemtxpackage|\oarg{filename}\marg{package~list}
1068 % \end{quote}
1069 % inputs the packages in the list if at least one of them has not been
1070 % loaded yet. In this case, all the packages are assumed to reside in
1071 % the single metric file that |\inputmtx| loads when given
1072 % \meta{filename} as argument.
1073 %
1074 % \begin{macrocode}
1075 %<*pkg>
1076 \def\usemtxpackage{\futurelet\next_token\test_UseMtxPkg_arguments}
1077 \def\test_UseMtxPkg_arguments{\ifx\next_token[
1078 \expandafter\mtx_package_given_file
1079 \else
1080 \expandafter\mtx_package_separate_files
1081 \fi
1082 }
1083 % \end{macrocode}
1084 % \begin{macrocode}
1085 \def\mtx_package_given_file[#1]#2{
1086 \_a_false
1087 \process_csep_list\load_true_unless_loaded #2,\process_csep_list,
1088 \if_a_ \inputmtx{#1} \fi
1089 }
1090 \def\load_true_unless_loaded#1{
1091 \x_cs\ifx{pack-#1}P\else\_a_true\fi
1092 }
1093 % \end{macrocode}
1094 % \begin{macrocode}
1095 \def\mtx_package_separate_files#1{
1096 \process_csep_list\load_file_unless_loaded #1,\process_csep_list,
1097 }
1098 \def\load_file_unless_loaded#1{
1099 \x_cs\ifx{pack-#1}P\else \inputmtx{#1} \fi
1100 }
1101 %</pkg>
1102 % \end{macrocode}
1103 % \begin{macrocode}
1104 %<*doc>
1105 \newcommand\usemtxpackage[2][\x@relax]{%
1106 \ifx \x@relax#1%
1107 \@for\@tempa:=#2\do{%
1108 \x@cs\ifx{FD@pack-\@tempa}\@empty \else
1109 \inputmtx{\@tempa}%
1110 \fi
1111 }%
1112 \else
1113 \@tempswafalse
1114 \@for\@tempa:=#1\do{%
1115 \x@cs\ifx{FD@pack-\@tempa}\@empty \else \@tempswatrue \fi
1116 }%
1117 \if@tempswa
1118 \inputmtx{#2}%
1119 \fi
1120 \fi
1121 }
1122 %</doc>
1123 % \end{macrocode}
1124 % \end{macro}
1125 %
1126 % \begin{macro}{\glyph_name_modifier}
1127 % The |\glyph_name_modifier| macro is applied to all glyph names
1128 % supplied to commands that are allowed in transformable MTX files
1129 % (see Subsection~\ref{Ssec:TransMTX}). The syntax is
1130 % \begin{quote}
1131 % |\glyph_name_modifier|\marg{glyph name}
1132 % \end{quote}
1133 % and the above must expand fully to a valid glyph name in \TeX's
1134 % mouth.
1135 %
1136 % \changes{1.923}{2002/10/20}{Macro added. (LH)}
1137 % The normal definition is to simply expand to the \meta{glyph name},
1138 % i.e.,
1139 % \begin{macrocode}
1140 %<pkg>\let\glyph_name_modifier=\identity_one
1141 % \end{macrocode}
1142 % but the command may expand to any sequence of character tokens. It
1143 % was introduced to support (simple) automatic renaming of glyphs
1144 % in cases where the |\reglyphfont| command would not be appropriate,
1145 % such as when the wanted renaming is simply to add a short suffix to
1146 % the glyph names.
1147 %
1148 % The reason it only affects the commands allowed in transformable
1149 % MTX files is that the macro isn't meant as a generic override for
1150 % metric commands.
1151 % \end{macro}
1152 %
1153 %
1154 % \subsection{Kerning information}
1155 %
1156 % The kerning information is kept in the macros
1157 % \describecsfamily{l-\meta{name}}|\l-|\meta{name} and
1158 % \describecsfamily{r-\meta{name}}|\r-|\meta{name}, containing
1159 % information about how \meta{name} kerns on the left and on the right,
1160 % respectively. The |\l-|\meta{name} macro should expand out to a
1161 % series of
1162 % \begin{quote}
1163 % \DescribeMacro{\k}|\k|\,|\r-|\meta{name}\,|\|\meta{amount}
1164 % \end{quote}
1165 % control sequences, and vice versa. Examples of
1166 % \describecsfamily{\meta{amount}} |\|\meta{amount}
1167 % control sequences are: |\0|, |\1|, |\1000|, |\-50|, |\33|; these
1168 % corresponds to the kern amounts $0$, $1$, $1000$ (which would be
1169 % a very large kern), $-50$, and $33$ respectively.
1170 %
1171 %
1172 % \begin{macro}{\setkern}
1173 % |\setkern|\marg{glyph1}\marg{glyph2}\marg{integer expression}
1174 %
1175 % Sets a kern pair between \meta{glyph1} and \meta{glyph2} to the
1176 % specified value, which is typically a value returned by
1177 % |\kerning|\marg{glyph3}\marg{glyph4}. If there already is a kern
1178 % set between \meta{glyph1} and \meta{glyph2} then this will not affect
1179 % the output, but it will use up another 3 units of token memory.
1180 %
1181 % \begin{macrocode}
1182 %<*pkg>
1183 \def\setkern#1#2#3{
1184 \x_cs\ifx{i-rawscale}\x_relax
1185 \expandafter\set_kern
1186 \csname~r-\glyph_name_modifier{#1}\expandafter\endcsname
1187 \csname~l-\glyph_name_modifier{#2}\endcsname
1188 {#3}
1189 \else
1190 \expandafter\set_kern
1191 \csname~r-\glyph_name_modifier{#1}\expandafter\endcsname
1192 \csname~l-\glyph_name_modifier{#2}\endcsname
1193 {\scale{#3}{\int{rawscale}}}
1194 \fi
1195 }
1196 \def\set_kern#1#2#3{
1197 \eval_expr{#3}
1198 \expandafter\set_kern_cs\csname\the\result\endcsname#1#2
1199 }
1200 \def\set_kern_cs#1#2#3{
1201 \add_to#2{\k#3#1}
1202 \add_to#3{\k#2#1}
1203 }
1204 %</pkg>
1205 % \end{macrocode}
1206 % \begin{macrocode}
1207 %<*doc>
1208 \newcommand\setkern[3]{%
1209 \Bheading{Kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}%
1210 ${}\rightarrow \TypesetIntegerExpression{#3}$%
1211 }
1212 %</doc>
1213 %<misc>\let\setkern=\gobble_three
1214 % \end{macrocode}
1215 % \end{macro}
1216 %
1217 % \begin{macro}{\resetkern}
1218 % |\resetkern|\marg{glyph1}\marg{glyph2}\marg{integer expression}
1219 %
1220 % Resets the kern pair between \meta{glyph1} and \meta{glyph2} to
1221 % the specified value. Note however that this does not relieve \TeX\
1222 % of the burden to remember the previous kerning pair between these
1223 % two glyphs (if there was one).
1224 %
1225 % \begin{macrocode}
1226 %<*pkg>
1227 \def\resetkern#1#2#3{
1228 \x_cs\ifx{i-rawscale}\x_relax
1229 \expandafter\reset_kern
1230 \csname~r-#1\expandafter\endcsname
1231 \csname~l-#2\endcsname{#3}
1232 \else
1233 \expandafter\reset_kern
1234 \csname~r-#1\expandafter\endcsname
1235 \csname~l-#2\endcsname{\scale{#3}{\int{rawscale}}}
1236 \fi
1237 }
1238 \def\reset_kern#1#2#3{
1239 \eval_expr{#3}
1240 \expandafter\reset_kern_cs\csname\the\result\endcsname#1#2
1241 }
1242 \def\reset_kern_cs#1#2#3{
1243 \prep_to#2{\k\expandafter#3\expandafter#1}
1244 \prep_to#3{\k\expandafter#2\expandafter#1}
1245 }
1246 %</pkg>
1247 % \end{macrocode}
1248 % \begin{macrocode}
1249 %<*doc>
1250 \newcommand\resetkern[3]{%
1251 \Bheading{Override kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}%
1252 ${}\rightarrow \TypesetIntegerExpression{#3}$%
1253 }
1254 %</doc>
1255 % \end{macrocode}
1256 % \end{macro}
1257 %
1258 % \begin{macro}{\setleftkerning}
1259 % \begin{macro}{\setrightkerning}
1260 % \begin{macro}{\setleftrightkerning}
1261 % |\setleftkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\
1262 % |\setrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\
1263 % |\setleftrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}
1264 %
1265 % Sets left or right kerning of \meta{glyph1} to that of \meta{glyph2}
1266 % scaled by \meta{scaled} (which is an integer expression).
1267 % |\setleftrightkerning| does both.
1268 %
1269 % \begin{macrocode}
1270 %<*pkg>
1271 \def\setleftkerning#1#2#3{
1272 \eval_expr_to\b_count{#3}
1273 \expandafter\set_kerning
1274 \csname~l-#1\expandafter\endcsname
1275 \csname~l-#2\endcsname
1276 }
1277 \def\setrightkerning#1#2#3{
1278 \eval_expr_to\b_count{#3}
1279 \expandafter\set_kerning
1280 \csname~r-#1\expandafter\endcsname
1281 \csname~r-#2\endcsname
1282 }
1283 \def\setleftrightkerning#1#2#3{
1284 \eval_expr_to\b_count{#3}
1285 \expandafter\set_kerning
1286 \csname~l-#1\expandafter\endcsname
1287 \csname~l-#2\endcsname
1288 \expandafter\set_kerning
1289 \csname~r-#1\expandafter\endcsname
1290 \csname~r-#2\endcsname
1291 }
1292 \def\set_kerning#1#2{
1293 \if\b_count=\one_thousand
1294 \def\k##1##2{
1295 \set_kern_cs##2##1#1
1296 }
1297 \else
1298 \def\k##1##2{
1299 \set_kern##1#1{
1300 \scale\b_count{\expandafter\gobble_one\string##2}
1301 }
1302 }
1303 \fi
1304 #2
1305 }
1306 %</pkg>
1307 % \end{macrocode}
1308 % \begin{macrocode}
1309 %<*doc>
1310 \newcommand\setleftkerning[3]{%
1311 \Bheading{Kern} \typeset@glyph{#1} on the left like
1312 \typeset@glyph{#2} \ConditionallyScaled{#3}}
1313 \newcommand\setrightkerning[3]{%
1314 \Bheading{Kern} \typeset@glyph{#1} on the right like
1315 \typeset@glyph{#2} \ConditionallyScaled{#3}}
1316 \newcommand\setleftrightkerning[3]{%
1317 \Bheading{Kern} \typeset@glyph{#1} on the left and right like
1318 \typeset@glyph{#2} \ConditionallyScaled{#3}}
1319 % \end{macrocode}
1320 % \end{macro}
1321 % \end{macro}
1322 % \end{macro}
1323 %
1324 % \begin{macro}{\ConditionallyScaled}
1325 % \changes{1.916}{2001/01/06}{Command added. (LH)}
1326 % Several metric commands have take a scaling factor argument which is
1327 % rendered by \package{fontdoc} as ``scaled \meta{argument}''. The by
1328 % far most common value for this argument is however the constant
1329 % number 1000 (no scaling), and in those cases the ``scaled
1330 % \textellipsis'' feels a bit long-winded. The cure for this is the
1331 % |\Conditionally|\-|Scaled| command, which takes an integer expression
1332 % as its argument and typesets the ``scaled \meta{integer expression}''
1333 % \emph{unless} that expression evaluates to 1000, in which case
1334 % |\Conditionally|\-|Scaled| simply gobbles any spaces following it.
1335 % \begin{macrocode}
1336 \newcommand\ConditionallyScaled[1]{%
1337 \FD@evaluate@true
1338 \FD@eval@expr{#1}%
1339 \@tempswatrue
1340 \ifFD@evaluate@ \ifnum \FD@result=\@m \@tempswafalse \fi\fi
1341 \FD@evaluate@false
1342 \if@tempswa scaled \(\FD@expression\)\else \ignorespaces \fi
1343 }
1344 %</doc>
1345 % \end{macrocode}
1346 % \end{macro}
1347 %
1348 %
1349 % \begin{macro}{\kerning}
1350 % |\kerning|\marg{glyph1}\marg{glyph2}
1351 %
1352 % Returns the value of kern pair between \meta{glyph1} and
1353 % \meta{glyph2} as an integer. Returns a value of zero if such a kern
1354 % pair doesn't exist.
1355 %
1356 % \begin{macrocode}
1357 %<*pkg>
1358 \def\kerning#1#2{0\x_relax
1359 \def\k##1{\csname~set-\string##1\endcsname\gobble_one}
1360 \bgroup
1361 \x_cs\def{set-\string\l-#2}##1##2{
1362 \global\result=\expandafter\gobble_one\string##2\egroup
1363 }
1364 \csname~r-#1\endcsname
1365 \csname~set-\string\l-#2\endcsname\gobble_one{00}
1366 }
1367 %</pkg>
1368 % \end{macrocode}
1369 % \changes{1.909}{1999/10/19}{A use of \#1 where it should have
1370 % been \#2 was corrected. (LH)}
1371 % \begin{macrocode}
1372 %<*doc>
1373 \DeclareRobustCommand\kerning[2]{%
1374 \begingroup
1375 \MakePrintable\@tempa{FD@swa}{#1}%
1376 \MakePrintable\@tempb{FD@swa}{#2}%
1377 \protected@xdef\FD@expression{%
1378 \mathop{\protect\mathrm{k{}}}(%
1379 \text{\protect\FD@typeset@string{\@tempa}}%
1380 ,\penalty\FD@commapenalty
1381 \text{\protect\FD@typeset@string{\@tempb}}%
1382 )%
1383 }%
1384 \global\chardef\FD@priority=5%
1385 \global\FD@bracket@level=\@ne
1386 \FD@evaluate@false
1387 \endgroup
1388 }
1389 %</doc>
1390 % \end{macrocode}
1391 % \end{macro}
1392 %
1393 % \begin{macro}{\ifiskern}
1394 % |\ifiskern|\marg{glyph1}\marg{glyph2}|\then|
1395 %
1396 % This command tests if there is a kern pair between \meta{glyph1} and
1397 % \meta{glyph2}. It's hard to say if there is a use for it, but it is
1398 % included for symmetry.
1399 %
1400 % \begin{macrocode}
1401 %<*pkg>
1402 \def\ifiskern#1#2\then{
1403 \def\k##1##2{\ifx T##1 \let\k\gobble_two \fi}
1404 \bgroup
1405 \x_cs\let{l-#2}T
1406 \csname r-#1\endcsname
1407 \expandafter\egroup \ifx\k\gobble_two
1408 }
1409 %</pkg>
1410 % \end{macrocode}
1411 % \begin{macrocode}
1412 %<*doc>
1413 \def\ifiskern#1#2\then{%
1414 \generic@if{kern \typeset@glyph{#1}${}+{}$\typeset@glyph{#2} set}%
1415 }
1416 %</doc>
1417 % \end{macrocode}
1418 % \end{macro}
1419 %
1420 %
1421 % \begin{macro}{\unsetkerns}
1422 % |\unsetkerns|\marg{left~glyph~list}\marg{right~glyph~list}
1423 %
1424 % This command unsets all kerns with a glyph in the \meta{left~glyph~list}
1425 % on the left and a glyph in the \meta{right~glyph~list} on the right.
1426 % The lists themselves are ordinary comma-separated lists. Unlike
1427 % |\setkern| and |\resetkern|, |\unsetkerns| actually removes the
1428 % kerning pairs from \TeX's memory.
1429 %
1430 % The implementation itself simply goes through |\r-|\meta{left~glyph}
1431 % for each element \meta{left~glyph} in \meta{left~glyph~list} and
1432 % |\l-|\meta{right~glyph} for each element \meta{right~glyph} in
1433 % \meta{right~glyph~list}, removing each |\k|\meta{token}\meta{token}
1434 % tripple that refers to a glyph from the opposite list as it goes
1435 % along. To make this test reasonably fast, the routine first ``marks''
1436 % the glyphs in the other list by setting the control sequences
1437 % |\slots-|\meta{glyph} to |U| (the letter token U). This mark is
1438 % later removed when the |\r-|\meta{glyph} or |\l-|\meta{glyph}
1439 % respectively control sequences have been gone through; the
1440 % |\slots-|\meta{glyph} control sequences are then set to |\relax|.
1441 %
1442 % \begin{macrocode}
1443 %<*pkg>
1444 \def\unsetkerns#1#2{
1445 \let\k\k_unless_to_U
1446 \process_csep_list\make_slots_U#1,\process_csep_list,
1447 \def\do##1{\x_cs\main_remove_Us{l-##1}}
1448 \process_csep_list\do#2,\process_csep_list,
1449 \process_csep_list\make_slots_relax#1,\process_csep_list,
1450 \process_csep_list\make_slots_U#2,\process_csep_list,
1451 \def\do##1{\x_cs\main_remove_Us{r-##1}}
1452 \process_csep_list\do#1,\process_csep_list,
1453 \process_csep_list\make_slots_relax#2,\process_csep_list,
1454 }
1455 \def\make_slots_U#1{\x_cs\let{slots-#1}U}
1456 \def\make_slots_relax#1{\x_cs\let{slots-#1}\x_relax}
1457 \def\k_unless_to_U#1#2{
1458 \x_cs\ifx{slots-\expandafter\gobble_three\string#1}U \else
1459 \noexpand\k\noexpand#1\noexpand#2
1460 \fi
1461 }
1462 \def\main_remove_Us#1{
1463 \ifx#1\x_relax \else
1464 \edef#1{#1}
1465 \ifx#1\empty_command \let#1\x_relax \fi
1466 \fi
1467 }
1468 %</pkg>
1469 % \end{macrocode}
1470 % \begin{macrocode}
1471 %<*doc>
1472 \newcommand\unsetkerns[2]{%
1473 \Bheading{Remove} all kerning pairs in
1474 \FD@typeset@string@set{#1}${}\times{}$\FD@typeset@string@set{#2}%
1475 }
1476 % \end{macrocode}
1477 % \end{macro}
1478 %
1479 % \begin{macro}{\FD@typeset@string@set}
1480 % \begin{macro}{\FD@typeset@string@set@}
1481 % \multchanges{\cs{FD@typeset@string@set}^^A
1482 % \cs{FD@typeset@string@set@}}{1.916}{2001/01/02}{Macros added.
1483 % \cs{FD@typeset@string@set} should be used instead of
1484 % \cs{print@csep@list} in most occations. (LH)}
1485 % The |\FD@typeset@string@set| macro takes a comma-separated list of
1486 % string expressions as argument and typesets that list as elements of
1487 % a set, e.g.
1488 % \begin{quote}
1489 % |\FD@typeset@string@set{a,b,\str{c}}|
1490 % \end{quote}
1491 % is typeset as
1492 % \begin{quote}
1493 % $\{$\texttt{a}$,{}$\texttt{b}$,\mathrm{s}($\texttt{c}$)\}$
1494 % \end{quote}
1495 % \begin{macrocode}
1496 \def\FD@typeset@string@set#1{%
1497 \toks@={}%
1498 \@for\@tempa:=#1\do{%
1499 \protected@edef\@tempa{%
1500 \noexpand\MakePrintable \noexpand\@tempa {FD@swa}{\@tempa}%
1501 }%
1502 \@tempa
1503 \toks@=\expandafter{\the\expandafter\toks@
1504 \expandafter\do \expandafter{\@tempa}}%
1505 }%
1506 \expandafter\FD@typeset@string@set@ \expandafter{\the\toks@}%
1507 }
1508 \def\FD@typeset@string@set@#1{%
1509 \TypesetList{$\{$}{$,\penalty\FD@commapenalty{}$}%
1510 {$,\penalty\FD@commapenalty{}$}{$,\penalty\FD@commapenalty{}$}%
1511 {$\}$}{$\emptyset$}{\FD@typeset@string}{#1}%
1512 }
1513 %</doc>
1514 % \end{macrocode}
1515 % \end{macro}\end{macro}
1516 %
1517 %
1518 % \begin{macro}{\noleftkerning}
1519 % \changes{1.906}{1999/07/30}{Macro added. (LH)}
1520 % \begin{macro}{\norightkerning}
1521 % \changes{1.906}{1999/07/30}{Macro added. (LH)}
1522 % \begin{macro}{\noleftrightkerning}
1523 % \changes{1.906}{1999/07/30}{Macro added. (LH)}
1524 % The argument of these commands is the name of a glyph. The commands
1525 % removes all kerns on the left, on the right, and on both sides
1526 % respectively, of this glyph.
1527 %
1528 % \begin{macrocode}
1529 %<*pkg>
1530 \def\noleftkerning#1{\no_kerning{l}{#1}}
1531 \def\norightkerning#1{\no_kerning{r}{#1}}
1532 \def\noleftrightkerning#1{\no_kerning{l}{#1}\no_kerning{r}{#1}}
1533 %</pkg>
1534 % \end{macrocode}
1535 % \begin{macrocode}
1536 %<*doc>
1537 \newcommand\noleftkerning[1]{%
1538 \Bheading{Remove kerns} on the left of glyphs in
1539 \FD@typeset@string@set{#1}.}
1540 \newcommand\norightkerning[1]{%
1541 \Bheading{Remove kerns} on the right of glyphs in
1542 \FD@typeset@string@set{#1}.}
1543 \newcommand\noleftrightkerning[1]{%
1544 \Bheading{Remove kerns} on any side of glyphs in
1545 \FD@typeset@string@set{#1}.}
1546 %</doc>
1547 % \end{macrocode}
1548 % \end{macro}\end{macro}\end{macro}
1549 %
1550 % \begin{macro}{\no_kerning}
1551 % \changes{1.906}{1999/07/30}{Macro added. (LH)}^^A
1552 % \changes{1.906}{1999/08/01}{Macro thoroughly rewritten. (LH)}^^A
1553 % This macro is called as
1554 % \begin{quote}
1555 % |\no_kerning|\marg{side}\marg{glyph list}
1556 % \end{quote}
1557 % where \meta{side} is |l| or |r|, and \meta{glyph list} is a
1558 % comma-separated list of glyph names. The macro unsets all kerns on
1559 % the \meta{side} side of the glyphs in the \meta{glyph list}.
1560 %
1561 % \begin{macrocode}
1562 %<*pkg>
1563 \def\no_kerning#1#2{
1564 \let\k\no_kerning_i
1565 \def\do##1{\csname #1-##1\endcsname}
1566 \bgroup
1567 \aftergroup\def \aftergroup\a_macro \aftergroup{
1568 \process_csep_list\do #2,\process_csep_list,
1569 \aftergroup}
1570 \egroup
1571 \def\do##1{\expandafter\let \csname #1-##1\endcsname \x_relax}
1572 \process_csep_list\do #2,\process_csep_list,
1573 \let\k\no_kerning_ii
1574 \def\do##1{\edef##1{##1}}
1575 \a_macro
1576 }
1577 % \end{macrocode}
1578 % \begin{macro}{\no_kerning_i}
1579 % The |\no_kerning_i| macro is used by |\no_kerning| in constructing
1580 % a list of all glyphs that a glyph in the \meta{glyph list} has a
1581 % \meta{side} kern to, while avoiding repetitions.
1582 % \begin{macrocode}
1583 \def\no_kerning_i#1#2{
1584 \ifx #1\x_relax \else
1585 \aftergroup\do \aftergroup#1
1586 \let #1\x_relax
1587 \fi
1588 }
1589 % \end{macrocode}
1590 % \end{macro}
1591 % \begin{macro}{\no_kerning_ii}
1592 % The |\no_kerning_ii| macro is similar to the |\k_unless_to_U|
1593 % macro.
1594 % \begin{macrocode}
1595 \def\no_kerning_ii#1#2{
1596 \ifx #1\x_relax \else \noexpand\k \noexpand#1 \noexpand#2 \fi
1597 }
1598 %</pkg>
1599 % \end{macrocode}
1600 % \end{macro}
1601 % \end{macro}
1602 %
1603 %
1604 %
1605 % \subsection{Glyph information}
1606 % \label{Ssec:Glyph-info}
1607 %
1608 % The glyph information is kept in the macros
1609 % \describecsfamily{g-\meta{name}}|\g-|\meta{name}, which expands
1610 % out to:
1611 % \begin{quote}
1612 % \marg{width}\marg{height}\marg{depth}\marg{italic}^^A
1613 % \marg{mapcommands}\marg{mapfonts}
1614 % \end{quote}
1615 % where the \meta{mapcommands} will write out VPL |MAP| fragments to a
1616 % |.vpl| file, and the \meta{mapfonts} will produce any |MAPFONT|
1617 % instructions that are needed.
1618 %
1619 %
1620 % \begin{macro}{\typeset@glyph}
1621 % \changes{1.909}{1999/10/20}{Macro added, and most commands that
1622 % print a glyph name changed to use this macro. (LH)}
1623 % \changes{1.916}{2001/01/02}{Macro redefined (made synonymous to
1624 % \cs{Typeset\-String\-Expression}). (LH)}
1625 % The |\typeset@glyph| macro takes a string expression and typesets
1626 % that as the name of a glyph. Currently names of glyphs are formatted
1627 % precisely the same as any other string expression.
1628 % \begin{macrocode}
1629 %<doc>\let\typeset@glyph=\TypesetStringExpression
1630 % \end{macrocode}
1631 % \end{macro}
1632 %
1633 %
1634 % \begin{macro}{\width}
1635 % \begin{macro}{\height}
1636 % \begin{macro}{\depth}
1637 % \begin{macro}{\italic}
1638 % |\width|\marg{glyph}\\
1639 % |\height|\marg{glyph}\\
1640 % |\depth|\marg{glyph}\\
1641 % |\italic|\marg{glyph}
1642 %
1643 % In \package{fontinst}, these macros return the width, height,
1644 % depth, and italic correction of \meta{glyph} as an integer.
1645 % \begin{macrocode}
1646 %<*pkg>
1647 \def\width{\glyph_parameter\first_of_six}
1648 \def\height{\glyph_parameter\second_of_six}
1649 \def\depth{\glyph_parameter\third_of_six}
1650 \def\italic{\glyph_parameter\fourth_of_six}
1651 %</pkg>
1652 % \end{macrocode}
1653 %
1654 % In \package{fontdoc}, they print symbolic representations for the
1655 % corresponding integer expressions.
1656 % \begin{macrocode}
1657 %<*doc>
1658 \DeclareRobustCommand\width[1]{\FD@glyph@metric{w}{#1}}
1659 \DeclareRobustCommand\height[1]{\FD@glyph@metric{h}{#1}}
1660 \DeclareRobustCommand\depth[1]{\FD@glyph@metric{d}{#1}}
1661 \DeclareRobustCommand\italic[1]{\FD@glyph@metric{i}{#1}}
1662 % \end{macrocode}
1663 % \end{macro}
1664 % \end{macro}
1665 % \end{macro}
1666 % \end{macro}
1667 %
1668 % \begin{macro}{\FD@glyph@metric}
1669 % The |\FD@glyph@metric| macro is a convenient shorthand to use when
1670 % defining integer-valued functions which represents some glyph
1671 % metric (e.g.\ \cs{height}). Its syntax is
1672 % \begin{quote}
1673 % |\FD@glyph@metric|\marg{func-name}\marg{string expression}
1674 % \end{quote}
1675 % The \meta{string expression} must be expanded.
1676 % \begin{macrocode}
1677 \def\FD@glyph@metric#1#2{%
1678 \begingroup
1679 \MakePrintable\@tempa{FD@swa}{#2}%
1680 \protected@xdef\FD@expression{%
1681 \protect\FD@integer@func{#1}{\@tempa}%
1682 }%
1683 \global\chardef\FD@priority=5%
1684 \global\FD@bracket@level=\@ne
1685 \FD@evaluate@false
1686 \endgroup
1687 }
1688 %</doc>
1689 % \end{macrocode}
1690 % \end{macro}
1691 %
1692 %
1693 %
1694 % \begin{macro}{\mapcommands}
1695 % \begin{macro}{\mapfonts}
1696 % These are similar to |\width| and its companions, but they are not
1697 % user level commands.
1698 % \begin{macrocode}
1699 %<*pkg>
1700 \def\mapcommands{\glyph_parameter\fifth_of_six}
1701 \def\mapfonts{\glyph_parameter\sixth_of_six}
1702 %</pkg>
1703 % \end{macrocode}
1704 % \end{macro}
1705 % \end{macro}
1706 %
1707 % \begin{macro}{\glyph_parameter}
1708 % \begin{macro}{\first_of_six}
1709 % \begin{macro}{\second_of_six}
1710 % \begin{macro}{\third_of_six}
1711 % \begin{macro}{\fourth_of_six}
1712 % \begin{macro}{\fifth_of_six}
1713 % \begin{macro}{\sixth_of_six}
1714 % \begin{macro}{\glyph_metrics}
1715 % These macros are used to define |\width| and its friends.
1716 % |\glyph_parameter| takes one of the other seven for its first
1717 % argument and a glyph name for its second argument. The
1718 % |\glyph_metrics| macro can be used if one wants to get all the
1719 % metric variables at once.
1720 % \begin{macrocode}
1721 %<*pkg>
1722 \def\glyph_parameter#1#2{
1723 \expandafter\expandafter\expandafter
1724 #1\csname g-#2\endcsname
1725 }
1726 % \end{macrocode}
1727 % \begin{macrocode}
1728 \def\first_of_six#1#2#3#4#5#6{#1}
1729 \def\second_of_six#1#2#3#4#5#6{#2}
1730 \def\third_of_six#1#2#3#4#5#6{#3}
1731 \def\fourth_of_six#1#2#3#4#5#6{#4}
1732 \def\fifth_of_six#1#2#3#4#5#6{#5}
1733 \def\sixth_of_six#1#2#3#4#5#6{#6}
1734 % \end{macrocode}
1735 % \begin{macrocode}
1736 \def\glyph_metrics#1#2#3#4#5#6{
1737 \a_count=#1
1738 \b_count=#2
1739 \c_count=#3
1740 \d_count=#4~
1741 }
1742 % \end{macrocode}
1743 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
1744 % \end{macro} \end{macro} \end{macro}
1745 %
1746 %
1747 % \begin{macro}{\saved_scale}
1748 % \begin{macro}{\saved_mapfont}
1749 % \begin{macro}{\saved_raw}
1750 % \begin{macro}{\saved_rule}
1751 % \begin{macro}{\saved_special}
1752 % \begin{macro}{\saved_warning}
1753 % \begin{macro}{\saved_movert}
1754 % \begin{macro}{\saved_moveup}
1755 % \begin{macro}{\saved_push}
1756 % \begin{macro}{\saved_pop}
1757 % These are the commands allowed inside a glyph. They are initally
1758 % set to |\relax|, so we can |\edef| with them safely.
1759 % \begin{macrocode}
1760 \let\saved_scale\x_relax
1761 \let\saved_mapfont\x_relax
1762 \let\saved_raw\x_relax
1763 \let\saved_rule\x_relax
1764 \let\saved_special\x_relax
1765 \let\saved_warning\x_relax
1766 \let\saved_movert\x_relax
1767 \let\saved_moveup\x_relax
1768 \let\saved_push\x_relax
1769 \let\saved_pop\x_relax
1770 % \end{macrocode}
1771 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
1772 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
1773 %
1774 % When the glyph is being constructed by
1775 % \begin{quote}
1776 % |\setglyph|\marg{glyph} \meta{glyph commands} |\endsetglyph|
1777 % \end{quote}
1778 % the values of each of these parameters are kept in the following
1779 % variables. Except for |\glyph_width|, these are kept globally,
1780 % so they survive through |\push| \textellipsis\ |\pop| pairs. In
1781 % addition, the current vertical offset is kept locally in
1782 % |\glyph_voffset|. The |\glyph_maxhpos| variable globally keeps track
1783 % of the largest horizontal offset position reached so far (with the
1784 % possible exception of the current position, i.e.\ width, which may
1785 % well be larger).
1786 %
1787 %
1788 % \begin{macro}{\glyph_width}
1789 % \begin{macro}{\glyph_height}
1790 % \begin{macro}{\glyph_depth}
1791 % \begin{macro}{\glyph_italic}
1792 % \begin{macro}{\glyph_map_commands}
1793 % \begin{macro}{\glyph_map_fonts}
1794 % \begin{macro}{\glyph_voffset}
1795 % \begin{macro}{\glyph_maxhpos}
1796 % \changes{1.903}{1999/05/20}{Variable added. (LH)}
1797 % \begin{macrocode}
1798 \newcount\glyph_width
1799 \newcount\glyph_height
1800 \newcount\glyph_depth
1801 \newcount\glyph_italic
1802 \newtoks\glyph_map_commands
1803 \newtoks\glyph_map_fonts
1804 \newcount\glyph_voffset
1805 \newcount\glyph_maxhpos
1806 % \end{macrocode}
1807 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
1808 % \end{macro} \end{macro} \end{macro}
1809 %
1810 % \begin{macro}{\setglyph}
1811 % \changes{1.916}{2001/01/06}{Added `set' to \package{fontdoc} text.
1812 % (LH)}
1813 % \begin{macro}{\gobble_glyph}
1814 % The |\setglyph|\marg{name} command defines |\g-|\meta{name},
1815 % unless |\g-|\meta{name} has already been defined.
1816 %
1817 % The reason |\g-|\meta{name} is defined before calling |\resetglyph|
1818 % is to make it possible to refer to ``the glyph constructed so far''
1819 % using |\width|\marg{name}, |\height|\marg{name}, etc.
1820 % \begin{macrocode}
1821 \def\setglyph#1{
1822 \ifisglyph{\glyph_name_modifier{#1}}\then
1823 \expandafter\gobble_glyph
1824 \else
1825 \x_cs\def{g-\glyph_name_modifier{#1}}{
1826 {\the\glyph_width}{\the\glyph_height}
1827 {\the\glyph_depth}{\the\glyph_italic}
1828 {\the\glyph_map_commands}{\the\glyph_map_fonts}
1829 }
1830 \resetglyph{\glyph_name_modifier{#1}}
1831 \fi
1832 }
1833 \long\def\gobble_glyph#1\endsetglyph{}
1834 %</pkg>
1835 % \end{macrocode}
1836 % \begin{macrocode}
1837 %<*doc>
1838 \newcommand\setglyph[1]{%
1839 \FD@tight@true
1840 \Aheading{Set glyph `\typeset@glyph{#1}'}%
1841 }
1842 %</doc>
1843 %<misc>\long\def\setglyph#1\endsetglyph{}
1844 % \end{macrocode}
1845 %
1846 % LH 2003/01/05: A very useful trick, which unfortunately used to be
1847 % undocumented, is to put kerning or variable assignment commands
1848 % between |\setglyph| and the corresponding |\endsetglyph|. These
1849 % commands will then only be executed if the glyph is being set by
1850 % that |\setglyph|. Typical application: If \texttt{Aacutesmall}
1851 % is being made by skrinking \texttt{Aacute}, then it is reasonable
1852 % to make \texttt{Aacutesmall} kern like \texttt{Aacute} (modulo
1853 % some scaling factor). If on the other hand \texttt{Aacutesmall}
1854 % has already been set then there is less reason to believe
1855 % \texttt{Aacutesmall} should kern like \texttt{Aacute} (a more
1856 % probable guess is that it should kern like \texttt{Asmall}).
1857 % \end{macro} \end{macro}
1858 %
1859 % \begin{macro}{\resetglyph}
1860 % The |\resetglyph|\marg{name} command redefines |\g-|\meta{name},
1861 % regardless of whether |\g-|\meta{name} has already been defined.
1862 % \changes{1.923}{2002/10/20}{\cs{edef}ing \cs{glyphname}, for
1863 % consistency with \cs{setslot}. In principle, this could break
1864 % MTX files, but I doubt that it will. (LH)}
1865 %
1866 % \begin{macrocode}
1867 %<*pkg>
1868 \def\resetglyph#1{
1869 \edef\glyphname{#1}
1870 \glyph_width=0
1871 \global\glyph_height=0
1872 \global\glyph_depth=0
1873 \global\glyph_italic=0
1874 \glyph_voffset=0
1875 \global\glyph_maxhpos=0
1876 \global\glyph_map_commands={}
1877 \global\glyph_map_fonts={}
1878 }
1879 %</pkg>
1880 % \end{macrocode}
1881 % \begin{macrocode}
1882 %<*doc>
1883 \newcommand\resetglyph[1]{%
1884 \FD@tight@true
1885 \Aheading{Reset glyph `\typeset@glyph{#1}'}}
1886 %</doc>
1887 % \end{macrocode}
1888 % \end{macro}
1889 %
1890 % \begin{macro}{\endsetglyph}
1891 % \begin{macro}{\endresetglyph}
1892 % \begin{macrocode}
1893 %<*pkg>
1894 \def\endsetglyph{
1895 \x_cs\edef{g-\glyphname}
1896 {{\the\glyph_width}{\the\glyph_height}
1897 {\the\glyph_depth}{\the\glyph_italic}
1898 {\the\glyph_map_commands}{\the\glyph_map_fonts}}
1899 }
1900 \let\endresetglyph=\endsetglyph
1901 %</pkg>
1902 % \end{macrocode}
1903 % \begin{macrocode}
1904 %<*doc>
1905 \let\endsetglyph=\FD@tight@false
1906 \let\endresetglyph=\FD@tight@false
1907 %</doc>
1908 % \end{macrocode}
1909 % \end{macro}
1910 % \end{macro}
1911 %
1912 % \begin{macro}{\setscaledrawglyph}
1913 % \changes{1.922}{2002/09/07}{Corrected typo: should test whether the
1914 % \texttt{rawscale} integer exists, not whether the
1915 % \texttt{i-rawscale} integer exists. (LH)}
1916 % \begin{macro}{\setrawglyph}
1917 % The |\setscaledrawglyph| has the syntax
1918 % \begin{isyntax}
1919 % |\setscaledrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A
1920 % \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0
1921 % \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
1922 % \end{isyntax}
1923 % It is a generalized form of the old |\setrawglyph| command, which
1924 % has the syntax
1925 % \begin{isyntax}
1926 % |\setrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A
1927 % \marg{slot}\penalty0\marg{width}\penalty0
1928 % \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
1929 % \end{isyntax}
1930 % |\setrawglyph| is now syntactic sugar for the equivalent call of
1931 % |\set|\-|scaled|\-|raw|\-|glyph|.
1932 % \begin{macrocode}
1933 %<*pkg>
1934 \def\setrawglyph#1#2#3{
1935 \setscaledrawglyph{#1}{#2}{#3}\one_thousand
1936 }
1937 % \end{macrocode}
1938 %
1939 % These commands are generated automatically, when an |.mtx| file is
1940 % written out by |\afmtomtx|, |\pltomtx|, or |\mtxtomtx|.
1941 %
1942 % To illustrate the difference between |\setrawglyph| and the new
1943 % |\set|\-|scaled|\-|raw|\-|glyph|, note that
1944 % \begin{quote}
1945 % |\setscaledrawglyph{fscaled}{xfont}{10pt}{800}{102}%|\\
1946 % | {300}{600}{300}{40}|
1947 % \end{quote}
1948 % produces the same \texttt{fscaled} glyph as
1949 % \begin{quote}
1950 % |\setrawglyph{f}{xfont}{10pt}{102}{375}{750}{375}{50}|\\
1951 % |\setglyph{fscaled} \glyph{f}{800} \endsetglyph|
1952 % \end{quote}
1953 %
1954 % \begin{macrocode}
1955 \def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{
1956 \if_undefined{g-\glyph_name_modifier{#1}}\then
1957 \eval_expr{#4}
1958 \ifnum \result=\one_thousand
1959 \let\a_macro\identity_one
1960 \else
1961 \edef\a_macro##1{\saved_scale{\the\result}{##1}}
1962 \fi
1963 \eval_expr_to\a_count{#6}
1964 \eval_expr_to\b_count{#7}
1965 \eval_expr_to\c_count{#8}
1966 \eval_expr_to\d_count{#9}
1967 \ifisint{rawscale}\then
1968 \e_count=\int{rawscale}
1969 \multiply \a_count \e_count \l_rounded_thousandths\a_count
1970 \multiply \b_count \e_count \l_rounded_thousandths\b_count
1971 \multiply \c_count \e_count \l_rounded_thousandths\c_count
1972 \multiply \d_count \e_count \l_rounded_thousandths\d_count
1973 \edef\a_macro##1{\saved_scale{\the\e_count}{\a_macro{##1}}}
1974 \fi
1975 \x_cs\edef{g-\glyph_name_modifier{#1}}{
1976 {\the\a_count}
1977 {\the\b_count}
1978 {\the\c_count}
1979 {\the\d_count}
1980 {\a_macro{\saved_raw{#2}{#5}{#1}}}
1981 {\a_macro{\saved_mapfont{#2}{#3}}}
1982 }
1983 \fi
1984 }
1985 %</pkg>
1986 % \end{macrocode}
1987 % \begin{macrocode}
1988 %<*doc>
1989 \newcommand\setrawglyph[8]{%
1990 \Aheading{Glyph `\typeset@glyph{#1}'}
1991 \Bheading{Taken from} slot $\TypesetIntegerExpression{#4}$ in
1992 font \TypesetStringExpression{#2}%
1993 }
1994 \newcommand\setscaledrawglyph[9]{%
1995 \Aheading{Glyph `\typeset@glyph{#1}'}
1996 \Bheading{Taken from} slot $\TypesetIntegerExpression{#5}$ in
1997 font \TypesetStringExpression{#2} \ConditionallyScaled{#4}%
1998 }
1999 %</doc>
2000 %<misc>\def\setrawglyph#1#2#3#4#5#6#7#8{}
2001 %<misc>\def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{}
2002 % \end{macrocode}
2003 % \end{macro}\end{macro}
2004 %
2005 % \begin{macro}{\setscalednotglyph}
2006 % \changes{1.917}{2001/03/13}{This macro should set
2007 % \cs{g-\meta{glyph}-not}, not \cs{g-\meta{glyph}}. (LH)}
2008 % \changes{1.922}{2002/09/07}{Corrected typo: should test whether
2009 % the \texttt{rawscale} integer exists, not whether the
2010 % \texttt{i-rawscale} integer exists. (LH)}
2011 % \begin{macro}{\setnotglyph}
2012 % The |\setscalednotglyph| command has the same syntax as the
2013 % |\set|\-|scaled|\-|raw|\-|glyph| command, i.e.,
2014 % \begin{isyntax}
2015 % |\setscalednotglyph|\marg{glyph}\marg{font}\marg{design size}^^A
2016 % \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0
2017 % \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}
2018 % \end{isyntax}
2019 % It is a generalized form of the old |\setnotglyph| command, which
2020 % has the syntax
2021 % \begin{isyntax}
2022 % |\setnotglyph|\marg{glyph}\marg{font}\marg{design size}^^A
2023 % \marg{slot}\penalty0\marg{width}\penalty0\marg{height}\penalty0
2024 % \marg{depth}\penalty0\marg{italic}
2025 % \end{isyntax}
2026 % |\setnotglyph| is now syntactic sugar for the equivalent call of
2027 % |\set|\-|scaled|\-|not|\-|glyph|.
2028 % \begin{macrocode}
2029 %<*pkg>
2030 \def\setnotglyph#1#2#3{
2031 \setscalednotglyph{#1}{#2}{#3}\one_thousand
2032 }
2033 % \end{macrocode}
2034 %
2035 % Note that only the \meta{glyph}, \meta{width}, \meta{height},
2036 % \meta{depth}, and \meta{italic} parameters are used. The reason for
2037 % having the other parameters is that |\set|\-|scaled|\-|not|\-^^A
2038 % |glyph| commands can be converted to |\set|\-|scaled|\-|raw|\-^^A
2039 % |glyph| commands when a font is reencoded. Therefore all the
2040 % information must be present, even if it is not used by the main
2041 % definition.
2042 %
2043 % To think about (LH 2000/03/02): Perhaps the \meta{mapcommands} field
2044 % of a \texttt{-not}-glyph should contain a |\glyphwarning|, just in
2045 % case anyone tries to use one?
2046 % \begin{macrocode}
2047 \def\setscalednotglyph#1#2#3#4#5#6#7#8#9{
2048 \if_undefined{g-\glyph_name_modifier{#1}-not}\then
2049 \eval_expr_to\a_count{#6}
2050 \eval_expr_to\b_count{#7}
2051 \eval_expr_to\c_count{#8}
2052 \eval_expr_to\d_count{#9}
2053 \ifisint{rawscale}\then
2054 \e_count=\int{rawscale}
2055 \multiply \a_count \e_count \l_rounded_thousandths\a_count
2056 \multiply \b_count \e_count \l_rounded_thousandths\b_count
2057 \multiply \c_count \e_count \l_rounded_thousandths\c_count
2058 \multiply \d_count \e_count \l_rounded_thousandths\d_count
2059 \fi
2060 \x_cs\edef{g-\glyph_name_modifier{#1}-not}{
2061 {\the\a_count}
2062 {\the\b_count}
2063 {\the\c_count}
2064 {\the\d_count}
2065 {}{}
2066 }
2067 \fi
2068 }
2069 %</pkg>
2070 % \end{macrocode}
2071 % \begin{macrocode}
2072 %<*doc>
2073 \newcommand\setnotglyph[8]{%
2074 \Aheading{Pseudoglyph `\typeset@glyph{#1-not}'}%
2075 }
2076 \newcommand\setscalednotglyph[9]{%
2077 \setnotglyph{#1}{#2}{#3}{#5}{#6}{#7}{#8}{#9}%
2078 }
2079 %</doc>
2080 %<misc>\let\setnotglyph=\setrawglyph
2081 %<misc>\let\setscalednotglyph=\setscaledrawglyph
2082 % \end{macrocode}
2083 % \end{macro}\end{macro}
2084 %
2085 % \begin{macro}{\unsetglyph}
2086 % The |\unsetglyph|\marg{name} command makes |\g-|\meta{name}
2087 % undefined.
2088 %
2089 % \begin{macrocode}
2090 %<pkg>\def\unsetglyph#1{\x_cs\let{g-#1}\x_relax}
2091 %<doc>\newcommand\unsetglyph[1]{%
2092 %<doc> \Aheading{Unset glyph `\typeset@glyph{#1}'}}
2093 % \end{macrocode}
2094 % \end{macro}
2095 %
2096 %
2097 % \subsection{Glyph commands}
2098 %
2099 % The \meta{glyph commands} are:
2100 % \changes{1.908}{1999/08/22}{Glyph commands avoid \cs{edef}ing old
2101 % contents of \cs{glyph_map_commands} and \cs{glyph_map_fonts}. (LH)}
2102 % \begin{macro}{\glyph}
2103 % |\glyph|\marg{glyph}\marg{scale}
2104 % \changes{1.900}{1999/02/08}{Avoids scaling by 1000. (LH)}
2105 %
2106 % \begin{macrocode}
2107 %<*pkg>
2108 \def\glyph#1#2{
2109 \glyph_parameter\glyph_metrics{#1}
2110 \eval_expr_to\e_count{#2}
2111 \ifnum \e_count=\one_thousand
2112 \edef\a_macro{\mapcommands{#1}}
2113 \global\glyph_map_commands\expandafter{
2114 \the\expandafter\glyph_map_commands \a_macro
2115 }
2116 \edef\a_macro{\mapfonts{#1}}
2117 \else
2118 \multiply \a_count \e_count \l_rounded_thousandths\a_count
2119 \multiply \b_count \e_count \l_rounded_thousandths\b_count
2120 \multiply \c_count \e_count \l_rounded_thousandths\c_count
2121 \multiply \d_count \e_count \l_rounded_thousandths\d_count
2122 \edef\a_macro{\saved_scale{\the\e_count}{\mapcommands{#1}}}
2123 \global\glyph_map_commands\expandafter{
2124 \the\expandafter\glyph_map_commands \a_macro
2125 }
2126 \edef\a_macro{\saved_scale{\the\e_count}{\mapfonts{#1}}}
2127 \fi
2128 \advance \glyph_width \a_count
2129 \advance \b_count \glyph_voffset
2130 \ifnum \glyph_height<\b_count \global\glyph_height=\b_count \fi
2131 \advance \c_count -\glyph_voffset
2132 \ifnum \glyph_depth<\c_count \global\glyph_depth=\c_count \fi
2133 \global\glyph_italic=\d_count
2134 \global\glyph_map_fonts\expandafter{
2135 \the\expandafter\glyph_map_fonts \a_macro
2136 }
2137 }
2138 %</pkg>
2139 % \end{macrocode}
2140 % \begin{macrocode}
2141 %<*doc>
2142 \newcommand\glyph[2]{%
2143 \Bheading{Glyph} `\typeset@glyph{#1}' \ConditionallyScaled{#2}%
2144 }
2145 %</doc>
2146 % \end{macrocode}
2147 % \end{macro}
2148 %
2149 % \begin{macro}{\glyphrule}
2150 % |\glyphrule|\marg{width}\marg{height}
2151 %
2152 % \begin{macrocode}
2153 %<*pkg>
2154 \def\glyphrule#1#2{
2155 \eval_expr_to\b_count{#1} \eval_expr_to\c_count{#2}
2156 \advance\glyph_width by \b_count
2157 \g_eval_expr_to\glyph_depth{\max\glyph_depth{-\glyph_voffset}}
2158 \g_eval_expr_to\glyph_height{
2159 \max\glyph_height{\add\glyph_voffset\c_count}
2160 }
2161 \global\glyph_italic=0
2162 \edef\a_macro{\saved_rule{\the\b_count}{\the\c_count}}
2163 \global\glyph_map_commands\expandafter{
2164 \the\expandafter\glyph_map_commands \a_macro
2165 }
2166 }
2167 %</pkg>
2168 % \end{macrocode}
2169 % \begin{macrocode}
2170 %<*doc>
2171 \newcommand\glyphrule[2]{%
2172 \Bheading{Rule} $\TypesetIntegerExpression{#1}$ by
2173 $\TypesetIntegerExpression{#2}$%
2174 }
2175 %</doc>
2176 % \end{macrocode}
2177 % \end{macro}
2178 %
2179 % \begin{macro}{\glyphspecial}
2180 % \begin{macro}{\glyphwarning}
2181 % |\glyphspecial|\marg{string}\\
2182 % |\glyphwarning|\marg{string}
2183 %
2184 % \begin{macrocode}
2185 %<*pkg>
2186 \def\glyphspecial#1{
2187 \edef\a_macro{\saved_special{#1}}
2188 \global\glyph_map_commands\expandafter{
2189 \the\expandafter\glyph_map_commands \a_macro
2190 }
2191 }
2192 \def\glyphwarning#1{
2193 \edef\a_macro{\saved_warning{#1}}
2194 \global\glyph_map_commands\expandafter{
2195 \the\expandafter\glyph_map_commands \a_macro
2196 }
2197 }
2198 %</pkg>
2199 % \end{macrocode}
2200 % \begin{macrocode}
2201 %<*doc>
2202 \newcommand\glyphspecial[1]{%
2203 \Bheading{Special} `\TypesetStringExpression{#1}'}
2204 \newcommand\glyphwarning[1]{%
2205 \Bheading{Warning} `\TypesetStringExpression{#1}'}
2206 %</doc>
2207 % \end{macrocode}
2208 % \end{macro}
2209 % \end{macro}
2210 %
2211 % \begin{macro}{\movert}
2212 % \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)}
2213 % \begin{macro}{\moveup}
2214 % |\movert|\marg{xoffset}\\
2215 % |\moveup|\marg{yoffset}
2216 %
2217 % \begin{macrocode}
2218 %<*pkg>
2219 \def\movert#1{
2220 \eval_expr{#1}
2221 \ifnum \glyph_maxhpos<\glyph_width
2222 \global\glyph_maxhpos\glyph_width
2223 \fi
2224 \ifnum 0=\result \else
2225 \advance\glyph_width by \result
2226 \edef\a_macro{\saved_movert{\the\result}}
2227 \global\glyph_map_commands\expandafter{
2228 \the\expandafter\glyph_map_commands \a_macro
2229 }
2230 \fi
2231 }
2232 % \end{macrocode}
2233 % \begin{macrocode}
2234 \def\moveup#1{
2235 \eval_expr{#1}
2236 \ifnum\result=0\else
2237 \advance\glyph_voffset by \result
2238 \edef\a_macro{\saved_moveup{\the\result}}
2239 \global\glyph_map_commands\expandafter{
2240 \the\expandafter\glyph_map_commands \a_macro
2241 }
2242 \fi
2243 }
2244 %</pkg>
2245 % \end{macrocode}
2246 % \begin{macrocode}
2247 %<*doc>
2248 \newcommand\movert[1]{\Bheading{Rt}~$\TypesetIntegerExpression{#1}$}
2249 \newcommand\moveup[1]{\Bheading{Up}~$\TypesetIntegerExpression{#1}$}
2250 %</doc>
2251 % \end{macrocode}
2252 % \end{macro}
2253 % \end{macro}
2254 %
2255 % \begin{macro}{\push}
2256 % \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)}
2257 % \begin{macro}{\pop}
2258 % \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)}
2259 % \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)}
2260 % \begin{macrocode}
2261 %<*pkg>
2262 \def\push{
2263 \bgroup
2264 \global\glyph_map_commands\expandafter{
2265 \the\glyph_map_commands \saved_push
2266 }
2267 }
2268 % \end{macrocode}
2269 % \begin{macrocode}
2270 \def\pop{
2271 \ifnum \glyph_maxhpos<\glyph_width
2272 \global\glyph_maxhpos\glyph_width
2273 \fi
2274 \egroup
2275 \global\glyph_map_commands\expandafter{
2276 \the\glyph_map_commands \saved_pop
2277 }
2278 }
2279 %</pkg>
2280 % \end{macrocode}
2281 % \begin{macrocode}
2282 %<*doc>
2283 \newcommand\push{\Bheading{Push}}
2284 \newcommand\pop{\Bheading{Pop}}
2285 %</doc>
2286 % \end{macrocode}
2287 % \end{macro}
2288 % \end{macro}
2289 %
2290 % \begin{macro}{\resetwidth}
2291 % \begin{macro}{\resetheight}
2292 % \begin{macro}{\resetdepth}
2293 % \begin{macro}{\resetitalic}
2294 % |\resetwidth|\marg{width}\\
2295 % |\resetheight|\marg{height}\\
2296 % |\resetdepth|\marg{depth}\\
2297 % |\resetitalic|\marg{italic}
2298 %
2299 % \begin{macrocode}
2300 %<*pkg>
2301 \def\resetwidth#1{\movert{\sub{#1}\glyph_width}}
2302 \def\resetheight{\g_eval_expr_to\glyph_height}
2303 \def\resetdepth{\g_eval_expr_to\glyph_depth}
2304 \def\resetitalic{\g_eval_expr_to\glyph_italic}
2305 %</pkg>
2306 % \end{macrocode}
2307 % \begin{macrocode}
2308 %<*doc>
2309 \newcommand\resetwidth[1]{%
2310 \Bheading{Reset width to $\TypesetIntegerExpression{#1}$}%
2311 }
2312 \newcommand\resetheight[1]{%
2313 \Bheading{Reset height to $\TypesetIntegerExpression{#1}$}%
2314 }
2315 \newcommand\resetdepth[1]{%
2316 \Bheading{Reset depth to $\TypesetIntegerExpression{#1}$}%
2317 }
2318 \newcommand\resetitalic[1]{%
2319 \Bheading{Reset italic to $\TypesetIntegerExpression{#1}$}%
2320 }
2321 %</doc>
2322 % \end{macrocode}
2323 % \end{macro}
2324 % \end{macro}
2325 % \end{macro}
2326 % \end{macro}
2327 %
2328 % \begin{macro}{\glyphpcc}
2329 % Some syntactic sugar: |\glyphpcc| could do with optimization.
2330 % \begin{quote}
2331 % |\glyphpcc|\marg{glyph}\marg{xoffset}\marg{yoffset}
2332 % \end{quote}
2333 % \changes{1.925}{2003/05/28}{Added check that the glyph used is
2334 % defined; we get an ugly error if it isn't. (LH)}
2335 % \changes{1.932}{2005/06/17}{Changed error message to warning when a
2336 % corresponding notglyph exists. (LH) This deals with an issue
2337 % regarding composites in fonts which have been reencoded to
2338 % something not a superset of \texttt{8a}.}
2339 %
2340 % \begin{macrocode}
2341 %<*pkg>
2342 \def\glyphpcc#1#2#3{
2343 \ifisglyph{\glyph_name_modifier{#1}}\then
2344 \push
2345 \movert{#2}
2346 \moveup{#3}
2347 \glyph{\glyph_name_modifier{#1}}{\one_thousand}
2348 \pop
2349 \else\ifisglyph{\glyph_name_modifier{#1}-not}\then
2350 \fontinstwarning{\string\glyphpcc}{
2351 Base~glyph~`\glyph_name_modifier{#1}'~not~appended,\messagebreak
2352 because~it~is~so~far~unencoded~in~the~glyph~base
2353 }
2354 \else
2355 \fontinsterror{\string\glyphpcc}{
2356 Base~glyph~not~set.\messagebreak
2357 This~could~be~a~sign~that~the~AFM~file~is~buggy
2358 }\error_help_a
2359 \fi\fi
2360 }
2361 %</pkg>
2362 % \end{macrocode}
2363 % \begin{macrocode}
2364 %<*doc>
2365 \def\glyphpcc#1#2#3{
2366 \push
2367 \movert{#2}
2368 \moveup{#3}
2369 \glyph{#1}{1000}
2370 \pop
2371 }
2372 %</doc>
2373 % \end{macrocode}
2374 % \end{macro}
2375 %
2376 % \begin{macro}{\glyphbboxright}
2377 % \changes{1.903}{1999/05/20}{Macro added. (LH)}
2378 % The |\glyphbboxright| command is a valid integer expression, but
2379 % its value is only meaningful inside a |\setglyph| \textellipsis\
2380 % |\endsetglyph| or |\resetglyph| \textellipsis\ |\endresetglyph|
2381 % structure. There its value is almost the horizontal position of
2382 % the right edge of the bounding box for the glyph constructed so
2383 % far---in reality it is the greatest horizontal offset reached so
2384 % far.
2385 %
2386 % \begin{macrocode}
2387 %<pkg>\def\glyphbboxright{\max\glyph_width\glyph_maxhpos}
2388 %<*doc>
2389 \DeclareRobustCommand\glyphbboxright{%
2390 \gdef\FD@expression{\protect\mathrm{glyphbboxright}}
2391 \global\chardef\FD@priority=\tw@
2392 \global\FD@bracket@level=\z@
2393 \FD@evaluate@false
2394 }
2395 %</doc>
2396 % \end{macrocode}
2397 % \end{macro}
2398 %
2399 % \begin{macro}{\samesize}
2400 % \changes{1.903}{1999/05/20}{Added behaviour for nonexistent glyph
2401 % (based on a suggestion from Hilmar Schlegel) and fixed typo in
2402 % \package{fontdoc}. (LH)}
2403 % |\samesize|\marg{glyph}
2404 %
2405 % \begin{macrocode}
2406 %<*pkg>
2407 \def\samesize#1{
2408 \if_undefined{g-\glyph_name_modifier{#1}}\then
2409 \resetwidth{\glyphbboxright}
2410 \else
2411 \expandafter\expandafter\expandafter
2412 \same_size\csname g-\glyph_name_modifier{#1}\endcsname
2413 \fi
2414 }
2415 \def\same_size#1#2#3#4#5#6{
2416 \movert{\sub{#1}\glyph_width}
2417 \global\glyph_height=#2
2418 \global\glyph_depth=#3
2419 \global\glyph_italic=#4
2420 }
2421 %</pkg>
2422 % \end{macrocode}
2423 % \begin{macrocode}
2424 %<*doc>
2425 \newcommand\samesize[1]{%
2426 \Bheading{Reset dimensions to those of `\typeset@glyph{#1}'.}%
2427 }
2428 %</doc>
2429 % \end{macrocode}
2430 % \end{macro}
2431 %
2432 % \begin{macro}{\ifisglyph}
2433 % The control flow command:
2434 % \changes{1.923}{2002/10/20}{Using \cs{if_defined}. (LH)}
2435 % \begin{macrocode}
2436 %<pkg>\def\ifisglyph#1\then{\if_defined{g-#1}\then}
2437 % \end{macrocode}
2438 % \changes{1.911}{1999/11/30}{\protect\protect\protect\Module{misc}
2439 % definition added. (LH)}
2440 % |\ifisglyph| evaluates to false in \Module{misc}, since this avoids
2441 % uses of various metric integer expressions (such as |\width|,
2442 % |\height|, etc.) that are not defined there.
2443 % \begin{macrocode}
2444 %<doc>\def\ifisglyph#1\then{\generic@if{glyph \typeset@glyph{#1} set}}
2445 %<misc>\def\ifisglyph#1\then{\iffalse}
2446 % \end{macrocode}
2447 % \end{macro}
2448 %
2449 % \begin{macro}{\ifareglyphs}
2450 % \changes{1.917}{2001/03/17}{Macro added. (LH)}
2451 % The |\ifareglyphs| command test if all glyphs in a comma-separeted
2452 % list of glyphs are set. The syntax is
2453 % \begin{quote}
2454 % |\ifareglyphs|\marg{glyph list}|\then|
2455 % \end{quote}
2456 % The implementation relies on that |\if_true| and |\if_false| do not
2457 % count when \TeX\ is skipping text that is balanced with respect to
2458 % |\if|s and |\fi|s.
2459 % \begin{macrocode}
2460 %<*pkg>
2461 \def\ifareglyphs#1\then{
2462 \process_csep_list{\if_is_glyph}#1,\process_csep_list,
2463 \if_true
2464 }
2465 \def\if_is_glyph#1{
2466 \if_undefined{g-#1}\then \expandafter\if_false \fi
2467 }
2468 %</pkg>
2469 %<misc>\let\ifareglyphs=\ifisglyph
2470 %<*doc>
2471 \def\ifareglyphs#1\then{%
2472 \generic@if{all glyphs in \FD@typeset@string@set{#1} are set}%
2473 }
2474 %</doc>
2475 % \end{macrocode}
2476 % \end{macro}
2477 %
2478 %
2479 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2480 %
2481 % \section{Converting an ETX file to a (V)PL file}
2482 %
2483 % \subsection{Lowest-level user interface}
2484 %
2485 % \DescribeMacro{\etxtovpl}
2486 % The macro:
2487 % \begin{quote}
2488 % |\etxtovpl|\marg{encoding list}\marg{vplfile}
2489 % \end{quote}
2490 % writes a virtual font (as a virtual property list) with the
2491 % encoding specified by the items in the \meta{encoding list},
2492 % which typically are names of ETX files.
2493 % (This macro is called by |\installfont|.)
2494 %
2495 % \DescribeMacro{\etxtopl}
2496 % The macro:
2497 % \begin{quote}
2498 % |\etxtopl|\marg{encoding list}\marg{plfile}
2499 % \end{quote}
2500 % writes a font (as a property list) with the encoding
2501 % specified by the items in the \meta{encoding list},
2502 % which typically are names of ETX files.
2503 % (This macro is called by |\installrawfont|.)
2504 %
2505 % \multchanges{\cs{etxtovpl}\cs{etxtopl}}{1.923}{2002/10/24}{The
2506 % first argument of these macros is now a comma-separated list
2507 % of ETX files, and the items may be subjected to modifier
2508 % clauses. (LH)}
2509 %
2510 % \begin{macro}{\etxtovpl}
2511 % \changes{1.923}{2002/10/25}{The program is called \texttt{vptovf},
2512 % not \texttt{vpltovf}. (LH)}
2513 % \begin{macro}{\etxtopl}
2514 % \begin{macrocode}
2515 %<*pkg>
2516 \def\etxtovpl#1#2{{
2517 \def\vpl_extension{vpl}
2518 \def\vpl_title{COMMENT}
2519 \def\vpl_font{virtual~font}
2520 \def\vpl_Font{Virtual~font}
2521 \def\vpl_call{\string\etxtovpl{#1}{#2}}
2522 \def\vpl_to_vf##1{vptovf~##1.vpl~##1.vf~##1.tfm}
2523 \a_toks={}
2524 \process_csep_list\make_inputetx #1,\process_csep_list,
2525 \expandafter\etx_to_font \expandafter{\the\a_toks}{#2}
2526 }}
2527 \def\etxtopl#1#2{{
2528 \def\vpl_extension{pl}
2529 \def\vpl_title{COMMENT}
2530 \def\vpl_font{font}
2531 \def\vpl_Font{Font}
2532 \def\vpl_call{\string\etxtopl{#1}{#2}}
2533 \def\vpl_to_vf##1{pltotf~##1.pl~##1.tfm}
2534 \_including_map_false
2535 \global\rawfont_scaling=-\p@
2536 \a_toks={}
2537 \process_csep_list\make_inputetx #1,\process_csep_list,
2538 \expandafter\etx_to_font \expandafter{\the\a_toks}{#2}
2539 }}
2540 % \end{macrocode}
2541 % \end{macro}
2542 % \end{macro}
2543 %
2544 % \begin{switch}{_including_map_}
2545 % \changes{1.900}{1998/10/02}{New switch that can inhibit writing of
2546 % VPL-specific properties. (LH)}
2547 % The v\,1.5 method of controlling whether \texttt{MAP} and
2548 % \texttt{MAPFONT} properties should be written requires that some
2549 % code is put in an awkward place (in |\make_mapfonts| rather than
2550 % |\make_characters|). As the code was being reorganised anyway, it
2551 % seemed best to let a switch control this instead. If
2552 % |\if_including_map_| is true, \texttt{MAP} and \texttt{MAPFONT}
2553 % properties are written to the file (which should be a VPL), if it is
2554 % false then they are not written to the file (which is then a normal
2555 % PL).
2556 % \begin{macrocode}
2557 \newif\if_including_map_
2558 \_including_map_true
2559 % \end{macrocode}
2560 % \end{switch}
2561 %
2562 % \begin{macro}{\make_inputetx}
2563 % The |\make_inputetx| macro takes a single argument that should have
2564 % the form
2565 % \begin{quote}
2566 % \meta{file name root}\meta{optional modifiers}
2567 % \end{quote}
2568 % as explained in the comments to |\input_mtx_file|. The effect of
2569 % this macro is to append some commands (usually
2570 % |\inputetx|\marg{file name root}) to |\a_toks|. This may however
2571 % change if some clause in the \meta{optional modifiers} redefines
2572 % |\a_macro|.
2573 % \changes{1.923}{2002/10/24}{Macro added. (LH)}
2574 % \begin{macrocode}
2575 \def\make_inputetx#1{
2576 \def\a_macro{\noexpand\inputetx{\file_name}}
2577 \get_file_name #1~{}~\par
2578 \edef\a_macro{\a_macro}
2579 \a_toks=\expandafter{ \the\expandafter\a_toks \a_macro}
2580 }
2581 % \end{macrocode}
2582 % \end{macro}
2583 %
2584 % \begin{macro}{\IFKW-mtxasetx}
2585 % The \texttt{mtxasetx} modifier clause causes the \meta{encoding
2586 % list} item in question to be input using |\input_mtx_as_etx| rather
2587 % than |\inputetx|. This makes it possible to use the |\setrawglyph|
2588 % and |\setscaledrawglyph| commands in an MTX file as a poor
2589 % substitute for a proper ETX file. This is sometimes useful for
2590 % making proofs.
2591 % \changes{1.923}{2002/10/24}{Macro added. (LH)}
2592 % \begin{macrocode}
2593 \x_cs\def{IFKW-mtxasetx}{
2594 \def\a_macro{\noexpand\input_mtx_as_etx{\file_name}}
2595 \get_keyword
2596 }
2597 % \end{macrocode}
2598 % \end{macro}
2599 %
2600 %
2601 % \begin{macro}{\etx_to_font}
2602 % |\etx_to_font|\marg{encoding commands}\marg{fontfile} makes
2603 % a (V)PL file whose encoding is specified by the \meta{encoding
2604 % commands}. These are usually just one or a few |\inputetx|
2605 % commands, as the specification of an encoding usually requires much
2606 % more code than is convenient to provide as an argument.
2607 % \changes{1.923}{2002/10/24}{Made the first argument a list of
2608 % commands. Renamed \cs{vpl_caller} to \cs{vpl_call}; it is now
2609 % assumed to contain the arguments as well. (LH)}
2610 % \begin{macrocode}
2611 \def\etx_to_font#1#2{
2612 \make_assignments{#1}
2613 \open_out{#2.\vpl_extension}
2614 \top_of_pl_hook
2615 \out_line{(\vpl_title\space\vpl_font\space
2616 #2~created~by~fontinst~v\fontinstversion)}
2617 \out_line{}
2618 \out_line{(COMMENT~Filename:~#2.\vpl_extension)}
2619 \out_line{(COMMENT~Created~by:~tex~\jobname)}
2620 \out_line{(COMMENT~Created~using:~\vpl_call)}
2621 \out_line{}
2622 \out_line{(COMMENT~This~file~can~be~turned~into~a~\vpl_font\space
2623 with)}
2624 \out_line{(COMMENT~\vpl_to_vf{#2})}
2625 \out_line{}
2626 \out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)}
2627 \out_line{}
2628 \make_header{#1}
2629 \if_including_map_ \make_mapfonts{#1} \fi
2630 \make_fontdimens{#1}
2631 \make_ligtable{#1}
2632 \make_characters{#1}
2633 \make_tidy{#1}
2634 \out_line{}
2635 \out_line{(COMMENT~END~OF~FILE~#2.\vpl_extension)}
2636 \close_out{\vpl_Font}
2637 }
2638 % \end{macrocode}
2639 % \end{macro}
2640 %
2641 %
2642 % \begin{macro}{\pre_first_etx_pass_hook}
2643 % \begin{macro}{\pre_second_etx_pass_hook}
2644 % \begin{macro}{\pre_third_etx_pass_hook}
2645 % \begin{macro}{\pre_fourth_etx_pass_hook}
2646 % \begin{macro}{\post_first_etx_pass_hook}
2647 % \begin{macro}{\post_second_etx_pass_hook}
2648 % \begin{macro}{\post_third_etx_pass_hook}
2649 % \begin{macro}{\post_fourth_etx_pass_hook}
2650 % \begin{macro}{\tidying_up_hook}
2651 % \multchanges{\cs{pre_first_etx_pass_hook}^^A
2652 % \cs{pre_second_etx_pass_hook}\cs{pre_third_etx_pass_hook}^^A
2653 % \cs{pre_fourth_etx_pass_hook}\cs{post_first_etx_pass_hook}^^A
2654 % \cs{post_second_etx_pass_hook}\cs{post_third_etx_pass_hook}^^A
2655 % \cs{post_fourth_etx_pass_hook}\cs{tidying_up_hook}}{1.900}^^A
2656 % {1998/09/30}{ETX-to-VPL hooks added. (LH)}
2657 % \begin{macro}{\top_of_pl_hook}
2658 % \changes{1.912}{2000/01/29}{Property list hook added. (LH)}
2659 % As the |\etxtovpl| and |\etxtopl| macros are the
2660 % lowest-level interfaces to what they do that are available in
2661 % \package{fontinst} and as the amount of code they execute is really
2662 % quite large, I suspect that users may occationally have need of
2663 % some robust mechanism for inserting extra code at well specified
2664 % positions. Such a mechanism is provided by the following hooks:
2665 % \begin{macrocode}
2666 \let\pre_first_etx_pass_hook\x_relax
2667 \let\pre_second_etx_pass_hook\x_relax
2668 \let\pre_third_etx_pass_hook\x_relax
2669 \let\pre_fourth_etx_pass_hook\x_relax
2670 \let\post_first_etx_pass_hook\x_relax
2671 \let\post_second_etx_pass_hook\x_relax
2672 \let\post_third_etx_pass_hook\x_relax
2673 \let\post_fourth_etx_pass_hook\x_relax
2674 \let\tidying_up_hook\x_relax
2675 \let\top_of_pl_hook\x_relax
2676 % \end{macrocode}
2677 % The first nine are executed at the positions of the ETX-to-VPL
2678 % file generation that their name indicate. |\top_of_pl_hook| is
2679 % slightly different---it is executed right after a PL or VPL file
2680 % is opened for writing. Thus it is also used by the MTX-to-PL system.
2681 %
2682 % To include code in one of them, one should write things like
2683 % \begin{quote}
2684 % |\add_to\pre_first_etx_pass_hook|\marg{extra code}
2685 % \end{quote}
2686 % I (LH) have the following in my \texttt{fontinst.rc} file\relax
2687 % \SortIndex{fontinst.rc file}{\texttt{fontinst.rc} file}
2688 % \begin{quote}
2689 % |\add_to\top_of_pl_hook{\out_line{(COMMENT~-*-Text-*-)}}|
2690 % \end{quote}
2691 % Without it, my text editor annoys me by assuming that \texttt{.pl}
2692 % stands for Perl.
2693 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
2694 % \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
2695 %
2696 %
2697 % \subsection{Glyph to slot assignments}
2698 %
2699 % \changes{1.900}{1998/12/06}{New method of storing slot assignments.
2700 % (LH)}
2701 % The way \package{fontinst} has traditionally kept track
2702 % of which glyph goes to which slot---information which is needed when
2703 % writing the |LIGTABLE| in a (V)PL, for |\nextlarger|, and for the
2704 % varchar commands---is by storing the slot number in the integer
2705 % whose name is the name of the glyph. There are two main problems with
2706 % this implementation: (i)~If a user sets an integer which happens to
2707 % have the same name as a glyph that is not assigned to any slot, then
2708 % kerns for that unused glyph might be written to the file, accidentally
2709 % creating a kerning pair where there should be none. (ii)~It is only
2710 % possible to store one slot number per glyph, so if one uses the same
2711 % glyph for several slots then \package{fontinst} can only write kerns
2712 % (and ligatures) for one of the occurences, despite the fact that all
2713 % occurences have the same typographical need for them. These problems
2714 % do only occur for glyphs on the right side of a ligature/kerning
2715 % pair, but they are still serious enough. This part of
2716 % \package{fontinst} has therefore been reimplemented.
2717 %
2718 % \changes{1.910}{1999/11/04}{Changed the way slot numbers are stored
2719 % in \cs{slots-}\meta{glyph} control sequences. (LH)}
2720 % The new implementation does not use integers, instead it uses a new
2721 % family of macros with names on the form |\slots-|\meta{glyph}^^A
2722 % \describecsfamily{slots-\meta{glyph}}. These macros expand to
2723 % sequences of |\do|\thinspace\meta{character}, where \meta{character}
2724 % is a category 12 (other) token whose character code equals the slot
2725 % number.
2726 %
2727 % In the entire space of such names, each slot should be mentioned
2728 % at most once, with one exception, namely the slot which serves as
2729 % right boundary marker, which may occur twice (once for the glyph
2730 % which actually is assigned to the slot and once for the right boundary
2731 % marker glyph). To detect whether there is a collision between these two
2732 % uses of the slot, the right boundary marker glyph uses |\rboundary_do|
2733 % instead of |\do| and the glyph whose slot serves as boundarychar uses
2734 % |\rbserver_do| instead of |\do|. By redefining these two control
2735 % sequences to generate a warning message when appropriate, the occurence
2736 % of such a collision can be brought to the user's attention.
2737 %
2738 % \changes{1.900}{1998/12/11}{Added compability code for the old
2739 % interface for boundary ligatures and kerns. (LH)}
2740 % As it turned out to not be such a big deal, some extra code (protected
2741 % by a \package{docstrip} switch called \Module{boundaryCompability})
2742 % that makes \package{fontinst} compatible with the previous syntax for
2743 % boundary handling has been included. I don't recommend using
2744 % it though, since it makes \package{fontinst} store almost all slot
2745 % numbers in two places.
2746 %
2747 %
2748 % \begin{macro}{\make_assignments}
2749 % \begin{macrocode}
2750 \def\make_assignments#1{
2751 \let\do_slot=\assign_slot
2752 \let\end_do_slot=\end_assign_slot
2753 \def\do_boundary{\bgroup
2754 \let\makerightboundary=\bad_makerightboundary
2755 }
2756 \let\endsetleftboundary=\egroup
2757 \let\makerightboundary=\assign_rboundary
2758 \pre_first_etx_pass_hook
2759 #1
2760 \post_first_etx_pass_hook
2761 \let\end_do_slot=\empty_command
2762 \let\do_boundary=\x_relax
2763 \let\endsetleftboundary=\x_relax
2764 \let\makerightboundary=\gobble_one
2765 }
2766 % \end{macrocode}
2767 % \end{macro}
2768 %
2769 %
2770 % \begin{macro}{\assign_slot}
2771 % \begin{macro}{\end_assign_slot}
2772 % \changes{1.907}{1999/08/20}{Slots are not assigned to glyphs that
2773 % do not exist. (LH)}
2774 % |\assign_slot| begins the assignment of a slot to a glyph.
2775 % |\end_assign_slot| completes it. In the time between these two,
2776 % some information is stored in |\a_toks|, so that it can be
2777 % modified by an intervening |\makerightboundary| (which is then
2778 % |\assign_rboundary|).
2779 %
2780 % Note that the code below will not reset |\lccode0|. The value of
2781 % this register should be considered uncertain while a ligful PL
2782 % or VPL file is written, i.e., in ETX files.
2783 % \SortIndex{lccode0}{\cs{lccode\,0} register\encapchar usage}
2784 % \begin{macrocode}
2785 \def\assign_slot{\a_toks={\do}}
2786 \begingroup
2787 \catcode0=12
2788 \gdef\end_assign_slot{
2789 \ifisglyph\slot_name\then
2790 \lccode0=\slot_number
2791 \lowercase{
2792 \expandafter\add_to
2793 \csname slots-\slot_name\expandafter\endcsname
2794 \expandafter{\the\a_toks^^@}
2795 }
2796 %<boundaryCompability> \x_resetint\slot_name\slot_number
2797 \fi
2798 }
2799 % \end{macrocode}
2800 % \end{macro}\end{macro}
2801 %
2802 %
2803 % \begin{macro}{\assign_rboundary}
2804 % \begin{macro}{\bad_makerightboundary}
2805 % |\assign_rboundary| is what |\makerightboundary| is when it is
2806 % assigning a slot to act as right boundary marker.
2807 %
2808 % |\bad_makerightboundary| is what |\makerightboundary| temporarily
2809 % gets set to between |\setleftboundary| and |\endsetleftboundary|.
2810 % \begin{macrocode}
2811 \gdef\assign_rboundary#1{
2812 \lccode0=\slot_number
2813 \lowercase{\x_cs\add_to{slots-#1}{\rboundary_do^^@}}
2814 \x_setint{\percent_char boundarychar}\slot_number
2815 \a_toks={\rbserver_do}
2816 }
2817 \endgroup
2818 \def\bad_makerightboundary#1{
2819 \errhelp={The~left~boundary~is~not~a~slot,~so~it~cannot~serve~
2820 as~right~boundary.}
2821 \errmessage{Incorrect~use~of~\string\makerightboundary}
2822 }
2823 % \end{macrocode}
2824 % \end{macro} \end{macro}
2825 %
2826 % \begin{macro}{\get_slot_num}
2827 % \changes{1.910}{1999/11/04}{Removed redefinition of \cs{do} to
2828 % \cs{gobble_one} from temporary definition of \cs{do}, since a
2829 % \cs{slots-} list usually contains only one or two elements
2830 % anyway. (LH)}
2831 % It is sometimes necessary to get the number of an arbitrary slot
2832 % given only the name of the glyph which has been assigned to the
2833 % slot. In such situations, the call
2834 % \begin{quote}
2835 % |\get_slot_num{|\meta{glyph}|}|
2836 % \end{quote}
2837 % will set |\result| to the number of one such slot if the glyph has
2838 % been assigned to some slot, or set |\result| to minus one if the glyph
2839 % has not been assigned to a slot.
2840 % \begin{macrocode}
2841 \def\get_slot_num#1{
2842 %<*!boundaryCompability>
2843 \global\result=-1
2844 \bgroup
2845 \def\do{\global\result=`}
2846 \let\rbserver_do=\do
2847 \let\rboundary_do=\gobble_one
2848 \csname slots-#1\endcsname
2849 \egroup
2850 %</!boundaryCompability>
2851 %<*boundaryCompability>
2852 \ifisint{#1}\then
2853 \global\result=\int{#1}
2854 \else
2855 \global\result=-1
2856 \fi
2857 \x_relax
2858 %</boundaryCompability>
2859 }
2860 % \end{macrocode}
2861 % \end{macro}
2862 %
2863 %
2864 % \begin{macro}{\ifisinslot}
2865 % The call |\ifisinslot|\marg{glyph}\marg{slot}|\then| can be used to
2866 % test whether glyph \meta{glyph} has been assigned to slot \meta{slot}.
2867 % Both then-part and else-part of the conditional will however be
2868 % ignored when the ETX file is read the first time, since the
2869 % assignment of glyph to slots need not have been completed yet.
2870 % \begin{macrocode}
2871 \def\ifisinslot#1#2\then{
2872 \ifx \makerightboundary\gobble_one
2873 % \end{macrocode}
2874 % This is used to test if the ETX file is being read in for the first
2875 % time. It is a bit hacky, but it is efficient.
2876 % \begin{macrocode}
2877 \eval_expr{#2}
2878 \begingroup
2879 \def\do##1{\ifnum `##1=\result \let\do=\gobble_one \fi}
2880 \def\rbserver_do{\do}
2881 \let\rboundary_do=\gobble_one
2882 \csname slots-#1\endcsname
2883 \expandafter\endgroup
2884 \ifx \do\gobble_one
2885 \expandafter\expandafter \expandafter\if_true
2886 \else
2887 \expandafter\expandafter \expandafter\if_false
2888 \fi
2889 \else
2890 \expandafter\gobble_if
2891 \fi
2892 }
2893 %</pkg>
2894 % \end{macrocode}
2895 % \begin{macrocode}
2896 %<*doc>
2897 \def\ifisinslot#1#2\then{%
2898 \generic@if{glyph \typeset@glyph{#1} assigned to slot
2899 $\TypesetIntegerExpression{#2}$}%
2900 }
2901 %</doc>
2902 % \end{macrocode}
2903 % \end{macro}
2904 %
2905 %
2906 % \subsection{The header, mapfonts, and fontdimens}
2907 %
2908 % \changes{1.913}{2000/02/26}{Using \cs{make_factor} for making PL
2909 % reals, rather than \cs{afm_convert}+\cs{vpl_real}.
2910 % \cs{scaled_design_size} replaced by new dimen \cs{mapfont_scaling} for
2911 % determining mapfont atsize. (LH)}
2912 %
2913 % \begin{macro}{\mapfont_scaling}
2914 % The |\mapfont_scaling| dimen is used for calculating how much a mapfont
2915 % has been scaled, for use in \texttt{FONTAT} properties, and for
2916 % selecting the correct mapfont. It is initialized to $1$.
2917 % \begin{macrocode}
2918 %<*pkg>
2919 \newdimen\mapfont_scaling
2920 \mapfont_scaling=1pt
2921 % \end{macrocode}
2922 % \end{macro}
2923 %
2924 % \begin{macro}{\rawfont_scaling}
2925 % The |\rawfont_scaling| dimen is used for communicating the scaling
2926 % that has been applied to a raw font---a font being installed using
2927 % |\install|\-|rawfont|\penalty0---out to that macro. |\rawfont_|\-^^A
2928 % |scaling| should always be globally assigned.
2929 % \changes{1.913}{2000/03/21}{Dimen added. (LH)}
2930 % \begin{macrocode}
2931 \newdimen\rawfont_scaling
2932 % \end{macrocode}
2933 % \end{macro}
2934 %
2935 % \begin{macro}{\scaled_design_size}
2936 % \begin{macro}{\afm_convert}
2937 % The call
2938 % \begin{quote}
2939 % |\afm_convert|\meta{dimen}|=|\meta{integer expression}|;|
2940 % \end{quote}
2941 % converts a count into a dimen, assuming the count is a number
2942 % of AFM units. I'll assume that the largest dimension I'll have
2943 % to deal with is 131\,pt, to try to minimize rounding errors.
2944 %
2945 % \begin{macrocode}
2946 % \newdimen\scaled_design_size
2947 % \end{macrocode}
2948 % \begin{macrocode}
2949 % \def\afm_convert#1=#2;{
2950 % \eval_expr{#2}
2951 % #1=\scaled_design_size
2952 % \divide#1 by 8
2953 % \multiply #1 by \result
2954 % \divide #1 by \one_thousand
2955 % \multiply#1 by 8
2956 % }
2957 % \end{macrocode}
2958 % \end{macro} \end{macro}
2959 %
2960 % \begin{macro}{\vpl_real}
2961 % \begin{macro}{\vpl_int}
2962 % The commands |\vpl_real|\meta{dimen} and |\vpl_int|\meta{count} print
2963 % a dimension and integer respectively in (V)PL syntax.
2964 %
2965 % \begin{macrocode}
2966 \def\vpl_real#1{R~\expandafter\lose_measure\the#1}
2967 \def\vpl_int#1{D~\the#1}
2968 % \end{macrocode}
2969 % \end{macro} \end{macro}
2970 %
2971 %
2972 % The count register |\boundary_char| has been removed, since
2973 % the reimplementation of the left and right boundaries have drastically
2974 % decreased the need to check which slot serves as the right boundary.
2975 % Instead the integer |%boundarychar| (whose name cannot normally be typed)
2976 % is used to store the number of this slot, but the user need never (and
2977 % should not) access this integer directly. If the integer is not set
2978 % then no slot serves as boundarychar.
2979 % \changes{1.900}{1998/12/04}{\cs{boundary_char} count register
2980 % removed. Right boundary slot number is now stored in the
2981 % \texttt{\%boundarychar} integer instead. (LH)}
2982 %
2983 % \begin{macro}{\side_bearings}
2984 % \begin{macro}{\curr_bearings}
2985 % These two dimens are used by the letterspacing mechanism.
2986 % \begin{macrocode}
2987 \newdimen\side_bearings
2988 \newdimen\curr_bearings
2989 % \end{macrocode}
2990 % \end{macro} \end{macro}
2991 %
2992 % \begin{macro}{\make_header}
2993 % \begin{macrocode}
2994 \def\make_header#1{
2995 \global\font_count=0
2996 \setdim{designsize}{10pt}
2997 \a_dimen=\dim{designsize}
2998 \out_line{(DESIGNSIZE~\vpl_real\a_dimen)}
2999 \x_setstr{codingscheme}{UNKNOWN}
3000 \out_line{(CODINGSCHEME~\str{codingscheme})}
3001 %<*boundaryCompability>
3002 \ifisint{boundarychar}\then
3003 \x_setint{\percent_char boundarychar}{\int{boundarychar}}
3004 \immediate\write16{Please~use~\string\setleftboundary\space
3005 and/or~\string\makerightboundary^^J
3006 instead~of~setting~the~boundarychar~integer.}
3007 \fi
3008 %</boundaryCompability>
3009 \ifisint{\percent_char boundarychar}\then
3010 \a_count=\int{\percent_char boundarychar}
3011 \out_line{(BOUNDARYCHAR~\vpl_int\a_count)}
3012 \fi
3013 \x_setint{letterspacing}{0}
3014 \side_bearings=\make_factor{\int{letterspacing}}\half_point
3015 \x_setint{minimumkern}{0}
3016 \minimum_kern=\int{minimumkern}
3017 \out_line{}
3018 }
3019 % \end{macrocode}
3020 % \changes{1.900}{1999/01/20}{Removed test for no letterspacing. (LH)}
3021 % \changes{1.900}{1999/01/20}{Made integer expression \cs{div} a
3022 % dimen \cs{divide}. (LH)}
3023 % \end{macro}
3024 %
3025 %
3026 % \begin{macro}{\make_mapfonts}
3027 % \begin{macrocode}
3028 \def\make_mapfonts#1{
3029 \let\saved_scale\vpl_scale
3030 \let\saved_mapfont\vpl_mapfont
3031 \let\do_slot=\do_mapfont
3032 \pre_second_etx_pass_hook
3033 #1
3034 \post_second_etx_pass_hook
3035 \out_line{}
3036 }
3037 % \end{macrocode}
3038 % \end{macro}
3039 %
3040 % \begin{macro}{\do_mapfont}
3041 % |\do_mapfont| produces a |MAPFONT| entry for each font used by
3042 % glyph |\slot_name|.
3043 % \begin{macrocode}
3044 \def\do_mapfont{
3045 \ifisglyph\slot_name\then
3046 \mapfonts\slot_name
3047 \fi
3048 }
3049 % \end{macrocode}
3050 % \end{macro}
3051 %
3052 % The following commands can be used in the \meta{mapfonts} glyph
3053 % parameter.
3054 %
3055 % \begin{macro}{\vpl_scale}
3056 % \begin{macrocode}
3057 \def\vpl_scale#1#2{{
3058 \mapfont_scaling=\make_factor{#1}\mapfont_scaling
3059 #2
3060 }}
3061 % \end{macrocode}
3062 % \end{macro}
3063 %
3064 % \begin{macro}{\vpl_mapfont}
3065 % \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)}
3066 % \changes{1.913}{2000/02/26}{Mapfont number control sequences are
3067 % named \cs{\meta{scaling factor}pt-\meta{font}} instead of
3068 % \cs{\meta{font}-\meta{scaling factor}pt}. They are also made
3069 % \cs{mathchardef}s. (LH)}
3070 % \begin{macrocode}
3071 \def\vpl_mapfont#1#2{
3072 \a_dimen=#2
3073 \if_undefined{\the\mapfont_scaling-#1}\then
3074 \global\x_cs\mathchardef{\the\mapfont_scaling-#1}=\font_count
3075 \x_cs\xdef{f-\the\font_count}{\the\mapfont_scaling-#1}
3076 \out_line{(MAPFONT~\vpl_int\font_count\space
3077 (FONTNAME~#1)~
3078 (FONTDSIZE~\vpl_real\a_dimen)~
3079 (FONTAT~\vpl_real\mapfont_scaling))}
3080 \record_usage{#1}
3081 \global\advance\font_count by 1
3082 \fi
3083 }
3084 % \end{macrocode}
3085 % \end{macro}
3086 %
3087 % \begin{macro}{\pl_mapfont}
3088 % As PL files have no \texttt{MAPFONT} properties, the |\pl_mapfont|
3089 % macro only needs to do one thing: copy the current value of
3090 % |\mapfont_|\-|scaling| to |\rawfont_|\-|scaling|. This is necessary
3091 % since if the raw font for which a ligful PL is being written has
3092 % been scaled, then that scaling factor must be put in the appropriate
3093 % place in the FD file entry, and the simplest way to determine this
3094 % scaling factor is to execute the |\mapfonts| of some glyph in the
3095 % font.
3096 %
3097 % Due to the fact that the second ETX file pass (that during which the
3098 % \texttt{MAPFONT} properties are written) is skipped when a PL file
3099 % is being written, the |\mapfonts| get executed during the fourth ETX
3100 % file pass instead of the second. This works fine since the
3101 % |\mapcommands| that are executed at that time when a VPL file is
3102 % being written aren't needed for PL files.
3103 % \changes{1.913}{2000/03/21}{Macro added. (LH)}
3104 % \begin{macrocode}
3105 \def\pl_mapfont#1#2{\global\rawfont_scaling=\mapfont_scaling}
3106 % \end{macrocode}
3107 % \end{macro}
3108 %
3109 % \begin{macro}{\font_count}
3110 % \begin{macro}{\next_mapfont}
3111 % \begin{macro}{\prev_mapfont}
3112 % \begin{macrocode}
3113 \newcount\font_count
3114 \newcount\next_mapfont
3115 \newcount\prev_mapfont
3116 % \end{macrocode}
3117 % \end{macro} \end{macro} \end{macro}
3118 %
3119 %
3120 % \begin{macro}{\make_fontdimens}
3121 % This macro writes the \texttt{FONTDIMEN} property list. Note that
3122 % there is a difference between fontdimen 1 and the others, in that
3123 % fontdimen 1 is always in \texttt{pt}, not in the atsize-relative
3124 % \texttt{FONTUNITS} unit that the others are. Nonetheless, they can
3125 % both be treated the same here. This relies on (i) that 1000 denotes
3126 % the factor 1, and (ii) that 1000 AFM units equals 1 fontunit.
3127 % \begin{macrocode}
3128 \def\make_fontdimens#1{
3129 \out_line{(FONTDIMEN}
3130 \a_count=1
3131 \loop\ifnum 256>\a_count
3132 \ifisint{fontdimen(\the\a_count)}\then
3133 \out_lline{(PARAMETER~\vpl_int\a_count\space
3134 R~\make_factor{\int{fontdimen(\the\a_count)}})}
3135 \fi
3136 \advance \a_count \@ne
3137 \repeat
3138 \out_lline{)}
3139 \out_line{}
3140 }
3141 % \end{macrocode}
3142 % \end{macro}
3143 %
3144 %
3145 % \subsection{The ligtable}
3146 %
3147 % \begin{macro}{\make_ligtable}
3148 % \changes{1.927}{2003/12/08}{Changed the surrounding group to
3149 % \cs{begingroup} type. This helps contain errors that arise when
3150 % the \cs{setslot}s and \cs{endsetslot}s aren't properly balanced.
3151 % (LH)}
3152 % \begin{macrocode}
3153 \def\make_ligtable#1{
3154 \begingroup
3155 \out_line{(LIGTABLE}
3156 %<!boundaryCompability> \let\do_slot=\bgroup
3157 %<*boundaryCompability>
3158 \def\do_slot{\bgroup
3159 \ifisint{boundarychar}\then
3160 \ifnum \int{boundarychar}=\slot_number
3161 \def\vpl_liglabel{\out_liglabel\boundary_liglabel}
3162 \fi
3163 \fi
3164 }
3165 %</boundaryCompability>
3166 \let\end_do_slot=\vpl_kerning
3167 \def\do_boundary{\bgroup \let\vpl_liglabel=\boundary_liglabel}
3168 \let\endsetleftboundary=\vpl_kerning
3169 \let\ligature=\vpl_ligature
3170 \let\k=\vpl_kern
3171 \let\rbserver_do=\vpl_rbserver_do
3172 \let\rboundary_do=\vpl_rboundary_do
3173 \pre_third_etx_pass_hook
3174 #1
3175 \post_third_etx_pass_hook
3176 \out_lline{)}
3177 \endgroup
3178 \out_line{}
3179 }
3180 % \end{macrocode}
3181 % \end{macro}
3182 %
3183 % \begin{macro}{\vpl_rbserver_do}
3184 % \begin{macro}{\vpl_rboundary_do}
3185 % \begin{macro}{\wrn_rboundary_do}
3186 % |\vpl_rbserver_do| and |\vpl_rboundary_do| are what |\rbserver_do|
3187 % and |\rboundary_do| respectively are when a ligkern program is being
3188 % written and no entry has yet been written for the boundarychar
3189 % slot. |\wrn_rboundary_do| is what one of them will get set to
3190 % afterwards, so that warnings are written when collisions between
3191 % using the slot as a right boundary marker and using the slot for
3192 % the actual glyph occur.
3193 % \begin{macrocode}
3194 \def\vpl_rbserver_do#1{
3195 \do{#1}
3196 \let\rboundary_do=\wrn_rboundary_do
3197 }
3198 \def\vpl_rboundary_do#1{
3199 \do{#1}
3200 \let\rbserver_do=\wrn_rboundary_do
3201 }
3202 \def\wrn_rboundary_do#1{
3203 \do{#1}
3204 \immediate\write16{Boundarychar~slot~usage~collision~in~
3205 `\slot_name'~ligkern~program.}
3206 }
3207 % \end{macrocode}
3208 % \end{macro}\end{macro}\end{macro}
3209 %
3210 %
3211 % \begin{macro}{\vpl_ligature}
3212 % |\vpl_ligature{|\meta{type}|}{|\meta{glyph}|}{|\meta{glyph}|}|
3213 % produces a ligtable entry for glyph |\slot_name|.
3214 %
3215 % The double spaces in the |\out_lline| statement below might look
3216 % strange, but |\number| will always gobble the first one.
3217 % \begin{macrocode}
3218 \def\vpl_ligature#1#2#3{
3219 \get_slot_num{#3}
3220 \ifnum -1=\result
3221 \immediate\write16{Warning:~\string\ligature\space
3222 for~unknown~slot~`#3'.}
3223 \else
3224 \x_cs\ifx{slots-#2}\x_relax
3225 \immediate\write16{Warning:~\string\ligature\space
3226 for~unknown~slot~`#2'.}
3227 \else
3228 \def\do##1{
3229 \vpl_liglabel
3230 \out_lline{(#1~D~\number`##1~\space\vpl_int\result)~
3231 (COMMENT~#2~#3)}
3232 }
3233 \csname slots-#2\endcsname
3234 \fi
3235 \fi
3236 }
3237 % \end{macrocode}
3238 % \end{macro}
3239 %
3240 %
3241 %
3242 % \begin{macro}{\vpl_kerning}
3243 % |\vpl_kerning| writes out kerning instructions.
3244 % \begin{macrocode}
3245 \def\vpl_kerning{
3246 \let\do=\vpl_kern_do
3247 \csname~r-\slot_name\endcsname
3248 \vpl_ligstop
3249 \egroup
3250 }
3251 % \end{macrocode}
3252 % \end{macro}
3253 %
3254 % \begin{macro}{\vpl_kern}
3255 % |\vpl_kern|\,|\l-|\meta{name}\,|\|\meta{amount} writes out a |KRN|
3256 % instruction.
3257 %
3258 % \changes{1.900}{1998/10/02}{Macro modified to avoid duplicate kerns.
3259 % (LH)}
3260 % |\vpl_kern| has been modified so that at most one
3261 % \texttt{KRN} instruction is written for each (ordered) pair of
3262 % characters. The idea is basically to make \package{fontinst} forget,
3263 % until the end of |\vpl_kerning|, that the glyph for which |\vpl_kern|
3264 % is being called has been assigned a slot, as this stops any more
3265 % \texttt{KRN} instructions for that particular glyph from being
3266 % written. |\vpl_kern| has also been modified so that it will not write
3267 % out any \texttt{KRN} instructions for kerns whose absolute value is
3268 % less than or equal to |\minimum_kern|. |\minimum_kern| gets set to
3269 % the value of the integer \texttt{minimumkern} in |\make_header|. If
3270 % the user has not set \texttt{minimumkern}, a default value of 0 will
3271 % be supplied by \package{fontinst}.
3272 %
3273 % \changes{1.900}{1998/12/07}{Much of the code from \cs{vpl_kern} has
3274 % been moved to \cs{vpl_kern_do}. (LH)}
3275 % \changes{1.913}{2000/02/26}{Using a nested \cs{ifnum} construct to
3276 % test the condition $\left\protect\vert
3277 % \protect\mbox{\cs{a_count}}\right\protect\vert \quotechar >
3278 % \protect\mbox{\cs{minimum_kern}}$. (LH)}
3279 % \begin{macrocode}
3280 \def\vpl_kern#1#2{
3281 \edef\a_macro{\expandafter\gobble_three\string#1}
3282 \a_count=\expandafter\gobble_one\string#2\x_relax
3283 \ifnum \ifnum -\a_count>\a_count - \fi\a_count>\minimum_kern
3284 \edef\b_macro{~R~\make_factor\a_count}
3285 \csname slots-\a_macro\endcsname
3286 \fi
3287 \x_cs\let{slots-\a_macro}=\x_relax
3288 }
3289 % \end{macrocode}
3290 % Observation (LH 1999/03/16): The above construction has the
3291 % side-effect that a direct contradiction between a right boundary
3292 % glyph and a glyph in the |%boundarychar| slot won't be detected if
3293 % one of the items in contradiction is a kern less than or equal to
3294 % |\minimum_kern|. Perhaps this should be changed (letting |\do| equal
3295 % to |\gobble_one| would let the dectection mechanism work, but |\do|
3296 % would have to be restored afterwards and it is doubtful if it is
3297 % worth it).
3298 % \end{macro}
3299 %
3300 %
3301 % \begin{macro}{\vpl_kern_do}
3302 % |\vpl_kern_do| is what |\do| is defined to be when kerns are written.
3303 % \begin{macrocode}
3304 \def\vpl_kern_do#1{
3305 \vpl_liglabel
3306 \out_lline{
3307 (KRN~D~\number`#1~\b_macro)~
3308 (COMMENT~\a_macro)
3309 }
3310 }
3311 % \end{macrocode}
3312 % \end{macro}
3313 %
3314 %
3315 % \begin{macro}{\out_liglabel}
3316 % \begin{macro}{\boundary_liglabel}
3317 % \begin{macro}{\vpl_liglabel}
3318 % |\out_liglabel| writes out a |LIGLABEL| instruction for a slot.
3319 % |\boundary_liglabel| writes out a |LIGLABEL| instruction for the
3320 % |BOUNDARYCHAR| ligkern program. |\vpl_liglabel| writes out the
3321 % correct |LIGLABEL| instruction for the current ligkern program, if it
3322 % is approriate.
3323 %
3324 % \begin{macrocode}
3325 \def\out_liglabel{
3326 \out_lline{(LABEL~\vpl_int\slot_number)~(COMMENT~\slot_name)}
3327 \let\vpl_liglabel=\x_relax
3328 \let\vpl_ligstop=\out_ligstop
3329 }
3330 \def\boundary_liglabel{
3331 \out_lline{(LABEL~BOUNDARYCHAR)~(COMMENT~\slot_name)}
3332 \let\vpl_liglabel=\x_relax
3333 \let\vpl_ligstop=\out_ligstop
3334 }
3335 \let\vpl_liglabel=\out_liglabel
3336 % \end{macrocode}
3337 % \end{macro}\end{macro}\end{macro}
3338 %
3339 % \begin{macro}{\out_ligstop}
3340 % \begin{macro}{\vpl_ligstop}
3341 % |\vpl_ligstop| writes out a |LIGSTOP| instruction if appropriate.
3342 % \begin{macrocode}
3343 \def\out_ligstop{\out_lline{(STOP)}
3344 \let\vpl_liglabel=\out_liglabel
3345 \let\vpl_ligstop=\x_relax}
3346 \let\vpl_ligstop=\x_relax
3347 % \end{macrocode}
3348 % \end{macro} \end{macro}
3349 %
3350 %
3351 % \subsection{The characters}
3352 %
3353 % \begin{macro}{\make_characters}
3354 % \begin{macrocode}
3355 \def\make_characters#1{
3356 \bgroup
3357 \let\do_slot=\do_character
3358 \let\end_do_slot=\end_do_character
3359 \let\nextlarger=\vpl_nextlarger
3360 \let\varchar=\vpl_varchar
3361 \let\endvarchar=\end_vpl_varchar
3362 \let\vartop=\vpl_vartop
3363 \let\varmid=\vpl_varmid
3364 \let\varbot=\vpl_varbot
3365 \let\varrep=\vpl_varrep
3366 \if_including_map_
3367 \let\saved_raw\vpl_raw
3368 \let\saved_rule\vpl_rule
3369 \let\saved_special\vpl_special
3370 \let\saved_warning\vpl_warning
3371 \let\saved_movert\vpl_movert
3372 \let\saved_moveup\vpl_moveup
3373 \let\saved_push\vpl_push
3374 \let\saved_pop\vpl_pop
3375 \else
3376 \def\do_character_map{
3377 \ifdim \rawfont_scaling=-\p@
3378 \mapfonts\slot_name
3379 \else
3380 \let\do_character_map=\x_relax
3381 \fi
3382 }
3383 \let\saved_mapfont\pl_mapfont
3384 \let\saved_scale\vpl_scale
3385 \fi
3386 \pre_fourth_etx_pass_hook
3387 #1
3388 \post_fourth_etx_pass_hook
3389 \egroup
3390 }
3391 % \end{macrocode}
3392 % \end{macro}
3393 %
3394 % \begin{macro}{\do_character}
3395 % \changes{1.913}{2000/03/10}{Negative italic corrections \emph{are}
3396 % written to the (V)PL being generated. (LH)}
3397 % \changes{1.927}{2004/07/13}{Added flag for emitting warning message
3398 % when a glyph is missing. (LH) Requested by Werner Lemberg.}
3399 % |\do_character| produces a character entry for glyph |\slot_name| in
3400 % slot |\slot_number|.
3401 %
3402 % \begin{macrocode}
3403 \def\do_character{
3404 \if_undefined{g-\slot_name}\then
3405 \ifisint{requireglyphs}\then
3406 \fontinstwarning{ETX~to~(V)PL}{
3407 Undefined~glyph~`\slot_name'~requested\message_break
3408 for~slot~\the\slot_number\message_number}
3409 \fi
3410 \expandafter\gobble_setslot
3411 \else
3412 \ifx\slot_name\notdef_name\else
3413 \out_line{(CHARACTER~\vpl_int\slot_number\space
3414 (COMMENT~\slot_name)}
3415 \glyph_parameter\glyph_metrics\slot_name
3416 \a_dimen=\make_factor\a_count \p@
3417 \do_character_sidebearings
3418 \out_lline{(CHARWD~\vpl_real\a_dimen)}
3419 \ifnum \z@=\b_count \else
3420 \out_lline{(CHARHT~R~\make_factor\b_count)}
3421 \fi
3422 \ifnum \z@=\c_count \else
3423 \out_lline{(CHARDP~R~\make_factor\c_count)}
3424 \fi
3425 \ifnum \z@=\d_count \else
3426 \out_lline{(CHARIC~R~\make_factor\d_count)}
3427 \fi
3428 \do_character_map
3429 \fi
3430 \fi
3431 }
3432 % \end{macrocode}
3433 % \end{macro}
3434 %
3435 % \begin{macro}{\do_character_sidebearings}
3436 % \begin{macrocode}
3437 \def\do_character_sidebearings{
3438 \ifisint{\slot_name-spacing}\then
3439 \curr_bearings=\make_factor{\int{\slot_name-spacing}}\half_point
3440 \else
3441 \curr_bearings=\side_bearings
3442 \fi
3443 \advance\a_dimen by 2\curr_bearings
3444 }
3445 % \end{macrocode}
3446 % \end{macro}
3447 %
3448 % \begin{macro}{\do_character_map}
3449 % \begin{macrocode}
3450 \def\do_character_map{
3451 \global\prev_mapfont=0
3452 \out_lline{(MAP}
3453 \ifdim 0pt=\curr_bearings
3454 \mapcommands\slot_name
3455 \else
3456 \out_llline{(MOVERIGHT~\vpl_real\curr_bearings)}
3457 \mapcommands\slot_name
3458 \out_llline{(MOVERIGHT~\vpl_real\curr_bearings)}
3459 \fi
3460 \out_llline{)}
3461 }
3462 % \end{macrocode}
3463 % \end{macro}
3464 %
3465 % \begin{macro}{\do_character_no_letterspacing}
3466 % LH 1999/03/27: This is an alternative version of |\do_character|
3467 % which I think is now antiquated. It used to have an advantage over
3468 % |\do_character| in that it did not do any letterspacing (in v\,1.5,
3469 % that was good since |\do_character| used to write code for
3470 % letterspacing to the VPL regardless of whether is was needed or
3471 % not), but that advantage is gone since |\do_character_map| is now
3472 % a bit less stupid than it used to be.
3473 %
3474 % For the record, I don't think there ever was a user interface for
3475 % using this macro instead of |\do_character|, but I suspect there
3476 % are plenty of people around who have hacked it into being used.
3477 %
3478 % With v\,1.913 I commented it out completely, since I didn't feel
3479 % like updating the calls to |\afm_convert|.
3480 % \begin{macrocode}
3481 %<*obsolete>
3482 % \def\do_character_no_letterspacing{
3483 % \x_cs\ifx{g-\slot_name}\x_relax
3484 % \expandafter\gobble_setslot
3485 % \else
3486 % \ifx\slot_name\notdef_name\else
3487 % \out_line{(CHARACTER~\vpl_int\slot_number\space
3488 % (COMMENT~\slot_name)}
3489 % \afm_convert\a_dimen=\width\slot_name;
3490 % \out_lline{(CHARWD~\vpl_real\a_dimen)}
3491 % \afm_convert\a_dimen=\height\slot_name;
3492 % \out_lline{(CHARHT~\vpl_real\a_dimen)}
3493 % \afm_convert\a_dimen=\depth\slot_name;
3494 % \out_lline{(CHARDP~\vpl_real\a_dimen)}
3495 % \afm_convert\a_dimen=\italic\slot_name;
3496 % \ifnum\a_dimen>0 \out_lline{(CHARIC~\vpl_real\a_dimen)} \fi
3497 % \global\prev_mapfont=0 \out_lline{(MAP}
3498 % \mapcommands\slot_name
3499 % \out_llline{)}
3500 % \fi
3501 % \fi
3502 % }
3503 %</obsolete>
3504 % \end{macrocode}
3505 % \end{macro}
3506 %
3507 % \begin{macro}{\gobble_setslot}
3508 % \begin{macrocode}
3509 \long\def\gobble_setslot#1\endsetslot{\endsetslot}
3510 % \end{macrocode}
3511 % \changes{1.901}{1999/03/27}{Made \cs{gobble_setslot} a \cs{long}
3512 % macro. (LH)}
3513 % \end{macro}
3514 %
3515 % \begin{macro}{\end_do_character}
3516 % \begin{macrocode}
3517 \def\end_do_character{
3518 \ifisglyph\slot_name\then
3519 \out_lline{)}
3520 \fi
3521 }
3522 % \end{macrocode}
3523 % \end{macro}
3524 %
3525 % \begin{macro}{\notdef_name}
3526 % \begin{macrocode}
3527 \def\notdef_name{.notdef}
3528 % \end{macrocode}
3529 % \end{macro}
3530 %
3531 %
3532 % \subsection{Slot commands that put things in a character property list}
3533 %
3534 % Here follows the active definitions for those slot commands that
3535 % causes things to be put in |CHARACTER| property lists.
3536 %
3537 % \begin{macro}{\vpl_nextlarger}
3538 % |\vpl_nextlarger|\marg{name} produces a |NEXTLARGER| entry.
3539 % \begin{macrocode}
3540 \def\vpl_nextlarger#1{
3541 \get_slot_num{#1}
3542 \ifnum -1<\result
3543 \out_lline{(NEXTLARGER~D~\the\result)~(COMMENT~#1)}
3544 \else
3545 \immediate\write16{Warning:~\string\nextlarger\space
3546 for~unknown~slot~`#1'}
3547 \fi
3548 }
3549 % \end{macrocode}
3550 % \end{macro}
3551 %
3552 % \begin{macro}{\vpl_varchar}
3553 % \begin{macro}{\end_vpl_varchar}
3554 % |\vpl_varchar| \meta{varchar commands} |\end_vpl_varchar| produces
3555 % a |VARCHAR| entry.
3556 %
3557 % \begin{macrocode}
3558 \def\vpl_varchar{\out_lline{(VARCHAR}}
3559 % \end{macrocode}
3560 % \begin{macrocode}
3561 \def\end_vpl_varchar{\out_llline{)}}
3562 % \end{macrocode}
3563 % \end{macro} \end{macro}
3564 %
3565 %
3566 % \begin{macro}{\vpl_vartop}
3567 % \begin{macrocode}
3568 \def\vpl_vartop#1{
3569 \get_slot_num{#1}
3570 \ifnum -1<\result
3571 \out_llline{(TOP~D~\the\result)~(COMMENT~#1)}
3572 \else
3573 \immediate\write16{Warning:~\string\vartop\space
3574 for~unknown~slot~`#1'}
3575 \fi
3576 }
3577 % \end{macrocode}
3578 % \end{macro}
3579 %
3580 % \begin{macro}{\vpl_varmid}
3581 % \begin{macrocode}
3582 \def\vpl_varmid#1{
3583 \get_slot_num{#1}
3584 \ifnum -1<\result
3585 \out_llline{(MID~D~\the\result)~(COMMENT~#1)}
3586 \else
3587 \immediate\write16{Warning:~\string\varmid\space
3588 for~unknown~slot~`#1'}
3589 \fi
3590 }
3591 % \end{macrocode}
3592 % \end{macro}
3593 %
3594 % \begin{macro}{\vpl_varbot}
3595 % \begin{macrocode}
3596 \def\vpl_varbot#1{
3597 \get_slot_num{#1}
3598 \ifnum -1<\result
3599 \out_llline{(BOT~D~\the\result)~(COMMENT~#1)}
3600 \else
3601 \immediate\write16{Warning:~\string\varbot\space
3602 for~unknown~slot~`#1'}
3603 \fi
3604 }
3605 % \end{macrocode}
3606 % \end{macro}
3607 %
3608 % \begin{macro}{\vpl_varrep}
3609 % \begin{macrocode}
3610 \def\vpl_varrep#1{
3611 \get_slot_num{#1}
3612 \ifnum -1<\result
3613 \out_llline{(REP~D~\the\result)~(COMMENT~#1)}
3614 \else
3615 \immediate\write16{Warning:~\string\varrep\space
3616 for~unknown~slot~`#1'}
3617 \fi
3618 }
3619 % \end{macrocode}
3620 % \end{macro}
3621 %
3622 %
3623 % \subsection{Saved map commands}
3624 %
3625 % The following commands (and |\vpl_scale|, which is defined above) can
3626 % be used in the \meta{mapcommands} glyph parameter.
3627 %
3628 % \begin{macro}{\vpl_raw}
3629 % This macro writes the entries in a \texttt{MAP} that are needed for
3630 % the given raw character. Note that the `at' comment below gives the
3631 % scaling relative to the atsize of the virtual font, not the physical
3632 % atsize.
3633 % \IndexEntry{\LevelSame{PL properties:}^^A
3634 % \LevelSorted{SELECTFONT}{\texttt{SELECTFONT}}^^A
3635 % }{usage}{\thepage}
3636 % \begin{macrocode}
3637 \def\vpl_raw#1#2#3{
3638 \global\next_mapfont=\csname\the\mapfont_scaling-#1\endcsname
3639 \ifnum \next_mapfont=\prev_mapfont \else
3640 \out_llline{(SELECTFONT~\vpl_int\next_mapfont)~
3641 (COMMENT~#1~at~
3642 \expandafter\lose_measure \the\mapfont_scaling)}
3643 \fi
3644 \out_llline{(SETCHAR~D~#2)~(COMMENT~#3)}
3645 \global\prev_mapfont=\next_mapfont
3646 }
3647 % \end{macrocode}
3648 % \end{macro}
3649 %
3650 % \begin{macro}{\vpl_rule}
3651 % \begin{macrocode}
3652 \def\vpl_rule#1#2{
3653 \a_dimen=\make_factor{#2}\mapfont_scaling
3654 \b_dimen=\make_factor{#1}\mapfont_scaling
3655 \out_llline{(SETRULE~\vpl_real\a_dimen\space\vpl_real\b_dimen)}
3656 }
3657 % \end{macrocode}
3658 % \end{macro}
3659 %
3660 % \begin{macro}{\vpl_special}
3661 % \begin{macro}{\vpl_warning}
3662 % \begin{switch}{warningspecials}
3663 % \changes{1.913}{2000/02/26}{Switch controlling whether
3664 % \cs{glyphwarning}s should put \texttt{SPECIALS} in the VPL was
3665 % added. (LH)}
3666 % \begin{macrocode}
3667 \def\vpl_special#1{
3668 \out_llline{(SPECIAL~#1)}}
3669 % \end{macrocode}
3670 % \begin{macrocode}
3671 \def\vpl_warning#1{
3672 \ifwarningspecials
3673 \out_llline{(SPECIAL~Warning:~#1)}
3674 \fi
3675 \immediate\write16{Warning:~#1.}
3676 }
3677 % \end{macrocode}
3678 % \begin{macrocode}
3679 \newif\ifwarningspecials
3680 \warningspecialstrue
3681 % \end{macrocode}
3682 % \end{switch}\end{macro}\end{macro}
3683 %
3684 % \begin{macro}{\vpl_movert}
3685 % \begin{macro}{\vpl_moveup}
3686 % \begin{macrocode}
3687 \def\vpl_movert#1{
3688 \a_dimen=\make_factor{#1}\mapfont_scaling
3689 \out_llline{(MOVERIGHT~\vpl_real\a_dimen)}
3690 }
3691 % \end{macrocode}
3692 % \begin{macrocode}
3693 \def\vpl_moveup#1{
3694 \a_dimen=\make_factor{#1}\mapfont_scaling
3695 \out_llline{(MOVEUP~\vpl_real\a_dimen)}
3696 }
3697 % \end{macrocode}
3698 % \end{macro} \end{macro}
3699 %
3700 % \begin{macro}{\vpl_push}
3701 % \begin{macro}{\vpl_pop}
3702 % \begin{macrocode}
3703 \def\vpl_push{\out_llline{(PUSH)}}
3704 % \end{macrocode}
3705 % \begin{macrocode}
3706 \def\vpl_pop{\out_llline{(POP)}}
3707 % \end{macrocode}
3708 % \end{macro} \end{macro}
3709 %
3710 %
3711 % \subsection{Tidying up}
3712 %
3713 % \begin{macro}{\make_tidy}
3714 % If a VPL file was written, the tidying up consists of clearing the
3715 % list of mapfont numbers, since that is stored globally. If a PL
3716 % file was written, the tidying up consists of writing a
3717 % \texttt{DESIGNUNITS} property for those fonts which need one.
3718 % \begin{macrocode}
3719 \def\make_tidy#1{
3720 \tidying_up_hook
3721 \if_including_map_
3722 \a_count=0
3723 \loop\ifnum \a_count<\font_count
3724 \edef\a_macro{\csname~f-\the\a_count\endcsname}
3725 \global\x_cs\let\a_macro\x_relax
3726 \advance\a_count by 1
3727 \repeat
3728 \global\font_count=0
3729 \else
3730 \ifdim \rawfont_scaling<\z@
3731 \fontinstwarning{ETX~to~(V)PL}{The~font~
3732 \out_filename\space doesn't~contain~any~characters}
3733 \global\rawfont_scaling=\p@
3734 \fi
3735 \ifdim \rawfont_scaling=\p@ \else
3736 \out_line{(DESIGNUNITS~\vpl_real\rawfont_scaling)}
3737 \fi
3738 \fi
3739 }
3740 % \end{macrocode}
3741 % \end{macro}
3742 %
3743 %
3744 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3745 %
3746 % \section{Font installation commands and \texttt{.fd} files}
3747 %
3748 % \DescribeMacro{\installfonts}
3749 % \DescribeMacro{\endinstallfonts}
3750 % The call
3751 % \begin{quote}
3752 % |\installfonts| \meta{install commands} |\endinstallfonts|
3753 % \end{quote}
3754 % is the top-level interface for installing a number of fonts
3755 % and creating |.fd| files for them.
3756 %
3757 % \DescribeMacro{\installfamily}
3758 % \DescribeMacro{\installfont}
3759 % \DescribeMacro{\installrawfont}
3760 % The \meta{install commands} are:
3761 % \begin{isyntax}
3762 % |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands}\\
3763 % |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\penalty0
3764 % \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
3765 % |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}^^A
3766 % \penalty0
3767 % \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\
3768 % |\installfontas|\marg{font-name}\penalty0\marg{encoding}^^A
3769 % \marg{family}\marg{series}\marg{shape}\marg{size}
3770 % \end{isyntax}
3771 %
3772 % Each |\installfamily| command causes the generation of an |.fd| file
3773 % for \meta{encoding} and \meta{family}, which is writen out by the time
3774 % |\endinstallfonts| is processed.
3775 %
3776 % Each |\installfont| generates a |.vpl| font by calling |\etxtovpl|
3777 % and adds an |.fd| entry.
3778 % Each |\installrawfont| generates a ligfull |.pl| font by calling
3779 % |\etxtopl| and adds an |.fd| entry. (Raw |.pl| fonts, containing only
3780 % the glyph metrics without any ligaturing or kerning information,
3781 % are also generated by |\mtxtopl| called from |\transformfont|
3782 % statements.)
3783 %
3784 % \changes{1.912}{2000/01/15}{\cs{install}\dots\ commands updated to
3785 % set \cs{setsomething_global} to \cs{global} around themselves. This
3786 % reduces problems with assignments ``not working'' due to the
3787 % unintuitive grouping. (LH) Problem pointed out by Hilmar
3788 % Schlegel, , and others.}
3789 %
3790 % \begin{macro}{\installfonts}
3791 % Initializes the |\family_toks| token register, which is used to store
3792 % the information which is written out to |.fd| files at the end of the
3793 % job.
3794 %
3795 % \begin{macrocode}
3796 \newtoks\family_toks
3797 \def\installfonts{
3798 \bgroup
3799 \global\family_toks={}
3800 \gdef\prev_file_list{}
3801 \global\let\setsomething_global=\global
3802 }
3803 % \end{macrocode}
3804 % \end{macro}
3805 %
3806 % \begin{macro}{\installfamily}
3807 % |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands}
3808 %
3809 % Adds the command
3810 % \begin{quote}
3811 % |\fd_family|\marg{encoding}\marg{family}\marg{FD-commmands}
3812 % \end{quote}
3813 % to the token list |\family_toks| and defines a macro
3814 % |\|\meta{encoding}|-|\meta{family}.^^A
3815 % \describecsfamily{\meta{encoding}-\meta{family}}
3816 %
3817 % \begin{macrocode}
3818 \def\installfamily#1#2#3{
3819 \global\family_toks=
3820 \expandafter{\the\family_toks\fd_family{#1}{#2}{#3}}
3821 \global\x_cs\let{#1-#2}\empty_command
3822 }
3823 % \end{macrocode}
3824 % \end{macro}
3825 %
3826 % \begin{macro}{\installfont}
3827 % \begin{macro}{\installrawfont}
3828 % \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)}
3829 % \multchanges{\cs{installfont}\cs{installrawfont}}{1.913}{2000/03/21}
3830 % {Moved some code from \cs{install_font} to these commands. (LH)}
3831 % |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\\
3832 % \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A
3833 % \marg{shape}\marg{size}\\
3834 % |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}\\
3835 % \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A
3836 % \marg{shape}\marg{size}
3837 %
3838 % \begin{macrocode}
3839 \def\installfont#1#2#3#4#5#6#7#8{
3840 \global\let\setsomething_global=\x_relax
3841 \input_metrics{}{#2}
3842 \etxtovpl{#3}{#1}
3843 \installfontas{#1}{#4}{#5}{#6}{#7}{#8}
3844 \global\let\setsomething_global=\global
3845 }
3846 \def\installrawfont#1#2#3#4#5#6#7#8{
3847 \global\let\setsomething_global=\x_relax
3848 \xdef\out_filename{#1}
3849 \input_metrics{\let\storemapdata=\installraw_storemap}{#2}
3850 \let\storemapdata=\gobble_three
3851 \etxtopl{#3}{#1}
3852 \record_usage{#1}
3853 \installfontas{
3854 \ifdim \rawfont_scaling=\p@ \else
3855 [\expandafter\lose_measure\the\rawfont_scaling]~
3856 \fi #1
3857 }{#4}{#5}{#6}{#7}{#8}
3858 \global\let\setsomething_global=\global
3859 }
3860 % \end{macrocode}
3861 % \end{macro}
3862 % \end{macro}
3863 %
3864 % \begin{macro}{\installraw_storemap}
3865 % The |\installraw_storemap| macro is a definition of |\storemapdata|
3866 % that is used when the metrics for a ligful PL file is being inputed.
3867 % Its job is to write a |\storemapdata| command for this PL to the
3868 % transforms record file if the PL being written does not have the
3869 % same name as the MTX that the metrics are taken from (the
3870 % information is already stored if both files have the same name).
3871 % |\out_filename| is prematurely set by |\installrawfont| (i.e., long
3872 % before the PL file is actually opened) so that it can be used in
3873 % comparing the file names.
3874 % \changes{1.913}{1999/03/23}{Macro added. (LH)}
3875 % \begin{macrocode}
3876 \def\installraw_storemap#1#2#3{
3877 \def\a_macro{#1}
3878 \ifx \a_macro\out_filename \else
3879 \record_transform{\out_filename}{\string\frommtx{#1}}{}\if_false
3880 \fi
3881 }
3882 % \end{macrocode}
3883 % \end{macro}
3884 %
3885 %
3886 % \begin{macro}{\input_metrics}
3887 % The |\input_metrics| macro takes a comma-separated list of metric
3888 % files as its second argument and sees to that exactly these metrics
3889 % are loaded. If the list is identical to that used in the last call
3890 % to |\input_metrics|, then this is already the case and
3891 % |\input_metrics| simply refrains from flushing those previous
3892 % metrics from \TeX's memory. Otherwise it closes a group (flushing
3893 % the metrics from a previous call), opens a group (so that these
3894 % metrics can be flushed at the next |\installfont| or
3895 % |\installrawfont| command, if necessary), and starts inputting the
3896 % metrics files in question.
3897 %
3898 % The first argument consists of code that will be executed after the
3899 % group has been closed and opened, but before any metrics is inputed.
3900 % \changes{1.900}{1999/02/13}
3901 % {Use \cs{process_csep_list} for file-list. (LH)}
3902 % \changes{1.914}{2000/05/26}{Redefined to suite \cs{file_list_metrics}.
3903 % In particular, there will now be a comma at the end of
3904 % \cs{curr_file_list} and \cs{prev_file_list}. (LH)}
3905 % \begin{macrocode}
3906 \def\input_metrics#1#2{
3907 \let\metrics=\file_list_metrics
3908 \xdef\curr_file_list{#2,}
3909 \let\metrics=\x_relax
3910 \ifx\prev_file_list\curr_file_list\else
3911 \egroup\bgroup
3912 #1
3913 \expandafter\process_csep_list \expandafter\input_mtx_file
3914 \curr_file_list\process_csep_list,
3915 \global\let\prev_file_list=\curr_file_list
3916 \fi
3917 }
3918 % \end{macrocode}
3919 % \end{macro}
3920 %
3921 % \begin{macro}{\file_list_metrics}
3922 % The |\file_list_metrics| macro is a definition of |\metrics| that
3923 % is used in the \meta{file-list} argument of |\install|\-|font| and
3924 % |\install|\-|raw|\-|font| when that is |\xdef|ed by |\input_metrics|.
3925 % This special definition prevents the succeeding \meta{metric
3926 % commands} from getting expanded.
3927 % \changes{1.914}{2000/05/26}{Macro added. (LH)}
3928 % \begin{macrocode}
3929 \def\file_list_metrics#1,{
3930 \iffalse{\fi}
3931 \a_toks=\expandafter{\curr_file_list\x_relax#1,}
3932 \xdef\curr_file_list{\the\a_toks \iffalse}\fi
3933 }
3934 % \end{macrocode}
3935 % \end{macro}
3936 %
3937 % \begin{macro}{\installfontas}
3938 % The |\installfontas| command has the syntax
3939 % \begin{isyntax}
3940 % |\installfontas|\marg{font-info}\marg{encoding}\marg{family}^^A
3941 % \penalty0\marg{series}\penalty0\marg{shape}\penalty0\marg{size}
3942 % \end{isyntax}
3943 % The precise definition of a \meta{font-info} can be found in
3944 % \cite[Sec.~4]{fntguide}, here it suffices to say that a font name
3945 % (name of (V)PL file) is a valid \meta{font-info}. The |\installfontas|
3946 % command adds an entry for the \meta{font-info} font to a font
3947 % definition file, giving it the NFSS attributes \meta{encoding}^^A
3948 % \texttt{/}\nolinebreak[1]\meta{family}\texttt{/}\nolinebreak[1]^^A
3949 % \meta{series}\texttt{/}\nolinebreak[1]\meta{shape}\texttt{/}^^A
3950 % \nolinebreak[1]\meta{size}. The substitution mechanism will act on
3951 % \meta{series} and \meta{shape}, and it is therefore possible that
3952 % \meta{font-info} will appear in more than one |\Declare|\-|Font|\-^^A
3953 % |Shape| command. \meta{size} can be either some \meta{size-infos},
3954 % as defined in \cite[Sec.~4]{fntguide}, or a \package{fontinst}
3955 % shorthand for a such, declared using |\declaresize|.
3956 % \changes{1.912}{2000/01/16}{Command added. (LH)}
3957 % \changes{1.913}{2000/03/02}{Specification changed to allow
3958 % arbitrary \meta{font-info}s as first argument. (LH)}
3959 % \changes{1.921}{2002/03/27}{Automatically doing an
3960 % \cs{installfamily} if that has not been done. (LH) Suggested
3961 % by Rowland McDonnell.}
3962 % \begin{macrocode}
3963 \def\installfontas#1#2#3#4#5#6{
3964 \if_undefined{#2-#3-#4-#5}\then
3965 \let\do_shape=\x_relax
3966 \if_undefined{#2-#3}\then
3967 \x_cs\let{#2-#3}\empty_command
3968 \autoinstallfamily{#2}{#3}
3969 \fi
3970 \x_cs\xdef{#2-#3}{
3971 \csname#2-#3\endcsname
3972 \do_shape{#2}{#3}{#4}{#5}
3973 }
3974 \fi
3975 \let\do_size=\x_relax
3976 \x_cs\xdef{#2-#3-#4-#5}{
3977 \if_defined{#2-#3-#4-#5}\then
3978 \csname#2-#3-#4-#5\endcsname
3979 \fi
3980 \do_size{#6}{#1}
3981 }
3982 }
3983 % \end{macrocode}
3984 % \end{macro}
3985 %
3986 % \begin{macro}{\autoinstallfamily}
3987 % This command is called by |\installfontas| when it is asked to
3988 % install a font for which no |\installfamily| has been given. The
3989 % syntax is
3990 % \begin{quote}
3991 % |\autoinstallfamily|\marg{encoding}\marg{family}
3992 % \end{quote}
3993 % It defaults to calling |\installfamily| in the obvious way, but
3994 % it can be redefined if the user wants something different.
3995 % \changes{1.924}{2003/02/08}{Macro added. (LH)}
3996 % \begin{macrocode}
3997 \def\autoinstallfamily#1#2{\installfamily{#1}{#2}{}}
3998 % \end{macrocode}
3999 % \end{macro}
4000 %
4001 % \begin{macro}{\endinstallfonts}
4002 % Finish the installation by processing the |\family_toks|
4003 % token register, which contains the accumulated information
4004 % to be written out to |.fd| files.
4005 %
4006 % \begin{macrocode}
4007 \def\endinstallfonts{
4008 \global\let\setsomething_global=\x_relax
4009 \let\do_shape=\fd_shape
4010 \let\do_size=\fd_size
4011 \the\family_toks
4012 \global\family_toks{}
4013 \egroup
4014 }
4015 % \end{macrocode}
4016 % \end{macro}
4017 %
4018 %
4019 % The |\installfont| command has traditionally allowed that names of
4020 % base fonts (MTX files) are suffixed by a
4021 % \verb*" scaled "\meta{factor} that would cause the \texttt{rawscale}
4022 % integer to be set and thereby scale everything that was in that base
4023 % font by the said \meta{factor}. There is now a more general approach
4024 % to this. If the control sequence
4025 % \describecsfamily{IFKW-\meta{keyword}}|IFKW-|\meta{keyword} is
4026 % defined then \meta{keyword} may be used as \texttt{scaled} is above;
4027 % this control sequence should grab all the ``arguments'' of the
4028 % keyword, process them as necessary, and end with the |\get_keyword|
4029 % macro so that another keyword may be processed. As a rule, the
4030 % arguments and keywords are delimited from each other by single spaces.
4031 % A macro grabbing an argument grabs also the space after it. The
4032 % \texttt{IFKW} is for \texttt{I}nstall\texttt{F}ont
4033 % \texttt{K}ey\texttt{W}ord.
4034 %
4035 % \changes{1.923}{2002/10/09}{Added support for keywords other than
4036 % \texttt{scaled} in the second argument of \cs{installfont} and
4037 % such. (LH)}
4038 %
4039 % \begin{macro}{\input_mtx_file}
4040 % The |\input_mtx_macro| takes one undelimited argument. It
4041 % interprets this argument as if it was one item in the \meta{file-list}
4042 % argument of |\install|\-|font| or |\install|\-|rawfont|, and does
4043 % the corresponding processing. The argument should be one of the
4044 % following three things:
4045 % \begin{quote}
4046 % \meta{font}\meta{optional modifiers}\\
4047 % |\metrics| \meta{metric commands}\\
4048 % \meta{nothing}
4049 % \end{quote}
4050 % If, in the first case, an MTX file for \meta{font} does not
4051 % exist then it is generated on the fly from a corresponding |.pl|,
4052 % |.afm|, or |.vpl| file in the call to |\fromany|. In the second
4053 % case, the \meta{metric commands} simply get executed. In the third
4054 % case, nothing happens.
4055 %
4056 % The \meta{optional modifiers} is either empty or has the form
4057 % \meta{modifier clause}\meta{optional modifiers}. A \meta{modifier
4058 % clause} generally has the form
4059 % \begin{quote}
4060 % \verb*" "\meta{keyword}\verb*" "\meta{argument(s)}
4061 % \end{quote}
4062 % e.g.,
4063 % \begin{quote}
4064 % \verb*| scaled |\meta{rawscale factor}
4065 % \end{quote}
4066 %
4067 % \changes{1.904}{1999/06/16}{Now using \cs{fromany} to make an MTX
4068 % file when necessary. Furthermore testing for empty argument using
4069 % \cs{ifx} rather than \cs{if}. (LH)}
4070 % \changes{1.912}{2000/01/15}{Added error message. (LH) Suggested by
4071 % Alexei Kostin.}
4072 % \changes{1.914}{2000/05/26}{Can now accept arbitrary metric
4073 % commands in argument. (LH)}
4074 % \begin{macrocode}
4075 \def\input_mtx_file#1{
4076 \reset_modifiers_hook
4077 \ifx\x_relax#1\x_relax
4078 % \end{macrocode}
4079 % This tests for an empty argument, but it also lets explicit metric
4080 % commands be executed.
4081 % \begin{macrocode}
4082 \else
4083 \identity_one{\get_file_name #1~}~\par
4084 % \end{macrocode}
4085 % The two spaces have the effect of putting an empty keyword modifier
4086 % last in the \meta{optional modifiers}. If everything is all right
4087 % then this will gobble the |\par|. However, if the user forgot some
4088 % argument of the last keyword then there will be an error message
4089 % when |\get_keyword| will try to grab the next keyword.
4090 %
4091 % If an encoding has been specified then the source file must be a PL
4092 % or VPL file (since these are the only ones for which it makes sense
4093 % to specify an encoding), otherwise we rely on |\fromany| to find a
4094 % font metrics file.
4095 % \changes{1.926}{2003/07/10}{Only looking for PL and VPL files when
4096 % an encoding is specified. (LH)}
4097 % \changes{1.929}{2005/01/13}{Missing space in message inserted. (LH)
4098 % Pointed out by Peter Dyballa.}
4099 % \begin{macrocode}
4100 \ifx \pl_encoding\empty_command
4101 \fromany\file_name
4102 \else
4103 \metrics_given_encoding{\file_name}{\pl_encoding}
4104 \fi
4105 \ifisstr{afm-name}\then
4106 \inputmtx{\str{afm-name}}
4107 \else
4108 \fontinsterror{\string\install...}{
4109 Font/MTX~file~\file_name\space not~found
4110 }{
4111 You~can~insert~an~\string\inputmtx\space command~here
4112 \messagebreak to~input~some~other~MTX~file~instead.
4113 \ifisint{rawscale}\then \messagebreak
4114 The~requested~raw~scaling~will~then~be~applied~on~that.
4115 \fi
4116 }
4117 \fi
4118 \fi
4119 }
4120 % \end{macrocode}
4121 % \end{macro}
4122 %
4123 % \begin{macro}{\metrics_given_encoding}
4124 % This macro is a cousin of |\fromany|, for the case that metrics are
4125 % taken from a (V)PL file that furthermore is assigned nonstandard
4126 % metrics. The syntax is
4127 % \begin{quote}
4128 % |\metrics_given_encoding|\marg{font}\marg{etx}
4129 % \end{quote}
4130 % and the generated MTX file is named
4131 % \meta{font}\texttt{-}\meta{etx}\texttt{.mtx} to avoid that it is
4132 % picked up by |\fromany| by mistake.
4133 % \changes{1.929}{2005/01/12}{The \texttt{afm-name} string usually has
4134 % a value at this point, so it is necessary to reset it. (LH,
4135 % sighing because he knows this isn't the first time this problem
4136 % occurred) First to be hit by this bug was Michael Zedler.}
4137 % \begin{macrocode}
4138 \def\metrics_given_encoding#1#2{
4139 \x_cs\edef{s-afm-name}{#1-#2}
4140 \if_file_exists{#1.pl}\then
4141 \generalpltomtx{#1}{#1-#2}{pl}{#2}
4142 \else
4143 \if_file_exists{#1.vpl}\then
4144 \generalpltomtx{#1}{#1-#2}{vpl}{#2}
4145 \else
4146 \unsetstr{afm-name}
4147 \fi\fi
4148 }
4149 % \end{macrocode}
4150 % \end{macro}
4151 %
4152 %
4153 % \definechange{option-keyword}{1.924}{2002/02/16}{Added mechanism
4154 % for passing options to MTX and ETX files. (LH)}
4155 %
4156 % \begin{macro}{\reset_modifiers_hook}
4157 % The |\reset_modifiers_hook| macro contains code that initialises
4158 % all parameters that are modified by some \meta{modifier clause} to
4159 % their default values. If you need to add some initialisations due
4160 % to that you define additional keywords then you should append
4161 % these initialisations to this macro.
4162 % \usechange{option-keyword}
4163 % \begin{macrocode}
4164 \def\reset_modifiers_hook{
4165 \unsetint{rawscale}
4166 \let\glyph_name_modifier\identity_one
4167 \let\pl_encoding\empty_command
4168 \let\list_of_options\empty_command
4169 }
4170 % \end{macrocode}
4171 % \end{macro}
4172 %
4173 % \begin{macro}{\get_file_name}
4174 % The macro |\get_file_name| grabs the base font (or other MTX file)
4175 % name and starts the processing of the \meta{optional modifiers}.
4176 % \begin{macrocode}
4177 \def\get_file_name #1~{
4178 \edef\file_name{#1}
4179 \get_keyword
4180 }
4181 % \end{macrocode}
4182 % \end{macro}
4183 %
4184 % \begin{macro}{\get_keyword}
4185 % \begin{macro}{\gobble_keywords}
4186 % The |\get_keyword| macro expects to be expanded in the context
4187 % \begin{quote}
4188 % |\get_keyword|\,\meta{keyword}\verb*" "
4189 % \end{quote}
4190 % where the \meta{keyword} is a possible keyword. If
4191 % |\IFKW-|\meta{keyword} is defined then the above expands to it,
4192 % otherwise the above expands to an error message followed by a
4193 % |\gobble_keywords|, which will gobble the rest of the list of
4194 % keywords and arguments.
4195 % \begin{macrocode}
4196 \def\get_keyword #1~{
4197 \if_defined{IFKW-#1}\then
4198 \csname IFKW-#1 \expandafter\endcsname
4199 \else
4200 \fontinsterror{\string\install...}{
4201 `#1'~is~not~a~defined~keyword
4202 }{
4203 \error_help_a\messagebreak
4204 Extra~tokens~will~be~flushed.
4205 }
4206 \expandafter\gobble_keywords
4207 \fi
4208 }
4209 % \end{macrocode}
4210 % \begin{macrocode}
4211 \def\gobble_keywords#1\par{}
4212 % \end{macrocode}
4213 % \end{macro}\end{macro}
4214 %
4215 % \begin{macro}{\IFKW-}
4216 % The empty keyword is used to flag the end of the \meta{optional
4217 % modifiers}.
4218 % \begin{macrocode}
4219 \x_cs\let{IFKW-}=\gobble_keywords
4220 % \end{macrocode}
4221 % \end{macro}
4222 %
4223 % \begin{macro}{\IFKW-scaled}
4224 % This macro handles grabbing the argument of the traditional
4225 % \texttt{scaled} keyword.
4226 % \changes{1.900}{1999/02/05}{Changed \cs{setint} to \cs{resetint}.
4227 % (LH)}
4228 % \begin{macrocode}
4229 \x_cs\def{IFKW-scaled}#1~{
4230 \ifnum #1=\one_thousand
4231 \unsetint{rawscale}
4232 \else
4233 \x_resetint{rawscale}{#1}
4234 \fi
4235 \get_keyword
4236 }
4237 % \end{macrocode}
4238 % \end{macro}
4239 %
4240 % \begin{macro}{\IFKW-suffix}
4241 % This macro handles grabbing the argument of the \texttt{suffix}
4242 % keyword. The effect of `\texttt{suffix} \meta{suffix}' is that
4243 % \meta{suffix} will be appended to the name of every glyph defined
4244 % by the next MTX file to be read in.
4245 % \begin{macrocode}
4246 \x_cs\def{IFKW-suffix}#1~{
4247 \def\glyph_name_modifier##1{##1#1}
4248 \get_keyword
4249 }
4250 % \end{macrocode}
4251 % \end{macro}
4252 %
4253 % \begin{macro}{\IFKW-encoding}
4254 % \begin{macro}{\pl_encoding}
4255 % This macro handles grabbing the argument of the \texttt{encoding}
4256 % keyword. The effect of `\texttt{encoding} \meta{etx}' is that
4257 % \meta{etx} will be used as encoding when converting a PL or VPL
4258 % file to MTX. |\pl_encoding| is used for storing the argument
4259 % value. Its expansion is normally empty, which means |\fromafm|
4260 % handles locating the metrics file and the encoding used for a PL
4261 % or VPL is determined by its codingscheme.
4262 % \begin{macrocode}
4263 \x_cs\def{IFKW-encoding}#1~{
4264 \def\pl_encoding{#1}
4265 \get_keyword
4266 }
4267 \let\pl_encoding=\empty_command
4268 % \end{macrocode}
4269 % \end{macro}\end{macro}
4270 %
4271 %
4272 % \begin{macro}{\IFKW-option}
4273 % This macro handles grabbing the argument of the \texttt{option}
4274 % keyword. One can test using |\ifoption| whether a particular option
4275 % was specified.
4276 % \usechange{option-keyword}
4277 % \begin{macrocode}
4278 \x_cs\def{IFKW-option}#1~{
4279 \add_to\list_of_options{\do{#1}}
4280 }
4281 % \end{macrocode}
4282 % \end{macro}
4283 %
4284 % \begin{macro}{\ifoption}
4285 % \usechange{option-keyword}
4286 % \begin{macro}{\list_of_options}
4287 % \usechange{option-keyword}
4288 % The |\ifoption| command is used to test whether a particular option
4289 % is present on the list of options. The syntax is
4290 % \begin{quote}
4291 % |\ifoption|\marg{string}|\then|
4292 % \end{quote}
4293 % and it is tested whether the \meta{string} was one of the options
4294 % given. Like strings in general, the \meta{string} is expanded
4295 % before it is compared to the options listed in |\list_of_options|.
4296 %
4297 % The |\list_of_options| is a sequence of items on the form
4298 % \begin{quote}
4299 % |\do|\marg{option}
4300 % \end{quote}
4301 % where each \meta{option} is an already expanded string of
4302 % characters.
4303 % \begin{macrocode}
4304 \def\ifoption#1\then{
4305 \_a_false
4306 \edef\a_macro{#1}
4307 \def\do##1{
4308 \if_a_ \else
4309 \def\b_macro{##1}
4310 \ifx \a_macro\b_macro \_a_true \fi
4311 \fi
4312 }
4313 \list_of_options
4314 \if_a_
4315 }
4316 %</pkg>
4317 %<*doc>
4318 \def\ifoption#1\then{%
4319 \generic@if{option \TypesetStringExpression{#1}}%
4320 }
4321 %</doc>
4322 %<*pkg>
4323 \let\list_of_options\empty_command
4324 % \end{macrocode}
4325 % \end{macro}\end{macro}
4326 %
4327 %
4328 % \subsection{Writing font definition files}
4329 %
4330 % \begin{macro}{\fd_family}
4331 % |\fd_family{ENCODING}{FAMILY}{FD-COMMANDS}|
4332 %
4333 % Writes out an |.fd| file for the specified |ENCODING| and |FAMILY|
4334 % processing the accumulated information and default substitutions.
4335 %
4336 % \begin{macrocode}
4337 \def\fd_family#1#2#3{
4338 \a_toks{#3}
4339 \edef\lowercase_file{\lowercase{
4340 \edef\noexpand\lowercase_file{#1#2.fd}}}
4341 \lowercase_file
4342 \open_out{\lowercase_file}
4343 \out_line{\percent_char~Filename:~\lowercase_file}
4344 \out_line{\percent_char~Created~by:~tex~\jobname}
4345 \out_line{\percent_char~Created~using~fontinst~v\fontinstversion}
4346 \out_line{}
4347 \out_line{\percent_char~THIS~FILE~SHOULD~BE~PUT~IN~A~TEX~INPUTS~
4348 DIRECTORY}
4349 \out_line{}
4350 \out_line{\string\ProvidesFile{\lowercase_file}}
4351 \out_lline{[
4352 \the\year/
4353 \ifnum10>\month0\fi\the\month/
4354 \ifnum10>\day0\fi\the\day\space
4355 Fontinst~v\fontinstversion\space
4356 font~definitions~for~#1/#2.
4357 ]}
4358 \out_line{}
4359 \out_line{\string\DeclareFontFamily{#1}{#2}{\the\a_toks}}
4360 {
4361 \csname #1-#2\endcsname
4362 \out_line{}
4363 \let\do_shape=\substitute_shape
4364 \csname #1-#2\endcsname
4365 \let\do_shape=\remove_shape
4366 \csname #1-#2\endcsname
4367 }
4368 \x_cs\g_let{#1-#2}\x_relax
4369 \out_line{}
4370 \out_line{\string\endinput}
4371 \close_out{Font~definitions}
4372 }
4373 % \end{macrocode}
4374 % \end{macro}
4375 %
4376 % \begin{macro}{\fd_shape}
4377 % |\fd_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
4378 %
4379 % \begin{macrocode}
4380 \def\fd_shape#1#2#3#4{
4381 \out_line{}
4382 \out_line{\string\DeclareFontShape{#1}{#2}{#3}{#4}\left_brace_char}
4383 \csname #1-#2-#3-#4\endcsname
4384 \x_cs\g_let{#1-#2-#3-#4}\empty_command
4385 \out_line{\right_brace_char{}}
4386 }
4387 % \end{macrocode}
4388 % \end{macro}
4389 %
4390 % \begin{macro}{\fd_size}
4391 % |\fd_size{SIZE}{FONT-NAME}|
4392 %
4393 % \begin{macrocode}
4394 \def\fd_size#1#2{
4395 \x_cs\ifx{siz-#1}\x_relax
4396 \out_lline{#1~#2}
4397 \else
4398 \out_lline{\csname siz-#1\endcsname\space #2}
4399 \fi
4400 }
4401 % \end{macrocode}
4402 % \end{macro}
4403 %
4404 % \begin{macro}{\remove_shape}
4405 % |\remove_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
4406 %
4407 % \begin{macrocode}
4408 \def\remove_shape#1#2#3#4{
4409 \x_cs\g_let{#1-#2-#3-#4}\x_relax
4410 }
4411 % \end{macrocode}
4412 % \end{macro}
4413 %
4414 % \begin{macro}{\substitute_shape}
4415 % |\substitute_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}|
4416 %
4417 % \begin{macrocode}
4418 \def\substitute_shape#1#2#3#4{
4419 \edef\orig_shape{#4}
4420 \substitute_series{#1}{#2}{#3}{\orig_shape}
4421 \x_cs\ifx{sub-\orig_shape}\x_relax\else
4422 \edef\subst_shape{\csname sub-\orig_shape\endcsname}
4423 \x_cs\ifx{#1-#2-#3-\subst_shape}\x_relax
4424 \out_line{
4425 \string\DeclareFontShape{#1}{#2}{#3}{\subst_shape}{
4426 <->\csname typ-\orig_shape\endcsname\space
4427 *~#2/#3/\orig_shape
4428 }{}
4429 }
4430 \x_cs\let{#1-#2-#3-\subst_shape}\empty_command
4431 \substitute_shape{#1}{#2}{#3}{\subst_shape}
4432 \fi
4433 \fi
4434 }
4435 % \end{macrocode}
4436 % \end{macro}
4437 %
4438 % \begin{macro}{\substitute_series}
4439 % |\substitute_series{ENCODING}{FAMILY}{SERIES}{SHAPE}|
4440 %
4441 % \begin{macrocode}
4442 \def\substitute_series#1#2#3#4{
4443 \edef\orig_series{#3}
4444 \x_cs\ifx{sub-\orig_series}\x_relax\else
4445 \edef\subst_series{\csname sub-\orig_series\endcsname}
4446 \x_cs\ifx{#1-#2-\subst_series-#4}\x_relax
4447 \out_line{
4448 \string\DeclareFontShape{#1}{#2}{\subst_series}{#4}{
4449 <->\csname typ-\orig_series\endcsname\space
4450 *~#2/\orig_series/#4
4451 }{}
4452 }
4453 \x_cs\let{#1-#2-\subst_series-#4}\empty_command
4454 \substitute_series{#1}{#2}{\subst_series}{#4}
4455 \fi
4456 \fi
4457 }
4458 % \end{macrocode}
4459 % \end{macro}
4460 %
4461 % \begin{macro}{\substitutesilent}
4462 % \begin{macro}{\substitutenoisy}
4463 % These commands specify a default substitution for series or shape
4464 % \meta{to}, which points to the series or shape \meta{from}.
4465 % \begin{quote}
4466 % |\substitutesilent|\marg{to}\marg{from}\\
4467 % |\substitutenoisy|\marg{to}\marg{from}
4468 % \end{quote}
4469 % There can be at most one \meta{to} for every \meta{from}; later
4470 % substitutions will override previous ones. If \meta{to} and
4471 % \meta{from} are equal, then any existing substitution from
4472 % \meta{from} is disabled.
4473 %
4474 % The way this is implemented is that if a font has been installed
4475 % with shape or series \meta{from}, but no entry for \meta{to} has
4476 % been written, then write an entry also for \meta{to} consisting of
4477 % a substitution by \meta{from}. (After doing that, an entry has been
4478 % written also for \meta{to}, so the process may repeat itself with
4479 % the old \meta{to} as a new \meta{from}.)
4480 %
4481 % \begin{macro}{\substitute_generic}
4482 % This is the common part of |\substitutesilent| and
4483 % |\substitutenoisy|. The syntax is
4484 % \begin{quote}
4485 % |\substitute_generic|\marg{type}\marg{to}\marg{from}
4486 % \end{quote}
4487 % where \meta{type} is |ssub| or |sub| respectively.
4488 % \changes{1.931}{2005/05/12}{Macro added, to support explicit
4489 % disabling of substitutions. (LH)}
4490 % \begin{macrocode}
4491 \def\substitute_generic#1#2#3{
4492 \edef\a_macro{#2}
4493 \edef\b_macro{#3}
4494 \ifx \a_macro \b_macro
4495 \x_cs\let{sub-#3}\undefined_command
4496 \else
4497 \x_cs\let{sub-#3}\a_macro
4498 \x_cs\def{typ-#3}{#1}
4499 \fi
4500 }
4501 % \end{macrocode}
4502 % \end{macro}
4503 % \begin{macrocode}
4504 \def\substitutesilent{\substitute_generic{ssub}}
4505 \def\substitutenoisy{\substitute_generic{sub}}
4506 % \end{macrocode}
4507 % \end{macro}
4508 % \end{macro}
4509 %
4510 % \begin{macrocode}
4511 \substitutesilent{bx}{b}
4512 \substitutesilent{b}{bx}
4513 \substitutesilent{b}{sb}
4514 \substitutesilent{b}{db}
4515 \substitutesilent{m}{mb}
4516 \substitutesilent{m}{l}
4517 % \end{macrocode}
4518 % \begin{macrocode}
4519 \substitutenoisy{ui}{it}
4520 % \end{macrocode}
4521 %
4522 % I don't think we want these since in OT1 encoding it will
4523 % cause the old |<sterling>| vs |<dollar>| problem. (ASAJ)
4524 % --- Oh yes we do. (SPQR)
4525 %
4526 % \begin{macrocode}
4527 \substitutesilent{sl}{it}
4528 \substitutesilent{it}{sl}
4529 % \end{macrocode}
4530 %
4531 %
4532 % \subsection{New font substitution mechanism}
4533 %
4534 % \textbf{Note:} This subsection contains (part of) a new implementation
4535 % of the font substitution mechanism, but it is uncertain whether it
4536 % will ever be completed.
4537 % \begin{macrocode}
4538 %<*underconstruction>
4539 % \end{macrocode}
4540 %
4541 %
4542 % \subsubsection{The substitution graph}
4543 %
4544 % Which substitutions are performed are determined by the substitution
4545 % graph. The vertices of this graph are all combinations of a series and
4546 % a shape. The arcs (directed edges) of this graph are the substitutions
4547 % that can be made. Each arc has a wheight---a real number in the range
4548 % $[0,1]$---that describes how much of the quality of the font that is
4549 % preserved with this substitution.
4550 %
4551 % As an example, consider the case that there is an arc from \texttt{m/it}
4552 % to \texttt{m/sl} and that the wheight of this arc is $0.5$. This means
4553 % that it is OK to substitute the medium italic (\texttt{m/it}) font as a
4554 % medium slanted (\texttt{m/sl}) font if there is no medium slanted font,
4555 % but that the medium italic font is only considered as being half
4556 % ($0.5$) as good a medium slanted font as it is a medium italic font.
4557 %
4558 % The main problem the substitution mechanism has to solve in this
4559 % context is to find the best possible way of substituting a font, given
4560 % the real fonts which has actually been installed (using |\installfont|
4561 % or |\installrawfont|). The solution to this problem is computed by a
4562 % brute force approach---all possible substitution paths are followed
4563 % and during this process the best solution so far, for each vertex
4564 % separately, is stored.
4565 % \medskip
4566 %
4567 % In practice, the substitution graph $G$ is constructed as the cartesian
4568 % product of one graph $G\sb{1}$ of series substitutions and one graph
4569 % $G\sb{2}$ of shape substitutions, with the option of adding some
4570 % additional arcs to this product. The reason for this is that one
4571 % usually wants to make the same shape substitutions in all series and
4572 % vice versa, so by only storing the $G\sb{1}$ and $G\sb{2}$ graphs, plus
4573 % perhaps a handfull of extra edges, one gets away with using fewer
4574 % tokens.
4575 % The wheights of the arcs are stored as integers in the range 0--1000,
4576 % where 0 means the real number $0$ and 1000 means the real number $1$.
4577 % \medskip
4578 %
4579 % \DescribeMacro\do_arc
4580 % The |\do_arc| macro is probably the most common in the data
4581 % structures that constitute the substitution graph. Its syntax is
4582 % always
4583 % \begin{quote}
4584 % |\do_arc|\marg{series}\marg{shape}\marg{wheight}
4585 % \end{quote}
4586 % but it is meant to be redefined whenever one needs to do something
4587 % ``for all arcs'' (usually all arcs at a given vertex or so). There are
4588 % three families of macros which consist of |\do_arc| lists, namely
4589 % \begin{quote}
4590 % |\sub1-|\meta{series}\\
4591 % |\sub2-|\meta{shape}\\
4592 % |\sub-|\meta{series}|-|\meta{shape}
4593 % \end{quote}
4594 % These macros store arcs going out from a vertex. The
4595 % |\sub1-|\meta{series} macross store the arcs incident with the vertex
4596 % \meta{series} in the series substitution graph $G\sb{1}$. The
4597 % |\sub2-|\meta{shape} macros store the arcs incident with the vertex
4598 % \meta{shape} in the shape substitution graph $G\sb{2}$. The
4599 % |\sub-|\meta{series}|-|\meta{shape} macros store the arcs of $G$ that
4600 % are incident with the vertex \meta{series}|/|\meta{shape} but do
4601 % \emph{not} appear in the cartesian product $G\sb{1} \times G\sb{2}$.
4602 %
4603 % The \meta{series} and \meta{shape} arguments of |\do_arc| tells which
4604 % vertex the arc goes to, hence for example |\do_arc{b}{it}{600}| in the
4605 % macro |\sub-db-sl| corresponds to an arc going from the |db/sl| vertex
4606 % to the |b/it| vertex and having a wheight of $0.6$.
4607 %
4608 % \DescribeMacro\curr_series
4609 % \DescribeMacro\curr_shape
4610 % The above omits one important detail, namely that the \meta{shape}
4611 % argument for a |\do_arc| in a |\sub1-|\textellipsis\ must be able to
4612 % be \emph{all} shapes since the shape is not determined for arcs in
4613 % $G\sb{1}$ and the series is likewise for arcs in $G\sb{2}$. To make things
4614 % work anyway, there are two macros |\curr_series| and |\curr_shape|
4615 % which contain this missing information. Furthermore, a |\do_arc| item
4616 % for an arc in $G\sb{1}$ will always have the structure
4617 % \begin{quote}
4618 % |\do_arc|\marg{series}|\curr_shape|\marg{wheight}
4619 % \end{quote}
4620 % and a |\do_arc| item for an arc in $G\sb{2}$ will have the structure
4621 % \begin{quote}
4622 % |\do_arc\curr_series|\marg{shape}\marg{wheight}
4623 % \end{quote}
4624 %
4625 %
4626 % \begin{macro}{\substituteshape}
4627 % \begin{macro}{\substituteseries}
4628 % \begin{macro}{\substituteseriesshape}
4629 % |\substituteshape|\marg{to}\marg{from}\marg{wheight}\\
4630 % |\substituteseries|\marg{to}\marg{from}\marg{wheight}\\
4631 % |\substituteseriesshape|\marg{toseries}\marg{toshape}^^A
4632 % \marg{fromseries}\marg{fromshape}\marg{wheight}
4633 %
4634 % \begin{macrocode}
4635 \def\substituteshape#1#2#3{
4636 \round_wheight{#3}
4637 \edef\temp_command{#1}
4638 \edef\sub_suffix{#2}
4639 \ifx \temp_command\sub_suffix \else
4640 \def\sub_suffix##1##2{2-##2}
4641 \def\do_arc##1##2##3{
4642 \x_cs\ifx{sub2-##2}R \else
4643 \noexpand\do_arc\noexpand\curr_series{##2}{##3}
4644 \fi
4645 }
4646 \update_do_arc_list{}{#2}{}{#1}{\noexpand\curr_series{#1}}
4647 \fi
4648 }
4649 % \end{macrocode}
4650 % \begin{macrocode}
4651 \def\substituteseries#1#2#3{
4652 \round_wheight{#3}
4653 \edef\temp_command{#1}
4654 \edef\sub_suffix{#2}
4655 \ifx \temp_command\sub_suffix \else
4656 \def\sub_suffix##1##2{1-##1}
4657 \def\do_arc##1##2##3{
4658 \x_cs\ifx{sub1-##1}R \else
4659 \noexpand\do_arc{##1}\noexpand\curr_shape{##3}
4660 \fi
4661 }
4662 \update_do_arc_list{#2}{}{#1}{}{{#1}\noexpand\curr_shape}
4663 \fi
4664 }
4665 % \end{macrocode}
4666 % \begin{macrocode}
4667 \def\substituteseriesshape#1#2#3#4#5{
4668 \round_wheight{#5}
4669 \edef\temp_command{#1-#2}
4670 \edef\sub_suffix{#3-#4}
4671 \ifx \temp_command\sub_suffix \else
4672 \def\sub_suffix##1##2{-##1-##2}
4673 \def\do_arc##1##2##3{
4674 \x_cs\ifx{sub-##1-##2}R \else
4675 \noexpand\do_arc{##1}{##2}{##3}
4676 \fi
4677 }
4678 \update_do_arc_list{#3}{#4}{#1}{#2}{{#1}{#2}}
4679 \fi
4680 }
4681 % \end{macrocode}
4682 % \begin{macrocode}
4683 \def\round_wheight#1{
4684 \eval_expr{#1}
4685 \ifnum \one_thousand<\result
4686 \result=\one_thousand
4687 \else \ifnum 0>\result
4688 \result=\z@
4689 \fi\fi
4690 }
4691 % \end{macrocode}
4692 %
4693 % |\update_do_arc_list|\marg{update-series}\marg{update-shape}^^A
4694 % \allowbreak\marg{tag-series}\allowbreak\marg{tag-shape}^^A
4695 % \allowbreak\marg{inserted series+shape}
4696 %
4697 % \begin{macrocode}
4698 \def\update_do_arc_list#1#2#3#4#5{
4699 \bgroup
4700 \edef\temp_command{sub\sub_suffix{#1}{#2}}
4701 \x_cs\let{sub\sub_suffix{#3}{#4}}=R
4702 \x_cs\xdef\temp_command{
4703 \x_cs\ifx\temp_command\relax \else
4704 \csname\temp_command\endcsname
4705 \fi
4706 \ifnum 0<\result
4707 \noexpand\do_arc #5{\the\result}
4708 \fi
4709 }
4710 \egroup
4711 }
4712 % \end{macrocode}
4713 % \end{macro}\end{macro}\end{macro}
4714 %
4715 %
4716 %
4717 % \begin{macro}{\substitutesilent}
4718 % \begin{macro}{\substitutenoisy}
4719 % |\substitutesilent{TO}{FROM}|\\
4720 % |\substitutenoisy{TO}{FROM}|
4721 %
4722 % Specifies a default substitution for family or shape |TO|,
4723 % which is substituted by family or shape |FROM|.
4724 %
4725 % \begin{macrocode}
4726 \def\substitutesilent#1#2{
4727 \substituteseries{#1}{#2}{900}
4728 \substituteshape{#1}{#2}{900}
4729 }
4730 \def\substitutenoisy#1#2{
4731 \substituteseries{#1}{#2}{500}
4732 \substituteshape{#1}{#2}{500}
4733 }
4734 % \end{macrocode}
4735 % \end{macro}
4736 % \end{macro}
4737 %
4738 % \begin{macrocode}
4739 \a_count=900 % Silent substitution wheight
4740 \b_count=500 % Noisy substitution wheight
4741 \substituteseries{bx}{b}{\a_count}
4742 \substituteseries{b}{bx}{\a_count}
4743 \substituteseries{b}{sb}{\a_count}
4744 \substituteseries{b}{db}{\a_count}
4745 \substituteseries{m}{mb}{\a_count}
4746 \substituteseries{m}{l}{\a_count}
4747 % \end{macrocode}
4748 % \begin{macrocode}
4749 \substituteshape{ui}{it}{\b_count}
4750 % \end{macrocode}
4751 %
4752 % I don't think we want these since in OT1 encoding it will
4753 % cause the old |<sterling>| vs |<dollar>| problem. (ASAJ)
4754 % --- Oh yes we do. (SPQR)
4755 %
4756 % \begin{macrocode}
4757 \substituteshape{sl}{it}{\a_count}
4758 \substituteshape{it}{sl}{\a_count}
4759 % \end{macrocode}
4760 %
4761 %
4762 % \subsubsection{Listing reachable vertices}
4763 %
4764 % While determining the optimal substitutions, there is a need to store
4765 % some---more or less temporary---information for each vertex. Such
4766 % information will be called a \emph{property} of the vertex and it is
4767 % stored in the |\v-|\meta{series}|-|\meta{shape} family of macros.
4768 %
4769 % The following are the basic properties:
4770 % \begin{list}{}{^^A
4771 % ^^A How does one make the label go on a line of its own??
4772 % }
4773 % \item[\cs{real_font}\marg{quality}]
4774 % This expresses that this vertex corresponds to a font that has
4775 % actually been installed with a nominal quality of \meta{quality}.
4776 % \item[\cs{subs_font}\marg{series}\marg{shape}\marg{quality}]
4777 % This expresses that this vertex corresponds to a font for which
4778 % the font \meta{series}|/|\meta{shape} has been substituted.
4779 % \meta{quality} is the quality this substitution is considered to
4780 % have.
4781 % \item
4782 % \end{list}
4783 %
4784 %
4785 % There will also be some lists of vertices. These will consist of simple
4786 % |\do|\marg{series}\marg{shape} triples.
4787 %
4788 % \begin{macrocode}
4789 \def\list_subs_vertices{
4790 \def\subs_vertex_list{}
4791 \let\do_arc=\subs_do_arc
4792 \let\do=\never_do
4793 \def\real_font##1{\c_count=\@MM}
4794 \def\subs_font##1##2##3{\c_count=##3\relax}
4795 \real_vertex_list
4796 }
4797 \def\subs_do_arc#1#2#3{
4798 \b_count=#3
4799 \multiply \b_count \a_count
4800 \divide \b_count \one_thousand
4801 \c_count=-\max_mathchardef
4802 \csname v-#1-#2\endcsname
4803 \ifnum \c_count<\b_count
4804 \ifnum \c_count=-\max_mathchardef
4805 \edef\subs_vertex_list{\subs_vertex_list\do{#1}{#2}}
4806 \fi
4807 \x_cs\edef{v-#1-#2}{\noexpand\subs_font{\subs_series}
4808 {\subs_shape}{\the\b_count}}
4809 \toks_a=\expandafter{\the\a_toks \do_subs{#1}{#2}}
4810 \fi
4811 }
4812 \def\do_subs#1#2{
4813 \edef\curr_series{#1}
4814 \edef\curr_shape{#2}
4815 \csname v-#1-#2\endcsname
4816 \a_count=\c_count
4817 \a_toks={}
4818 \csname sub-#1-#2\endcsname
4819 \csname sub1-#1\endcsname
4820 \csname sub2-#2\endcsname
4821 \the\a_toks
4822 }
4823 \def\start_subs_at#1#2{
4824 \edef\subs_series{#1} \let\curr_series=\subs_series
4825 \edef\subs_shape{#2} \let\curr_shape=\subs_shape
4826 \a_count=\x_cs\second_of_two{v-#1-#2}
4827 \a_toks={}
4828 \csname sub-#1-#2\endcsname
4829 \csname sub1-#1\endcsname
4830 \csname sub2-#2\endcsname
4831 \the\a_toks
4832 }
4833 % \end{macrocode}
4834 %
4835 %
4836 % \begin{macrocode}
4837 %</underconstruction>
4838 % \end{macrocode}
4839 %
4840 %
4841 % \subsection{Default encodings and font sizes}
4842 %
4843 % \begin{macro}{\declareencoding}
4844 % |\declareencoding{CODINGSCHEME}{ENCODING}|
4845 %
4846 % Declare a macro |\enc-CODINGSCHEME| which expands to |ENCODING|.
4847 % This is used to determine the encoding in |\pltomtx|.
4848 % \changes{1.927}{2004/07/31}{Lowercased encoding file names. (LH)}
4849 %
4850 % \begin{macrocode}
4851 \def\declareencoding#1#2{\x_cs\edef{enc-#1}{#2}}
4852 % \end{macrocode}
4853 % \end{macro}
4854 %
4855 % Old \TeX{} text font encodings.
4856 % \begin{macrocode}
4857 \declareencoding{TEX~TEXT}{ot1}
4858 \declareencoding{TEX~TEXT~WITHOUT~F-LIGATURES}{ot1}
4859 \declareencoding{TEX~TYPEWRITER~TEXT}{ot1tt}
4860 % \end{macrocode}
4861 %
4862 % Old \TeX{} math font encodings.
4863 % \begin{macrocode}
4864 \declareencoding{TEX~MATH~ITALIC}{oml}
4865 \declareencoding{TEX~MATH~SYMBOLS}{oms}
4866 \declareencoding{TEX~MATH~EXTENSION}{omx}
4867 \declareencoding{LATEX~SYMBOLS}{lasy}
4868 % \end{macrocode}
4869 %
4870 % Euler math font encodings.
4871 % \begin{macrocode}
4872 \declareencoding{TEX~TEXT~SUBSET}{eufrak}
4873 \declareencoding{TEX~MATH~ITALIC~SUBSET}{eurm}
4874 \declareencoding{TEX~MATH~SYMBOLS~SUBSET}{euscr}
4875 \declareencoding{EULER~SUBSTITUTIONS~ONLY}{euex}
4876 % \end{macrocode}
4877 %
4878 % New \TeX{} text font encodings.
4879 % \begin{macrocode}
4880 \declareencoding{EXTENDED~TEX~FONT~ENCODING~-~LATIN}{t1}
4881 \declareencoding{TEX~TEXT~COMPANION~SYMBOLS~1---TS1}{ts1}
4882 % \end{macrocode}
4883 %
4884 % Rencoded PostScript font encdings.
4885 % \begin{macrocode}
4886 \declareencoding{TEXBASE1ENCODING}{8r}
4887 \declareencoding{TEX~TYPEWRITER~AND~WINDOWS~ANSI}{8y}
4888 % \end{macrocode}
4889 %
4890 % \begin{macro}{\declaresize}
4891 % |\declaresize{FONTSIZE}{LATEXSIZE}|
4892 %
4893 % \begin{macrocode}
4894 \def\declaresize#1#2{\x_cs\edef{siz-#1}{#2}}
4895 % \end{macrocode}
4896 % \end{macro}
4897 %
4898 % Default sizes. An empty size argument is equivalent to |<->|,
4899 % for use with scalable fonts.
4900 %
4901 % \begin{macrocode}
4902 \declaresize{}{<->}
4903 \declaresize{5}{<5>}
4904 \declaresize{6}{<6>}
4905 \declaresize{7}{<7>}
4906 \declaresize{8}{<8>}
4907 \declaresize{9}{<9>}
4908 \declaresize{10}{<10>}
4909 \declaresize{11}{<10.95>}
4910 \declaresize{12}{<12>}
4911 \declaresize{14}{<14.4>}
4912 \declaresize{17}{<17.28>}
4913 \declaresize{20}{<20.74>}
4914 \declaresize{25}{<24.88>}
4915 % \end{macrocode}
4916 %
4917 %
4918 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4919 %
4920 % \section{Debugging}
4921 %
4922 % \begin{macro}{\NOFILES}
4923 % |\NOFILES| switches off file generation, and causes
4924 % \package{fontinst} to only generate empty files. It only affects the
4925 % user level commands, so it is primarily of use when debugging
4926 % commands that build on these, such as for example the
4927 % |\latin|\-|family| command.
4928 % \changes{1.914}{2000/05/20}{Added \cs{reglyphfont}. (LH)}
4929 % \begin{macrocode}
4930 \def\NOFILES{
4931 \def\transformfont##1##2{
4932 \touch_file{##1.mtx}
4933 \touch_file{##1.pl}
4934 }
4935 \def\reglyphfont##1##2{\touch_file{##1.mtx}}
4936 \def\installfonts{}
4937 \def\endinstallfonts{}
4938 \def\installfont##1##2##3##4##5##6##7##8{
4939 \touch_file{##1.vpl}
4940 }
4941 \def\installrawfont##1##2##3##4##5##6##7##8{
4942 \touch_file{##1.pl}
4943 }
4944 \def\installfamily##1##2##3{\touch_file{##1##2.fd}}
4945 }
4946 % \end{macrocode}
4947 % \end{macro}
4948 %
4949 % \begin{macro}{\touch_file}
4950 % \begin{macrocode}
4951 \def\touch_file#1{
4952 \edef\lowercase_file{\lowercase{
4953 \edef\noexpand\lowercase_file{#1}}}
4954 \lowercase_file
4955 \open_out{\lowercase_file}
4956 \out_line{\percent_char~TEST~FILE.}
4957 \out_line{\percent_char~Created~whilst~debugging~fontinst.}
4958 \close_out{Test~file}
4959 }
4960 %</pkg>
4961 % \end{macrocode}
4962 % \end{macro}
4963 %
4964 % \Finale
4965 \endinput