| 1 |
% \CheckSum{1505} |
| 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, 2001, 2002, 2003, 2004, 2005 |
| 7 |
% the fontinst maintenance team and any individual authors listed |
| 8 |
% elsewhere in this file. All rights reserved. |
| 9 |
% |
| 10 |
% This file is part of the fontinst system version 1.9. |
| 11 |
% ----------------------------------------------------- |
| 12 |
% |
| 13 |
% It may be distributed under the terms of the LaTeX Project Public |
| 14 |
% License, as described in lppl.txt in the base LaTeX distribution. |
| 15 |
% Either version 1.1 or, at your option, any later version. |
| 16 |
% |
| 17 |
%%% From file: fibasics.dtx |
| 18 |
% |
| 19 |
%<*driver> |
| 20 |
\documentclass{ltxdoc} |
| 21 |
\title{The \package{fontinst} utility} |
| 22 |
\author{Alan Jeffrey\and Sebastian Rahtz\and Ulrik Vieth\and |
| 23 |
Lars Hellstr\"om} |
| 24 |
\usepackage{fisource} |
| 25 |
\begin{document} |
| 26 |
\maketitle |
| 27 |
\DocInput{fibasics.dtx} |
| 28 |
\PrintIndex |
| 29 |
\end{document} |
| 30 |
%</driver> |
| 31 |
% \fi |
| 32 |
% |
| 33 |
% \StopEventually{} |
| 34 |
% |
| 35 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 36 |
% |
| 37 |
% \begin{quote} |
| 38 |
% ``Can't say I've ever been too fond of beginnings, myself. |
| 39 |
% \emph{Messy} little things. Give me a good ending any time. |
| 40 |
% You know where you \emph{are} with an ending.''\relax |
| 41 |
% \nobreak\hskip 0pt plus 1fill\penalty0\hskip 2em\relax |
| 42 |
% \vadjust{}\nobreak\hskip 1em plus 1fill\textemdash |
| 43 |
% \ from \emph{The kindly ones} by \textsc{Neil Gaiman} et al.^^A |
| 44 |
% \nobreak\hskip-\parfillskip\vadjust{} |
| 45 |
% \end{quote} |
| 46 |
% |
| 47 |
% |
| 48 |
% \section{The first and the last} |
| 49 |
% |
| 50 |
% \subsection{Version numbers} |
| 51 |
% |
| 52 |
% We start by making some default catcode assignments, in case we are |
| 53 |
% using ini\TeX{}. |
| 54 |
% \begin{macrocode} |
| 55 |
%<*pkg> |
| 56 |
\catcode`\{=1 |
| 57 |
\catcode`\}=2 |
| 58 |
\catcode`\#=6 |
| 59 |
\catcode`\^=7 |
| 60 |
%</pkg> |
| 61 |
% \end{macrocode} |
| 62 |
% |
| 63 |
% \begin{macro}{\fontinstversion} |
| 64 |
% If we are running under ini\TeX{} we cannot put the identification |
| 65 |
% stuff any earlier than this. Note that |\fontinstversion| is not |
| 66 |
% just used for indentification but also in |\needsfontinstversion|. |
| 67 |
% \begin{macrocode} |
| 68 |
%<pkg|doc>\def\fontinstversion{1.933} |
| 69 |
% \end{macrocode} |
| 70 |
% \end{macro} |
| 71 |
% |
| 72 |
% If we are running under ini\TeX{} or \texttt{plain}, we have to get |
| 73 |
% around the \LaTeX{}-specific |\ProvidesPackage| stuff. |
| 74 |
% |
| 75 |
% \begin{macrocode} |
| 76 |
%<*pkg> |
| 77 |
\ifx\ProvidesPackage\undefined |
| 78 |
\def\NeedsTeXFormat#1{} |
| 79 |
\def\ProvidesPackage#1[#2]{} |
| 80 |
\fi |
| 81 |
%</pkg> |
| 82 |
% \end{macrocode} |
| 83 |
% |
| 84 |
% Now we can identify ourselves as usual. |
| 85 |
% |
| 86 |
% \begin{macrocode} |
| 87 |
%<doc>\NeedsTeXFormat{LaTeX2e}[1995/06/01] |
| 88 |
%<doc>\ProvidesPackage{fontdoc} |
| 89 |
%<pkg>\ProvidesPackage{fontinst} |
| 90 |
%<pkg|doc>[2007/01/23 v\fontinstversion\space |
| 91 |
%<doc> fontinst documentation package] |
| 92 |
%<pkg> fontinst installation package] |
| 93 |
% \end{macrocode} |
| 94 |
% |
| 95 |
% While we're at version numbers anyway, we might as well define the |
| 96 |
% command for testing them. Note however that the module name is not |
| 97 |
% \Module{pkg} as above, but \Module{pkg2}. Code in the latter module |
| 98 |
% ends up at the very end of \texttt{fontinst.sty}! |
| 99 |
% |
| 100 |
% \begin{macro}{\needsfontinstversion} |
| 101 |
% The macro: |
| 102 |
% \begin{quote} |
| 103 |
% |\needsfontinstversion|\marg{number} |
| 104 |
% \end{quote} |
| 105 |
% checks the version number. |
| 106 |
% |
| 107 |
% \begin{macrocode} |
| 108 |
%<*pkg2> |
| 109 |
\def\needsfontinstversion#1{{ |
| 110 |
\a_dimen=#1pt |
| 111 |
\b_dimen=\fontinstversion~pt\x_relax |
| 112 |
\ifnum\a_dimen>\b_dimen |
| 113 |
\immediate\write16{} |
| 114 |
\immediate\write16{Warning:~This~file~needs~fontinst~version~#1.} |
| 115 |
\immediate\write16{Warning:~You~are~using~version~ |
| 116 |
\fontinstversion.} |
| 117 |
\immediate\write16{Warning:~This~may~cause~errors.} |
| 118 |
\immediate\write16{} |
| 119 |
\fi |
| 120 |
}} |
| 121 |
%</pkg2> |
| 122 |
% \end{macrocode} |
| 123 |
% |
| 124 |
% In \package{fontdoc}, |\needsfontinstversion| is printed out as a |
| 125 |
% comment. |
| 126 |
% \changes{1.918}{2001/06/19}{Different formatting in encoding |
| 127 |
% specification files. (LH)} |
| 128 |
% \begin{macrocode} |
| 129 |
%<*doc> |
| 130 |
\newcommand*\needsfontinstversion[1]{% |
| 131 |
\ifFD@spec@ |
| 132 |
\comment{Automatic processing of this document as a data file |
| 133 |
requires \textsf{fontinst} v\,#1 or higher.}% |
| 134 |
\else |
| 135 |
\Bheading{Needs fontinst v\thinspace#1}% |
| 136 |
\fi |
| 137 |
} |
| 138 |
%</doc> |
| 139 |
% \end{macrocode} |
| 140 |
% \end{macro} |
| 141 |
% |
| 142 |
% |
| 143 |
% \subsection{Special catcodes and configuration file} |
| 144 |
% |
| 145 |
% \package{fontinst} uses some unusual, but convenient, settings of |
| 146 |
% |\catcode|. |@| and |_| are made letters, |~| is made a space, and |
| 147 |
% space and newline are ignored. Before setting those however, we save |
| 148 |
% the current values of the catcodes, so that they can be restored at |
| 149 |
% the end of \texttt{fontinst.sty}. |
| 150 |
% |
| 151 |
% \begin{macro}{\normalcc} |
| 152 |
% \begin{macro}{\fontinstcc} |
| 153 |
% \multchanges{\cs{fontinstcc}\cs{normalcc}}{1.915}{2000/08/09}^^A |
| 154 |
% {Introduced commands for changing between \package{fontinst} |
| 155 |
% internal catcodes and normal catcodes, as suggested by |
| 156 |
% Karsten Tinnefeld. (LH)} |
| 157 |
% The |\fontinstcc| command changes the catcodes of certain characters |
| 158 |
% to what is used in the \package{fontinst} source and the |\normalcc| |
| 159 |
% command changes them back; their use is analogous to that of the |
| 160 |
% |\make|\-|at|\-|letter| and |\make|\-|at|\-|other| commands in |
| 161 |
% \LaTeX. |
| 162 |
% |
| 163 |
% If, for some reason, you use other ``normal'' catcodes than |
| 164 |
% \package{fontinst} does by default, you may have to redefine |
| 165 |
% |\fontinstcc| and |\normalcc|. The easiest way to do this is |
| 166 |
% probably to use the |\add_to| macro. |
| 167 |
% |
| 168 |
% \multchanges{\cs{spacecatcode}\cs{nlcatcode}\cs{atcatcode}^^A |
| 169 |
% \cs{underscorecatcode}\cs{tildecatcode}}{1.915}{2000/08/09}^^A |
| 170 |
% {Removed since the contents can just as well be stored in |
| 171 |
% \cs{normalcc}. (LH)} |
| 172 |
% \begin{macrocode} |
| 173 |
%<*pkg> |
| 174 |
\def\a_macro#1{\catcode\number`#1=\the\catcode`#1 } |
| 175 |
\edef\normalcc{% |
| 176 |
\a_macro{\ }\a_macro{\^^M}\a_macro{\@}\a_macro{\_}\a_macro{\~} |
| 177 |
} |
| 178 |
% \end{macrocode} |
| 179 |
% The above definition makes the |\normalcc| macro end with a space. |
| 180 |
% This is deliberate; the space is used to terminate the last number |
| 181 |
% in the macro. |
| 182 |
% |
| 183 |
% \begin{macrocode} |
| 184 |
\def\fontinstcc{% |
| 185 |
\catcode`\ =9% |
| 186 |
\catcode`\^^M=9% |
| 187 |
\catcode`\@=11% |
| 188 |
\catcode`\_=11% |
| 189 |
\catcode`\~=10 |
| 190 |
} |
| 191 |
\fontinstcc |
| 192 |
%</pkg> |
| 193 |
% \end{macrocode} |
| 194 |
% \end{macro}\end{macro} |
| 195 |
% |
| 196 |
% We input the \texttt{fontinst.rc} file, if it exists.\relax |
| 197 |
% \changes{1.6}{1997/02/07}{\texttt{fontinst.rc} search order changed |
| 198 |
% (Thierry Bouche).}\relax |
| 199 |
% \SortIndex{fontinst.rc file}{\texttt{fontinst.rc} file} |
| 200 |
% |
| 201 |
% UV, 06/1998: What is this \texttt{fontinst.rc} file good for? |
| 202 |
% It turns out that you can use it to do |\def\raw_encoding{8y}| |
| 203 |
% if you prefer to install your fonts the other way. |
| 204 |
% |
| 205 |
% \begin{macrocode} |
| 206 |
%<*pkg2> |
| 207 |
%<*!misc> |
| 208 |
\if_file_exists{fontinst.rc}\then |
| 209 |
\primitiveinput fontinst.rc |
| 210 |
\else |
| 211 |
\immediate\write16{No~file~fontinst.rc.} |
| 212 |
\fi |
| 213 |
%</!misc> |
| 214 |
% \end{macrocode} |
| 215 |
% Use a different configuration file for \texttt{finstmsc.sty}.^^A |
| 216 |
% \changes{1.905}{1999/06/21}{Different config file for |
| 217 |
% \texttt{finstmsc.sty}. (LH)} |
| 218 |
% \begin{macrocode} |
| 219 |
%<*misc> |
| 220 |
\if_file_exists{finstmsc.rc}\then |
| 221 |
\primitiveinput finstmsc.rc |
| 222 |
\else |
| 223 |
\immediate\write16{No~file~finstmsc.rc.} |
| 224 |
\fi |
| 225 |
%</misc> |
| 226 |
% \end{macrocode} |
| 227 |
% |
| 228 |
% At the end of \texttt{fontinst.sty}, we restore the catcodes we |
| 229 |
% changed. |
| 230 |
% \changes{1.910}{1999/11/01}{Catcodes restored \emph{after} reading |
| 231 |
% \texttt{.rc} file. (LH\&UV)} |
| 232 |
% |
| 233 |
% \begin{macrocode} |
| 234 |
\normalcc |
| 235 |
%</pkg2> |
| 236 |
% \end{macrocode} |
| 237 |
% |
| 238 |
% |
| 239 |
% \subsection |
| 240 |
% {Plain \TeX{} macros from \texttt{fontinst.ini}} |
| 241 |
% ^^A \subsection{PlainTeX macros from fontinst.ini} |
| 242 |
% |
| 243 |
% If we're running in ini\TeX{} we input some definitions taken |
| 244 |
% from \texttt{plain}. |
| 245 |
% |
| 246 |
% \begin{macrocode} |
| 247 |
%<*pkg> |
| 248 |
\ifx\@ne\undefined_command |
| 249 |
\input fontinst.ini\relax |
| 250 |
\fi |
| 251 |
%</pkg> |
| 252 |
% \end{macrocode} |
| 253 |
% |
| 254 |
% \begin{macrocode} |
| 255 |
%<*ini> |
| 256 |
\chardef\active=13 |
| 257 |
|
| 258 |
\chardef\@ne=1 |
| 259 |
\chardef\tw@=2 |
| 260 |
\chardef\thr@@=3 |
| 261 |
\chardef\sixt@@n=16 |
| 262 |
\chardef\@cclv=255 |
| 263 |
\mathchardef\@cclvi=256 |
| 264 |
\mathchardef\@m=1000 |
| 265 |
\mathchardef\@M=10000 |
| 266 |
\mathchardef\@MM=20000 |
| 267 |
|
| 268 |
\count10=22 % allocates \count registers 23, 24, ... |
| 269 |
\count11=9 % allocates \dimen registers 10, 11, ... |
| 270 |
\count15=9 % allocates \toks registers 10, 11, ... |
| 271 |
\count16=-1 % allocates input streams 0, 1, ... |
| 272 |
\count17=-1 % allocates output streams 0, 1, ... |
| 273 |
\count20=255 % allocates insertions 254, 253, ... |
| 274 |
\countdef\insc@unt=20 % the insertion counter |
| 275 |
\countdef\allocationnumber=21 % the most recent allocation |
| 276 |
\countdef\m@ne=22 \m@ne=-1 % a handy constant |
| 277 |
\def\wlog{\immediate\write\m@ne} % write on log file (only) |
| 278 |
|
| 279 |
\countdef\count@=255 |
| 280 |
\dimendef\dimen@=0 |
| 281 |
|
| 282 |
\outer\def\newcount{\alloc@0\count\countdef\insc@unt} |
| 283 |
\outer\def\newdimen{\alloc@1\dimen\dimendef\insc@unt} |
| 284 |
\outer\def\newtoks{\alloc@5\toks\toksdef\@cclvi} |
| 285 |
\outer\def\newread{\alloc@6\read\chardef\sixt@@n} |
| 286 |
\outer\def\newwrite{\alloc@7\write\chardef\sixt@@n} |
| 287 |
|
| 288 |
\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne |
| 289 |
\ch@ck#1#4#2% make sure there's still room |
| 290 |
\allocationnumber=\count1#1% |
| 291 |
\global#3#5=\allocationnumber |
| 292 |
\wlog{\string#5=\string#2\the\allocationnumber}} |
| 293 |
\outer\def\newinsert#1{\global\advance\insc@unt by\m@ne |
| 294 |
\ch@ck0\insc@unt\count |
| 295 |
\ch@ck1\insc@unt\dimen |
| 296 |
\ch@ck2\insc@unt\skip |
| 297 |
\ch@ck4\insc@unt\box |
| 298 |
\allocationnumber=\insc@unt |
| 299 |
\global\chardef#1=\allocationnumber |
| 300 |
\wlog{\string#1=\string\insert\the\allocationnumber}} |
| 301 |
\def\ch@ck#1#2#3{\ifnum\count1#1<#2% |
| 302 |
\else\errmessage{No~room~for~a~new~#3}\fi} |
| 303 |
|
| 304 |
\outer\def\newif#1{\count@\escapechar \escapechar\m@ne |
| 305 |
\expandafter\expandafter\expandafter |
| 306 |
\edef\@if#1{true}{\let\noexpand#1=\noexpand\iftrue}% |
| 307 |
\expandafter\expandafter\expandafter |
| 308 |
\edef\@if#1{false}{\let\noexpand#1=\noexpand\iffalse}% |
| 309 |
\@if#1{false}\escapechar\count@} % the condition starts out false |
| 310 |
\def\@if#1#2{\csname\expandafter\if@\string#1#2\endcsname} |
| 311 |
{\uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}}} % `if' is required |
| 312 |
|
| 313 |
\newdimen\p@ \p@=1pt % this saves macro space and time |
| 314 |
\newdimen\z@ \z@=0pt % can be used both for 0pt and 0 |
| 315 |
|
| 316 |
\def\space{~} |
| 317 |
\let\bgroup={ |
| 318 |
\let\egroup=} |
| 319 |
|
| 320 |
\def\loop#1\repeat{\def\body{#1}\iterate} |
| 321 |
\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next} |
| 322 |
\let\repeat=\fi % this makes \loop...\if...\repeat skippable |
| 323 |
|
| 324 |
\def\supereject{\par\penalty-\@MM} |
| 325 |
\outer\def\bye{\par\vfill\supereject\end} |
| 326 |
%</ini> |
| 327 |
% \end{macrocode} |
| 328 |
% The two last commands above also need to be defined if we're |
| 329 |
% running under \LaTeX. In that case we need to be careful with |\bye| |
| 330 |
% however, as no |\if|\textellipsis\ can skip over code that explicitly |
| 331 |
% contains that control sequence, if it has been defined as above. |
| 332 |
% \begin{macrocode} |
| 333 |
%<*pkg> |
| 334 |
\ifx\bye\undefined_command |
| 335 |
\def\supereject{\par\penalty-\@MM} |
| 336 |
\outer\expandafter\def \csname bye\endcsname |
| 337 |
{\par\vfill\supereject\@@end} |
| 338 |
\fi |
| 339 |
%</pkg> |
| 340 |
% \end{macrocode} |
| 341 |
% |
| 342 |
% \changes{1.910}{1999/11/01}{Make \cs{everyjob} code optional, and |
| 343 |
% simplify it a little. (LH\&UV)} |
| 344 |
% \begin{macrocode} |
| 345 |
%<*ini&everyjob> |
| 346 |
\everyjob{% |
| 347 |
\if_file_exists{fontinst.rc}\then |
| 348 |
\primitiveinput~fontinst.rc |
| 349 |
\else |
| 350 |
\immediate\write16{No~file~fontinst.rc.} |
| 351 |
\fi |
| 352 |
} |
| 353 |
%</ini&everyjob> |
| 354 |
% \end{macrocode} |
| 355 |
% |
| 356 |
% |
| 357 |
% \section{Basic definitions} |
| 358 |
% |
| 359 |
% \subsection{Declaring variables and constants} |
| 360 |
% |
| 361 |
% Some temporary variables: |
| 362 |
% |
| 363 |
% \begin{macro}{\a_count} |
| 364 |
% \begin{macro}{\b_count} |
| 365 |
% \begin{macro}{\c_count} |
| 366 |
% \begin{macro}{\d_count} |
| 367 |
% \begin{macro}{\e_count} |
| 368 |
% \begin{macro}{\f_count} |
| 369 |
% \begin{macro}{\g_count} |
| 370 |
% \begin{macrocode} |
| 371 |
%<*pkg> |
| 372 |
\newcount\a_count |
| 373 |
\newcount\b_count |
| 374 |
\newcount\c_count |
| 375 |
\newcount\d_count |
| 376 |
\newcount\e_count |
| 377 |
\newcount\f_count |
| 378 |
\newcount\g_count |
| 379 |
% \end{macrocode} |
| 380 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 381 |
% \end{macro} |
| 382 |
% \begin{macro}{\a_dimen} |
| 383 |
% \begin{macro}{\b_dimen} |
| 384 |
% \begin{macro}{\c_dimen} |
| 385 |
% \begin{macro}{\d_dimen} |
| 386 |
% \begin{macrocode} |
| 387 |
\newdimen\a_dimen |
| 388 |
\newdimen\b_dimen |
| 389 |
\newdimen\c_dimen |
| 390 |
\newdimen\d_dimen |
| 391 |
% \end{macrocode} |
| 392 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 393 |
% \begin{macro}{\a_toks} |
| 394 |
% \begin{macro}{\b_toks} |
| 395 |
% \begin{macro}{\c_toks} |
| 396 |
% \begin{macrocode} |
| 397 |
\newtoks\a_toks |
| 398 |
\newtoks\b_toks |
| 399 |
\newtoks\c_toks |
| 400 |
% \end{macrocode} |
| 401 |
% \end{macro}\end{macro}\end{macro} |
| 402 |
% |
| 403 |
% \begin{switch}{_a_} |
| 404 |
% \changes{1.901}{1999/03/07}{Temporary switch added. (LH)} |
| 405 |
% \begin{macrocode} |
| 406 |
\newif\if_a_ |
| 407 |
% \end{macrocode} |
| 408 |
% \end{switch} |
| 409 |
% |
| 410 |
% \describecsfamily{\meta{letter}_macro} |
| 411 |
% Besides these temporary variables that have to be declared, the family |
| 412 |
% of control sequences with names of the form |\|\meta{letter}|_macro|, |
| 413 |
% such as |\a_macro|, |\b_macro|, etc., should be used as ``macro valued'' |
| 414 |
% temporary variables. |
| 415 |
% \changes{1.903}{1999/05/13}{Introduced the |
| 416 |
% \cs{\meta{letter}_macro} temporary variables, |
| 417 |
% replaced \cs{temp_command}. (LH)} |
| 418 |
% |
| 419 |
% \begin{macro}{\out_file} |
| 420 |
% Some global variables: |
| 421 |
% \begin{macrocode} |
| 422 |
\newwrite\out_file |
| 423 |
% \end{macrocode} |
| 424 |
% \end{macro} |
| 425 |
% |
| 426 |
% |
| 427 |
% \begin{macro}{\one_thousand} |
| 428 |
% \begin{macro}{\five_hundred} |
| 429 |
% \begin{macro}{\one_hundred} |
| 430 |
% \begin{macro}{\max_mathchardef} |
| 431 |
% \begin{macro}{\two_thousand} |
| 432 |
% \changes{1.913}{2000/03/11}{Constant added. (LH)} |
| 433 |
% \begin{macro}{\half_point} |
| 434 |
% \changes{1.913}{2000/03/04}{Constant added. (LH)} |
| 435 |
% Some constants: |
| 436 |
% \begin{macrocode} |
| 437 |
\mathchardef\one_thousand=1000 |
| 438 |
\mathchardef\five_hundred=500 |
| 439 |
\mathchardef\one_hundred=100 |
| 440 |
\mathchardef\max_mathchardef="7FFF |
| 441 |
\mathchardef\two_thousand=2000 |
| 442 |
\newdimen\half_point \half_point=0.5pt |
| 443 |
%</pkg> |
| 444 |
% \end{macrocode} |
| 445 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 446 |
% |
| 447 |
% |
| 448 |
% \subsection{Trigonometry macros} |
| 449 |
% |
| 450 |
% Before v\,1.930, the file \texttt{trig.sty} used to be input at this |
| 451 |
% point. That is now inlined into the \package{fontinst} source proper |
| 452 |
% instead. |
| 453 |
% |
| 454 |
% \multchanges{\cs{@tempdima}\cs{@tempdimb}}{1.930}{2005/02/06} |
| 455 |
% {These aliases for \cs{a_dimen} and \cs{b_dimen} were removed, |
| 456 |
% since we may now hack them out of \cs{CalculateTan}. (LH)} |
| 457 |
% |
| 458 |
% |
| 459 |
% \subsection |
| 460 |
% {\package{fontdoc}-specific declarations} |
| 461 |
% ^^A \subsection{fontdoc-specific declarations} |
| 462 |
% |
| 463 |
% As of v\,1.917, \package{fontdoc} has options, so we better start |
| 464 |
% with declaration and processing of these. |
| 465 |
% \changes{1.917}{2001/03/31}{Option processing added. (LH)} |
| 466 |
% |
| 467 |
% \begin{option}{specification} |
| 468 |
% \begin{switch}{FD@spec@} |
| 469 |
% The \texttt{specification} option tells \package{fontdoc} that the |
| 470 |
% document is an encoding specification rather than a production |
| 471 |
% file---this changes some minor details in the typesetting. The |
| 472 |
% state of this option is recorded in the |FD@spec@| switch. |
| 473 |
% \begin{macrocode} |
| 474 |
%<*doc> |
| 475 |
\newif\ifFD@spec@ |
| 476 |
\FD@spec@false |
| 477 |
\DeclareOption{specification}{\FD@spec@true} |
| 478 |
% \end{macrocode} |
| 479 |
% \end{switch}\end{option} |
| 480 |
% |
| 481 |
% \begin{option}{hypertex} |
| 482 |
% \changes{1.918}{2001/06/17}{Option added. (LH)} |
| 483 |
% \begin{option}{pdftex} |
| 484 |
% \changes{1.920}{2001/09/24}{Option added. (LH)} |
| 485 |
% \begin{macro}{\FD@codepoint} |
| 486 |
% The \texttt{hypertex} and \texttt{pdftex} options tell |
| 487 |
% \package{fontdoc} to include Hyper\TeX\ |\special|s and pdf\TeX\ |
| 488 |
% annotations, in every code point number set using |\Unicode| or |
| 489 |
% |\textunicode|, for links to glyph images on the Unicode |
| 490 |
% consortium web site. The URLs to use are as follows: |
| 491 |
% \begin{quote} |
| 492 |
% \small |
| 493 |
% To access the reference glyph for any Unicode character, |
| 494 |
% you can use the new URL syntax like this: |
| 495 |
% \begin{quote} |
| 496 |
% \texttt{http://www.unicode.org/cgi-bin/refglyph?}^^A |
| 497 |
% \meta{XX}\texttt{-}\meta{nnnn} |
| 498 |
% \end{quote} |
| 499 |
% where \meta{XX} is the point size and \meta{nnnn} is the |
| 500 |
% hexadecimal codepoint. Please note however that only \texttt{24} |
| 501 |
% is supported as a size parameter at this time. (We are |
| 502 |
% reserving the possibility of providing other sizes in the |
| 503 |
% future.) Here is an example of usage for \texttt{U+4E78}: |
| 504 |
% \begin{quote} |
| 505 |
% \texttt{http://www.unicode.org/cgi-bin/refglyph?24-4E78} |
| 506 |
% \end{quote} |
| 507 |
% (This supports up to 6 hex digits, so it can also be used |
| 508 |
% with the supplementary characters.) |
| 509 |
% \end{quote} |
| 510 |
% |
| 511 |
% \iffalse |
| 512 |
% Documentation for a similar older service: |
| 513 |
% \begin{quotation} |
| 514 |
% \small |
| 515 |
% You may embed references to the glyph images on the Unicode site |
| 516 |
% in your own web pages. For example, to display a Euro sign |
| 517 |
% (\texttt{U+20AC}) you can use the following HTML: |
| 518 |
% \begin{quote} |
| 519 |
% |<IMG SRC="http://charts.unicode.org/Glyphs/20/U20AC.gif">| |
| 520 |
% \end{quote} |
| 521 |
% The subdirectory to use within the \texttt{Glyphs/} directory |
| 522 |
% is the first two hexadecimal digits of the Unicode code point. |
| 523 |
% The set of glyphs available covers all of Unicode 3.0 with the |
| 524 |
% exception of Han ideographs and Hangul syllables. |
| 525 |
% |
| 526 |
% However, you should only make occasional use of these glyphs. |
| 527 |
% If there is too much web traffic the Unicode |
| 528 |
% Consortium may be forced to discontinue this service. |
| 529 |
% \end{quotation} |
| 530 |
% \fi |
| 531 |
% Coding this for Hyper\TeX\ is pretty straightforward. |
| 532 |
% \begin{macrocode} |
| 533 |
\DeclareOption{hypertex}{ |
| 534 |
\providecommand*\FD@codepoint[1]{% |
| 535 |
\uppercase{\edef\@tempa{#1}}% |
| 536 |
\special{html:<a href="% |
| 537 |
http://www.unicode.org/cgi-bin/refglyph?24-\@tempa |
| 538 |
">% |
| 539 |
}% |
| 540 |
\texttt{U+\@tempa}% |
| 541 |
\special{html:</a>}% |
| 542 |
}% |
| 543 |
} |
| 544 |
% \end{macrocode} |
| 545 |
% The pdf\TeX\ implementation is easy too, but there is one |
| 546 |
% complication: The key primitive is called |\pdfannotlink| in |
| 547 |
% v\,0.13, but |\pdfstartlink| in v\,0.14. My thanks goes to H\`an |
| 548 |
% Th\'{\^e} Th\`anh, who helped me sort that out. |
| 549 |
% \begin{macrocode} |
| 550 |
\DeclareOption{pdftex}{ |
| 551 |
\providecommand*\FD@codepoint[1]{% |
| 552 |
\mbox{% |
| 553 |
\uppercase{\edef\@tempa{#1}}% |
| 554 |
\ifx \pdfstartlink\@undefined |
| 555 |
\pdfannotlink |
| 556 |
\else |
| 557 |
\pdfstartlink |
| 558 |
\fi attr {/Border [0 0 0]} user {% |
| 559 |
/Subtype /Link /A <<% |
| 560 |
/S /URI /URI (% |
| 561 |
http://www.unicode.org/cgi-bin/refglyph?24-\@tempa |
| 562 |
)% |
| 563 |
>>}% |
| 564 |
\textcolor{blue}{\texttt{U+\@tempa}}% |
| 565 |
\pdfendlink |
| 566 |
}% |
| 567 |
}% |
| 568 |
\AtEndOfPackage{\RequirePackage[pdftex]{color}}% |
| 569 |
} |
| 570 |
% \end{macrocode} |
| 571 |
% It would be quite possible to make these links according to some |
| 572 |
% other standard (e.g.~\LaTeX\-to\-HTML) instead by including a suitable |
| 573 |
% definition of |\FD@codepoint| in your \texttt{fontdoc.cfg} file. |
| 574 |
% I could include code for those standards as well if someone sends |
| 575 |
% it to me. |
| 576 |
% |
| 577 |
% I decided against using commands in the \package{hyperref} or |
| 578 |
% \package{hyper} packages for this as these packages do so much more |
| 579 |
% that I don't want. If some day a package providing a basic interface |
| 580 |
% for making hyperlinks is included in required \LaTeX\ then this |
| 581 |
% decision should certainly be reconsidered. |
| 582 |
% \end{macro}\end{option}\end{option} |
| 583 |
% |
| 584 |
% Input a local configuration file, if it exists. |
| 585 |
% \begin{macrocode} |
| 586 |
\InputIfFileExists{fontdoc.cfg}{% |
| 587 |
\typeout{*************************************^^J% |
| 588 |
* Local config file fontdoc.cfg used^^J% |
| 589 |
*************************************}% |
| 590 |
}{} |
| 591 |
% \end{macrocode} |
| 592 |
% |
| 593 |
% Finally process the options. |
| 594 |
% \begin{macrocode} |
| 595 |
\ProcessOptions\relax |
| 596 |
% \end{macrocode} |
| 597 |
% |
| 598 |
% |
| 599 |
% The \package{amstext} package is required, since the |\text| command |
| 600 |
% is used in formatting some integer expressions. |
| 601 |
% \changes{1.916}{2001/01/02}{Requiring the \package{amstext} package |
| 602 |
% in \package{fontdoc}. (LH)} |
| 603 |
% \begin{macrocode} |
| 604 |
\RequirePackage{amstext} |
| 605 |
% \end{macrocode} |
| 606 |
% |
| 607 |
% \begin{macro}{\a@count} |
| 608 |
% \begin{macro}{\b@count} |
| 609 |
% \changes{1.916}{2001/01/02}{Variable added. (LH)} |
| 610 |
% \begin{macro}{\a@dimen} |
| 611 |
% Three private variables: |
| 612 |
% \begin{macrocode} |
| 613 |
\newcount\a@count |
| 614 |
\newcount\b@count |
| 615 |
\newdimen\a@dimen |
| 616 |
% \end{macrocode} |
| 617 |
% \end{macro}\end{macro}\end{macro} |
| 618 |
% |
| 619 |
% Some useful macros and constrol structures: |
| 620 |
% |
| 621 |
% \begin{macrocode} |
| 622 |
\def\x@cs#1#2{\expandafter#1\csname#2\endcsname} |
| 623 |
\def\FD@swap@two#1#2{#2#1} |
| 624 |
% \end{macrocode} |
| 625 |
% |
| 626 |
% \begin{macro}{\Aheading} |
| 627 |
% \changes{1.909}{1999/10/18}{Use \cs{addvspace} to make space |
| 628 |
% above. (LH)} |
| 629 |
% \changes{1.909}{1999/10/20}{Insert a \cs{penalty} for pagebreaking |
| 630 |
% after an \cs{Aheading}. (LH)} |
| 631 |
% \changes{1.920}{2001/10/19}{Encouraged page breaks before an |
| 632 |
% \cs{Aheading}. (LH)} |
| 633 |
% \begin{macro}{\Bheading} |
| 634 |
% |\Aheading| and |\Bheading| are used to typeset various headings. |
| 635 |
% \begin{macrocode} |
| 636 |
\newcommand\Aheading[1]{% |
| 637 |
\par\pagebreak[1]\addvspace\medskipamount |
| 638 |
\noindent\textbf{#1}\vadjust{\penalty200}\par |
| 639 |
} |
| 640 |
\newcommand\Bheading[1]{\par\noindent\textbf{#1}} |
| 641 |
% \end{macrocode} |
| 642 |
% \end{macro}\end{macro} |
| 643 |
% |
| 644 |
% Some formating commands and a macro that comes in handy. It used to |
| 645 |
% say |\raggedright| at this point as well, but that functionality has |
| 646 |
% been moved into |\encoding| and |\metrics|. |
| 647 |
% |
| 648 |
% \definechange{raggedright}{1.920}{2001/09/16}{The body (between |
| 649 |
% \cs{metrics} and \cs{endmetrics}, and \cs{encoding} and |
| 650 |
% \cs{endencoding} respectively) of a \package{fontdoc} document is |
| 651 |
% now typeset in a \texttt{flushleft} environment. It used to be that |
| 652 |
% the entire document was typeset this way. (LH)} |
| 653 |
% \usechange{raggedright} |
| 654 |
% \changes{1.923}{2002/10/26}{Making sure \cs{lineskiplimit} is |
| 655 |
% positive. (LH)} |
| 656 |
% |
| 657 |
% \begin{macrocode} |
| 658 |
\raggedbottom |
| 659 |
\ifdim 1sp>\lineskiplimit \lineskiplimit=0.5pt \fi |
| 660 |
\newcommand\plain{\texttt{plain}} |
| 661 |
% \end{macrocode} |
| 662 |
% |
| 663 |
% \begin{macro}{\plainint} |
| 664 |
% \begin{macro}{\plaindiv} |
| 665 |
% \begin{macro}{\plainneg} |
| 666 |
% \changes{1.928}{2004/11/24}{Added \cs{plainneg}. That the |
| 667 |
% \protect\LaTeX\ \cs{neg} is taken over by \package{fontdoc} but |
| 668 |
% is needed in \texttt{oms.etx} had gone unnoticed for over ten |
| 669 |
% years!! (LH) Problem reported by Peter Dyballa.} |
| 670 |
% \begin{macro}{\plainmax} |
| 671 |
% \begin{macro}{\plainmin} |
| 672 |
% \package{fontdoc} saves away \LaTeX's |\int|, |\div|, |\neg|, |\max|, |
| 673 |
% and |\min| as |\plainint|, |\plaindiv|, |\plainneg|, |\plainmax|, |
| 674 |
% and |\plainmin| respectively, since these control sequences are going |
| 675 |
% to be used for other purposes. |
| 676 |
% \begin{macrocode} |
| 677 |
\let\plainint=\int |
| 678 |
\let\plaindiv=\div |
| 679 |
\let\plainneg=\neg |
| 680 |
\let\plainmax=\max |
| 681 |
\let\plainmin=\min |
| 682 |
% \end{macrocode} |
| 683 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 684 |
% |
| 685 |
% \begin{macro}{\TypesetList} |
| 686 |
% \changes{1.914}{2000/05/13}{Macro added. (LH)} |
| 687 |
% \begin{macro}{\list@item@counter} |
| 688 |
% The |\TypesetList| command typesets the \meta{arg}s in a sequence of |
| 689 |
% |\do|\marg{arg} macros with separators depending on position in and |
| 690 |
% length of the sequence. It is loosely based on a description of a |
| 691 |
% similar command in the \package{amsref} package, but it has fewer |
| 692 |
% features, and I don't know if there is any similarity between the |
| 693 |
% implementations. |
| 694 |
% |
| 695 |
% The syntax is |
| 696 |
% \begin{isyntax} |
| 697 |
% |\TypesetList|\marg{left}\marg{onlysep}\marg{nonlastsep}\penalty0 |
| 698 |
% \marg{lastsep}\penalty0\marg{right}\penalty0 |
| 699 |
% \marg{empty}\penalty0\marg{wrap}\penalty0\marg{list} |
| 700 |
% \end{isyntax} |
| 701 |
% \meta{list} is the actual list of |\do|\marg{arg}s. If that is |
| 702 |
% empty then \meta{empty} is typeset. Otherwise the typeset text |
| 703 |
% begins with \meta{left}, ends with \meta{right}, and contains the |
| 704 |
% formatted forms of every \meta{arg} in the list of |\do|\marg{arg}s. |
| 705 |
% The formatting here consists of passing the \meta{arg} as the |
| 706 |
% argument to \meta{wrap}, which is typically a one-argument macro. |
| 707 |
% Between two ``formatted \meta{arg}s'' will \meta{onlysep}, |
| 708 |
% \meta{nonlastsep}, or \meta{lastsep} be put, depending on the number |
| 709 |
% of \meta{arg}s in the list and the position in the list. If the list |
| 710 |
% has length two then \meta{onlysep} will be used for the only separator |
| 711 |
% needed. If the list has length greater than two then \meta{nonlastsep} |
| 712 |
% will be used for all separators but the last, and \meta{lastsep} will |
| 713 |
% be used for the last. |
| 714 |
% |
| 715 |
% All of the arguments of |\TypesetList| must survive being passed |
| 716 |
% through a |\def|. |
| 717 |
% \begin{macrocode} |
| 718 |
\newcount\list@item@counter |
| 719 |
\newcommand\TypesetList[8]{% |
| 720 |
\begingroup |
| 721 |
\list@item@counter=\z@ |
| 722 |
\def\do##1{\advance\list@item@counter\@ne}% |
| 723 |
#8% |
| 724 |
\ifcase \list@item@counter \or |
| 725 |
\def\do##1{#1#7{##1}}% |
| 726 |
\or |
| 727 |
\def\do##1{% |
| 728 |
\advance\list@item@counter\@ne |
| 729 |
\ifnum \list@item@counter=\@ne #1\else #2\fi |
| 730 |
#7{##1}% |
| 731 |
}% |
| 732 |
\else |
| 733 |
\advance\list@item@counter\m@ne |
| 734 |
\expandafter\def \expandafter\do \expandafter##\expandafter1% |
| 735 |
\expandafter{\expandafter\ifnum \the\list@item@counter |
| 736 |
=\list@item@counter |
| 737 |
#4% |
| 738 |
\else\ifnum \z@=\list@item@counter |
| 739 |
#1% |
| 740 |
\else |
| 741 |
#3% |
| 742 |
\fi\fi |
| 743 |
\advance\list@item@counter\@ne |
| 744 |
#7{##1}% |
| 745 |
}% |
| 746 |
\fi |
| 747 |
\ifnum \z@=\list@item@counter |
| 748 |
#6% |
| 749 |
\else |
| 750 |
\list@item@counter=\z@ |
| 751 |
#8% |
| 752 |
#5% |
| 753 |
\fi |
| 754 |
\endgroup |
| 755 |
} |
| 756 |
%</doc> |
| 757 |
% \end{macrocode} |
| 758 |
% \end{macro}\end{macro} |
| 759 |
% |
| 760 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 761 |
% |
| 762 |
% |
| 763 |
% \section |
| 764 |
% {\TeX{} hackery} |
| 765 |
% ^^A \section{TeX hackery} |
| 766 |
% \changes{1.902}{1999/05/01}{Moved Section \thesection\space to |
| 767 |
% \texttt{fibasics.dtx}. (LH)} |
| 768 |
% |
| 769 |
% \subsection{Utiltiy macros} |
| 770 |
% |
| 771 |
% \begin{macro}{\x_cs} |
| 772 |
% \begin{macro}{\x_relax} |
| 773 |
% \begin{macro}{\g_let} |
| 774 |
% \begin{macrocode} |
| 775 |
%<*pkg> |
| 776 |
\def\x_cs#1#2{\expandafter#1\csname#2\endcsname} |
| 777 |
\let\x_relax=\relax |
| 778 |
\def\g_let{\global\let} |
| 779 |
%</pkg> |
| 780 |
% \end{macrocode} |
| 781 |
% \end{macro}\end{macro}\end{macro} |
| 782 |
% \changes{1.900}{1999/02/07}{Replaced \cs{relax} by \cs{x_relax}. (LH)} |
| 783 |
% |
| 784 |
% \begin{macro}{\x@relax} |
| 785 |
% \begin{macrocode} |
| 786 |
%<doc>\let\x@relax=\relax |
| 787 |
% \end{macrocode} |
| 788 |
% \end{macro} |
| 789 |
% |
| 790 |
% \begin{macro}{\empty_command} |
| 791 |
% \begin{macro}{\gobble_one} |
| 792 |
% \begin{macro}{\gobble_two} |
| 793 |
% \begin{macro}{\gobble_three} |
| 794 |
% \begin{macro}{\identity_one} |
| 795 |
% \begin{macro}{\first_of_two} |
| 796 |
% \begin{macro}{\second_of_two} |
| 797 |
% \begin{macro}{\swap_two} |
| 798 |
% \changes{1.912}{2000/02/16}{Macro added. (LH)} |
| 799 |
% \begin{macro}{\first_of_three} |
| 800 |
% \changes{1.914}{2000/05/30}{Macro added. (LH)} |
| 801 |
% \begin{macrocode} |
| 802 |
%<*pkg> |
| 803 |
\def\empty_command{} |
| 804 |
\def\gobble_one#1{} |
| 805 |
\def\gobble_two#1#2{} |
| 806 |
\def\gobble_three#1#2#3{} |
| 807 |
\def\identity_one#1{#1} |
| 808 |
\def\first_of_two#1#2{#1} |
| 809 |
\def\second_of_two#1#2{#2} |
| 810 |
\def\swap_two#1#2{#2#1} |
| 811 |
\def\first_of_three#1#2#3{#1} |
| 812 |
% \end{macrocode} |
| 813 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 814 |
% \end{macro}\end{macro}\end{macro} |
| 815 |
% |
| 816 |
% \begin{macro}{\hash_char} |
| 817 |
% \begin{macro}{\percent_char} |
| 818 |
% \begin{macro}{\left_brace_char} |
| 819 |
% \begin{macro}{\right_brace_char} |
| 820 |
% \begin{macrocode} |
| 821 |
\bgroup |
| 822 |
\catcode`\[=1 |
| 823 |
\catcode`\]=2 |
| 824 |
\catcode`\#=12 |
| 825 |
\catcode`\%=12 |
| 826 |
\catcode`\{=12 |
| 827 |
\catcode`\}=12 |
| 828 |
\gdef\hash_char[#] |
| 829 |
\gdef\percent_char[%] |
| 830 |
\gdef\left_brace_char[{] |
| 831 |
\gdef\right_brace_char[}] |
| 832 |
\egroup |
| 833 |
% \end{macrocode} |
| 834 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 835 |
% |
| 836 |
% \begin{macro}{\first_char} |
| 837 |
% Return the first character of a string. |
| 838 |
% |
| 839 |
% \begin{macrocode} |
| 840 |
\def\first_char#1#2={#1} |
| 841 |
% \end{macrocode} |
| 842 |
% \end{macro} |
| 843 |
% |
| 844 |
% \begin{macro}{\add_to} |
| 845 |
% Append one or more tokens to the replacement text of a |
| 846 |
% parameterless macro. |
| 847 |
% \begin{macrocode} |
| 848 |
\def\add_to#1#2{ |
| 849 |
\ifx#1\x_relax |
| 850 |
\def#1{#2} |
| 851 |
\else |
| 852 |
\expandafter\def\expandafter#1\expandafter{#1#2} |
| 853 |
\fi |
| 854 |
} |
| 855 |
% \end{macrocode} |
| 856 |
% \end{macro} |
| 857 |
% |
| 858 |
% \begin{macro}{\prep_to} |
| 859 |
% Prepend one or more tokens to the replacement text of a |
| 860 |
% parameterless macro. Note that if more than one token is added then |
| 861 |
% the second parameter must contain an |\expandafter| between every |
| 862 |
% pair of tokens you actually mean to contribute. Thus if you want |
| 863 |
% to prepend |abc| to |\next|, you must write |
| 864 |
% \begin{quote} |
| 865 |
% |\prep_to\next{a\expandafter b\expandafter c}| |
| 866 |
% \end{quote} |
| 867 |
% Also note that the second argument must not be empty. |
| 868 |
% \begin{macrocode} |
| 869 |
\def\prep_to#1#2{ |
| 870 |
\ifx#1\x_relax |
| 871 |
\expandafter\def\expandafter#1\expandafter{\expandafter#2} |
| 872 |
\else |
| 873 |
\expandafter\def\expandafter#1\expandafter{\expandafter#2#1} |
| 874 |
\fi |
| 875 |
} |
| 876 |
% \end{macrocode} |
| 877 |
% \end{macro} |
| 878 |
% |
| 879 |
% \begin{macro}{\never_do} |
| 880 |
% The command |\do|, protected from expansion. |
| 881 |
% |
| 882 |
% \begin{macrocode} |
| 883 |
\def\never_do{\noexpand\do} |
| 884 |
%</pkg> |
| 885 |
% \end{macrocode} |
| 886 |
% \end{macro} |
| 887 |
% |
| 888 |
% |
| 889 |
% \subsection{Testing for \TeX\ extensions} |
| 890 |
% \changes{1.914}{2000/05/13}{Added commands for testing for |
| 891 |
% \protect\TeX\ extensions. (LH)} |
| 892 |
% Some tasks can be done better (and usually with simpler code) if |
| 893 |
% one can assume that certain features in some \TeX\ extensions, such as |
| 894 |
% \eTeX, is available. Unfortunately one cannot generally make this |
| 895 |
% assumption, but it is sometimes possible to provide two implementations |
| 896 |
% of a macro and at runtime choose the one which best utilizes the |
| 897 |
% available features. This subsection defines macros for making these |
| 898 |
% tests. |
| 899 |
% |
| 900 |
% There is also a command |\needsTeXextension| which is used like |
| 901 |
% |\needs|\-|fontinst|\-|version|, but which tests the \TeX\ rather than |
| 902 |
% the version of \package{fontinst}. This ought to be of use for ETX files |
| 903 |
% that describe 16 bit encodings,\footnote{At the time of writing, no |
| 904 |
% such ETX files exist that I know of, but \package{fontinst} should |
| 905 |
% not have any problem using them. /LH} as the current implementation |
| 906 |
% of the (V)PL writer in this case requires the underlying \TeX\ to |
| 907 |
% support 16 bit character codes. |
| 908 |
% |
| 909 |
% The normal operation of the extension-testing macros is to set the |_a_| |
| 910 |
% switch to true if the requested extension is present, and to leave the |
| 911 |
% switch as it was if it isn't present. This is so that one can easily |
| 912 |
% test for a feature that has been added to several different extensions |
| 913 |
% of \TeX\ simply by doing the tests in sequence. That, however, is what |
| 914 |
% the testing macros do if the switch |_extensions_warning_| is set to |
| 915 |
% false. When it is set to true they instead expand to a short piece of |
| 916 |
% text suitable for inclusion in a warning message about the absence of |
| 917 |
% a needed feature. |
| 918 |
% |
| 919 |
% \begin{switch}{_extensions_warning_} |
| 920 |
% This switch controls whether extension-testing macros should |
| 921 |
% actually do the test (false) or produce a warning (true). |
| 922 |
% \begin{macrocode} |
| 923 |
%<*pkg> |
| 924 |
\newif\if_extensions_warning_ |
| 925 |
\_extensions_warning_false |
| 926 |
% \end{macrocode} |
| 927 |
% \end{switch} |
| 928 |
% |
| 929 |
% |
| 930 |
% \begin{macro}{\eTeX} |
| 931 |
% The |\eTeX| command has the syntax |
| 932 |
% \begin{quote} |
| 933 |
% |\eTeX|\marg{version number} |
| 934 |
% \end{quote} |
| 935 |
% where the \meta{version number} is the complete version number |
| 936 |
% (version number plus revision) of the \eTeX\ one wishes to test for. |
| 937 |
% |
| 938 |
% The code below is geared towards not letting unnecessary control |
| 939 |
% sequences get tokenized, as they will then always occupy a position |
| 940 |
% in \TeX's hash table, but it seems one cannot get around testing |
| 941 |
% whether |\eTeXversion| is defined, so we start with that and then |
| 942 |
% do a |\catcode| trick to prevent \TeX\ from seeing |\eTeXrevision|. |
| 943 |
% \begin{macrocode} |
| 944 |
\ifx \eTeXversion\undefined_command |
| 945 |
\catcode`\~=14 % 14=comment |
| 946 |
\fi |
| 947 |
\def\eTeX#1{ |
| 948 |
\if_extensions_warning_ |
| 949 |
\space/\space e-TeX\space version\space #1 |
| 950 |
~ \else |
| 951 |
~ \ifdim \number\eTeXversion\eTeXrevision\p@ < #1\p@ \else |
| 952 |
~ \_a_true |
| 953 |
~ \fi |
| 954 |
\fi |
| 955 |
} |
| 956 |
\catcode`\~=10 |
| 957 |
%</pkg> |
| 958 |
% \end{macrocode} |
| 959 |
% \begin{macro}{\eTeXlogo} |
| 960 |
% The |\eTeXlogo| command prints the \eTeX\ logo. |
| 961 |
% \changes{1.923}{2002/10/20}{Added kern, to match |
| 962 |
% \package{ltugboat} definition. (LH)} |
| 963 |
% \begin{macrocode} |
| 964 |
%<*doc> |
| 965 |
\def\eTeX#1{\do{\eTeXlogo\nolinebreak[3] v\,#1}} |
| 966 |
\def\eTeXlogo{\ensuremath{\varepsilon}-\kern-.125em\TeX} |
| 967 |
%</doc> |
| 968 |
% \end{macrocode} |
| 969 |
% \end{macro}\end{macro} |
| 970 |
% |
| 971 |
% |
| 972 |
% \begin{macro}{\pdfTeX} |
| 973 |
% The |\pdfTeX| command has the syntax |
| 974 |
% \begin{quote} |
| 975 |
% |\pdfTeX|\marg{version number}\marg{revision} |
| 976 |
% \end{quote} |
| 977 |
% where the \meta{version number} is the version number as returned |
| 978 |
% by |\pdftexversion|, i.e., 100 times what it would normally be |
| 979 |
% printed as, and the \meta{revision} is the revision code as returned |
| 980 |
% by |\pdftexrevision|. To test for pdf\TeX\ 0.13c or newer, one would |
| 981 |
% say |\pdfTeX{13}{c}|. |
| 982 |
% |
| 983 |
% The code below uses the same |\catcode| trick as that in |\eTeX|. |
| 984 |
% \begin{macrocode} |
| 985 |
%<*pkg> |
| 986 |
\ifx \pdftexversion\undefined_command |
| 987 |
\catcode`\~=14 % 14=comment |
| 988 |
\fi |
| 989 |
%</pkg> |
| 990 |
%<*pkg|doc> |
| 991 |
\def\pdfTeX#1#2{% |
| 992 |
%<pkg> \if_extensions_warning_ |
| 993 |
%<pkg> \space/\space pdfTeX\space version\space |
| 994 |
%<doc> \do{pdf\TeX\nolinebreak[3] v\,% |
| 995 |
\ifnum #1<100\space |
| 996 |
0.\ifnum #1<10\space 0\fi |
| 997 |
\else |
| 998 |
%<pkg> \expandafter\swap_two \expandafter. |
| 999 |
%<doc> \expandafter\FD@swap@two \expandafter.% |
| 1000 |
\fi |
| 1001 |
#1#2% |
| 1002 |
%<doc> } |
| 1003 |
%<doc>} |
| 1004 |
%</pkg|doc> |
| 1005 |
%<*pkg> |
| 1006 |
% \end{macrocode} |
| 1007 |
% The above is not ideal, but it will do for now. |
| 1008 |
% \begin{macrocode} |
| 1009 |
~ \else |
| 1010 |
~ \ifdim #1>\pdftexversion \else |
| 1011 |
~ \ifnum \expandafter\expandafter \expandafter` |
| 1012 |
~ \expandafter\first_char \pdftexrevision= < |
| 1013 |
~ \expandafter` \first_char#2= |
| 1014 |
~ \else \_a_true \fi |
| 1015 |
~ \fi |
| 1016 |
\fi |
| 1017 |
} |
| 1018 |
\catcode`\~=10 |
| 1019 |
% \end{macrocode} |
| 1020 |
% \end{macro} |
| 1021 |
% |
| 1022 |
% |
| 1023 |
% \begin{macro}{\needsTeXextension} |
| 1024 |
% The |\needsTeXextension| command has the syntax |
| 1025 |
% \begin{quote} |
| 1026 |
% |\needsTeXextension|\marg{extension tests}\marg{who} |
| 1027 |
% \end{quote} |
| 1028 |
% If none of the extension tests set the |_a_| switch to true, then |
| 1029 |
% it prints a warning detailing the extensions tests which failed. |
| 1030 |
% \meta{who} is what should be listed as the originator of this |
| 1031 |
% message; it is typically the name of the file which contains the |
| 1032 |
% |\needsTeXextension| command. |
| 1033 |
% |
| 1034 |
% An example (assuming that there will be an |\Omega| test as well |
| 1035 |
% some time in the future; I haven't really looked into what that |
| 1036 |
% should look like, so maybe the arguments should be different): The |
| 1037 |
% command |
| 1038 |
% \begin{quote} |
| 1039 |
% |\needsTeXextension{\eTeX{1.2}\Omega{1.0}}{foobar.etx}| |
| 1040 |
% \end{quote} |
| 1041 |
% tests if the current \TeX\ is \eTeX\ verision 1.2 (or newer) |
| 1042 |
% \emph{or} Omega version 1.0 (or newer). The implied conjunction |
| 1043 |
% between the tests is always `or'. |
| 1044 |
% \begin{macrocode} |
| 1045 |
\def\needsTeXextension#1#2{ |
| 1046 |
\_a_false |
| 1047 |
#1 |
| 1048 |
\if_a_ \else |
| 1049 |
\_extensions_warning_true |
| 1050 |
\edef\a_macro{#1} |
| 1051 |
\_extensions_warning_false |
| 1052 |
\fontinstwarningnoline{#2}{ |
| 1053 |
This~file~needs:\messagebreak |
| 1054 |
\expandafter\second_of_two\a_macro |
| 1055 |
\iffalse |
| 1056 |
<no~sufficient~extensions~were~listed!!>\if_false |
| 1057 |
\fi |
| 1058 |
\messagebreak |
| 1059 |
You~are~not~using~any~of~them.~This~is~likely~to~cause~errors |
| 1060 |
} |
| 1061 |
\fi |
| 1062 |
} |
| 1063 |
%</pkg> |
| 1064 |
% \end{macrocode} |
| 1065 |
% \begin{macrocode} |
| 1066 |
%<*doc> |
| 1067 |
\def\needsTeXextension#1#2{% |
| 1068 |
\Bheading{Needs |
| 1069 |
\TypesetList{}{ or }{, }{, or }{}{(unspecified)}{\@firstofone}{#1}}% |
| 1070 |
} |
| 1071 |
%</doc> |
| 1072 |
% \end{macrocode} |
| 1073 |
% \end{macro} |
| 1074 |
% |
| 1075 |
% |
| 1076 |
% |
| 1077 |
% \subsection{Writing to output files} |
| 1078 |
% |
| 1079 |
% \changes{1.901}{1999/03/04}{Pooled output file allocation added. (LH)} |
| 1080 |
% As of v\,1.901, there are two different output file |
| 1081 |
% models in \package{fontinst}. One has been along ``forever'' and is |
| 1082 |
% for writing output to files which are only open for a short period of |
| 1083 |
% time---every \package{fontinst} file command that opens a file in this |
| 1084 |
% model must also close it---and it can only be used for one file at at |
| 1085 |
% time. The other model offers pooled allocation of output files---as |
| 1086 |
% long as there is an unused \TeX\ output stream to open, you may open a |
| 1087 |
% new file, and it does not matter if files are not closed in the revese |
| 1088 |
% order of that in which they were opened. |
| 1089 |
% |
| 1090 |
% \begin{macro}{\open_out} |
| 1091 |
% \changes{1.901}{1999/03/04} |
| 1092 |
% {\cs{xdef} instead of \cs{def} on \cs{out_filename}. (LH)} |
| 1093 |
% \begin{macro}{\close_out} |
| 1094 |
% \begin{macro}{\out_line} |
| 1095 |
% \begin{macro}{\out_lline} |
| 1096 |
% \changes{1.908}{1999/08/25}{\cs{edef}, to save macro expansions |
| 1097 |
% later. (LH)} |
| 1098 |
% \begin{macro}{\out_llline} |
| 1099 |
% \changes{1.908}{1999/08/25}{\cs{edef} and don't use \cs{out_lline}, |
| 1100 |
% to save macro expansions later. (LH)} |
| 1101 |
% These macros implement the classical output file commands. |
| 1102 |
% \begin{macrocode} |
| 1103 |
%<*pkg> |
| 1104 |
\def\open_out#1{ |
| 1105 |
\immediate\openout\out_file=#1 \xdef\out_filename{#1}} |
| 1106 |
\def\close_out#1{ |
| 1107 |
\immediate\write16{#1~written~on~\out_filename.} |
| 1108 |
\immediate\closeout\out_file} |
| 1109 |
\def\out_line#1{\immediate\write\out_file{#1}} |
| 1110 |
\edef\out_lline#1{\noexpand\out_line{\space\space\space#1}} |
| 1111 |
\edef\out_llline#1{ |
| 1112 |
\noexpand\out_line{\space\space\space\space\space\space#1} |
| 1113 |
} |
| 1114 |
% \end{macrocode} |
| 1115 |
% \end{macro} |
| 1116 |
% \end{macro} |
| 1117 |
% \end{macro} |
| 1118 |
% \end{macro} |
| 1119 |
% \end{macro} |
| 1120 |
% |
| 1121 |
% |
| 1122 |
% In the new model, the basic writing command |
| 1123 |
% \DescribeMacro{\pout_line}|\pout_line| takes two arguments: a file |
| 1124 |
% identifier control sequence and the token sequence to write. Thus its |
| 1125 |
% call looks like |
| 1126 |
% \begin{quote} |
| 1127 |
% |\pout_line|\meta{identifier}\marg{text} |
| 1128 |
% \end{quote} |
| 1129 |
% The \meta{identifier} is usually a chardef token whose number tells |
| 1130 |
% which input stream is used, but if \TeX\ runs out of output streams |
| 1131 |
% then it might be defined as a parameterless macro which expands to |
| 1132 |
% |\m@ne|. This has the effect of making all output to that ``file'' go |
| 1133 |
% to the log file, from which the data might be salvaged. |
| 1134 |
% |
| 1135 |
% The new model operates using the control sequence family |
| 1136 |
% \describecsfamily{out_filename-\meta{stream}}^^A |
| 1137 |
% |\out_filename-|\meta{stream} |
| 1138 |
% both for storing the name of the output file and for handling |
| 1139 |
% allocation of output streams. |
| 1140 |
% |
| 1141 |
% \begin{macro}{\TeX_terminal} |
| 1142 |
% \begin{macro}{\closed_stream} |
| 1143 |
% \begin{macro}{\out_filename-99} |
| 1144 |
% \begin{macro}{\out_filename--1} |
| 1145 |
% Output streams 16 and above always write to \TeX's terminal, and any |
| 1146 |
% output file that gets closed gets its identifier set to 99 so that |
| 1147 |
% any attempts to write to a closed file can be easily spotted. (99 |
| 1148 |
% is the character code for |c|.) Output stream --1 is the log file, and |
| 1149 |
% if another output stream cannot be allocated then attempts to write to |
| 1150 |
% the output file will be redirected to the log file. |
| 1151 |
% \begin{macrocode} |
| 1152 |
\def\TeX_terminal{\string\TeX\space terminal} |
| 1153 |
\chardef\closed_stream=99 |
| 1154 |
\x_cs\let{out_filename-99}=\TeX_terminal |
| 1155 |
\x_cs\def{out_filename--1}{\jobname.log} |
| 1156 |
% \end{macrocode} |
| 1157 |
% \end{macro} \end{macro} \end{macro} \end{macro} |
| 1158 |
% |
| 1159 |
% \begin{macro}{\allocate_stream} |
| 1160 |
% \begin{macro}{\ch@ck} |
| 1161 |
% \begin{macrocode} |
| 1162 |
\def\allocate_stream{ |
| 1163 |
\a_count=\m@ne |
| 1164 |
\b_count=\m@ne |
| 1165 |
\loop \ifnum \count17>\a_count |
| 1166 |
% \end{macrocode} |
| 1167 |
% While |\a_count|${}<$ the number of the last allocated output |
| 1168 |
% stream \textellipsis |
| 1169 |
% \begin{macrocode} |
| 1170 |
\advance \a_count \@ne |
| 1171 |
\x_cs\ifx{out_filename-\the\a_count}\TeX_terminal |
| 1172 |
% \end{macrocode} |
| 1173 |
% If |\out_filename-|\meta{stream}, where \meta{stream} is the value |
| 1174 |
% of |\a_count|, is equal to |\TeX_terminal|, then output stream |
| 1175 |
% |\a_count| is allocated to the pool but is not used for any |
| 1176 |
% currently open file. Thus we've found a stream that can be used. |
| 1177 |
% \begin{macrocode} |
| 1178 |
\b_count=\a_count |
| 1179 |
\a_count=\count17 |
| 1180 |
\fi |
| 1181 |
\repeat |
| 1182 |
\ifnum \b_count=\m@ne |
| 1183 |
% \end{macrocode} |
| 1184 |
% In this case all streams allocated to the pool are currently in use, |
| 1185 |
% so try to allocate a new one. |
| 1186 |
% \begin{macrocode} |
| 1187 |
\global\advance\count17by\@ne |
| 1188 |
\ifnum \count17<\sixt@@n |
| 1189 |
% \end{macrocode} |
| 1190 |
% Then case: There was another output stream. |
| 1191 |
% \begin{macrocode} |
| 1192 |
\b_count=\count17 |
| 1193 |
\global\x_cs\let{out_filename-\the\b_count}\TeX_terminal |
| 1194 |
\wlog{\string\write\the\b_count\space allocated~to~the~pool.} |
| 1195 |
\else |
| 1196 |
% \end{macrocode} |
| 1197 |
% Else case: See to that the output stream allocation register holds |
| 1198 |
% at 16. |
| 1199 |
% \begin{macrocode} |
| 1200 |
\global\count17=\sixt@@n |
| 1201 |
\fi |
| 1202 |
\fi |
| 1203 |
} |
| 1204 |
% \end{macrocode} |
| 1205 |
% By now, if a new stream could be allocated then the number of that |
| 1206 |
% stream is in |\b_count|, and if it couldn't then |\b_count| is --1. |
| 1207 |
% |
| 1208 |
% All output streams up to and including that whose number is in |
| 1209 |
% |\count17| is checked to see if it is available. Many unsuccessful |
| 1210 |
% |\newwrite|s could therefore mean we have to do quite a lot of |
| 1211 |
% checking. What's more, output stream 99 would incorrectly be |
| 1212 |
% interpreted as being in the pool but not used. To guard against these |
| 1213 |
% (improbable) errors, |\ch@ck| is redefined to stop allocation |
| 1214 |
% |\count| registers at their limit value. |
| 1215 |
% \begin{macrocode} |
| 1216 |
\def\ch@ck#1#2#3{ |
| 1217 |
\ifnum \count1#1<#2 \else |
| 1218 |
\errmessage{No~room~for~a~new~#3} |
| 1219 |
\global\count1#1=#2 |
| 1220 |
\fi |
| 1221 |
} |
| 1222 |
% \end{macrocode} |
| 1223 |
% \end{macro} \end{macro} |
| 1224 |
% |
| 1225 |
% |
| 1226 |
% \begin{macro}{\open_pout} |
| 1227 |
% \begin{macro}{\close_pout} |
| 1228 |
% The syntax for |\open_pout| is |
| 1229 |
% \begin{quote} |
| 1230 |
% |\open_pout|\meta{identifier}\marg{name} |
| 1231 |
% \end{quote} |
| 1232 |
% \meta{name} is the name of the output file one wishes to open. |
| 1233 |
% \meta{identifier} is a control sequence which will be redefined |
| 1234 |
% (globally) to act as an identifier of the file. |
| 1235 |
% \begin{macrocode} |
| 1236 |
\def\open_pout#1#2{ |
| 1237 |
\allocate_stream |
| 1238 |
\ifnum \b_count=\m@ne |
| 1239 |
\immediate\write\sixt@@n{fontinst~is~out~of~output~streams.^^J |
| 1240 |
Output~file~#2~cannot~be~opened.^^J |
| 1241 |
Writes~will~be~redirected~to~the~log~file. |
| 1242 |
} |
| 1243 |
\gdef#1{\m@ne} |
| 1244 |
\else |
| 1245 |
\immediate\openout\b_count=#2\x_relax |
| 1246 |
\x_cs\xdef{out_filename-\the\b_count}{#2} |
| 1247 |
\global\chardef#1=\b_count |
| 1248 |
\fi |
| 1249 |
} |
| 1250 |
% \end{macrocode} |
| 1251 |
% |
| 1252 |
% The syntax for |\close_pout| is |
| 1253 |
% \begin{quote} |
| 1254 |
% |\close_pout|\meta{identifier}\marg{what} |
| 1255 |
% \end{quote} |
| 1256 |
% \meta{identifier} is the output stream identifier which should have |
| 1257 |
% been defined in an earlier call of |\open_pout|. \meta{what} is a |
| 1258 |
% string which describes what has been written to the output file, |
| 1259 |
% e.g.\ |Metrics| or |Raw~font|. It will be used to write a message on |
| 1260 |
% the terminal. |
| 1261 |
% \begin{macrocode} |
| 1262 |
\def\close_pout#1#2{ |
| 1263 |
\ifnum #1=\closed_stream |
| 1264 |
\errmessage{Output~file~\string#1~(#2)~not~closed,^^J |
| 1265 |
since~it~was~not~open} |
| 1266 |
\else |
| 1267 |
\immediate\write\sixt@@n{#2~written~on~ |
| 1268 |
\csname out_filename-\the#1\endcsname.} |
| 1269 |
\ifnum #1=\m@ne \else |
| 1270 |
\immediate\closeout#1 |
| 1271 |
\global\x_cs\let{out_filename-\the#1}=\TeX_terminal |
| 1272 |
\fi |
| 1273 |
\global\chardef#1=\closed_stream |
| 1274 |
\fi |
| 1275 |
} |
| 1276 |
% \end{macrocode} |
| 1277 |
% \end{macro} \end{macro} |
| 1278 |
% |
| 1279 |
% |
| 1280 |
% \begin{macro}{\pout_line} |
| 1281 |
% The syntax for |\pout_line| is |
| 1282 |
% \begin{quote} |
| 1283 |
% |\pout_line|\meta{identifier}\marg{text} |
| 1284 |
% \end{quote} |
| 1285 |
% \meta{identifier} is the output stream identifier which should have |
| 1286 |
% been defined in an earlier call to |\open_pout|. \meta{text} is |
| 1287 |
% what will be written to the file. |
| 1288 |
% \begin{macrocode} |
| 1289 |
\def\pout_line#1#2{\immediate\write#1{#2}} |
| 1290 |
% \end{macrocode} |
| 1291 |
% |
| 1292 |
% \begin{macro}{\pout_lline} |
| 1293 |
% \changes{1.904}{1999/06/15}{Command added. (LH)} |
| 1294 |
% \changes{1.908}{1999/08/25}{\cs{edef}, to save macro expansions |
| 1295 |
% later. (LH)} |
| 1296 |
% \begin{macro}{\pout_llline} |
| 1297 |
% \changes{1.904}{1999/06/15}{Command added. (LH)} |
| 1298 |
% \changes{1.908}{1999/08/25}{\cs{edef} and don't use \cs{pout_lline}, |
| 1299 |
% to save macro expansions later. (LH)} |
| 1300 |
% There relate to |\pout_line| as |\out_lline| and |\out_llline| to |
| 1301 |
% |\out_line|. |
| 1302 |
% \begin{macrocode} |
| 1303 |
\edef\pout_lline#1#2{\noexpand\pout_line#1{\space\space\space#2}} |
| 1304 |
\edef\pout_llline#1#2{ |
| 1305 |
\noexpand\pout_line#1{\space\space\space\space\space\space#2} |
| 1306 |
} |
| 1307 |
% \end{macrocode} |
| 1308 |
% \end{macro}\end{macro}\end{macro} |
| 1309 |
% |
| 1310 |
% |
| 1311 |
% \begin{macro}{\tempfileprefix} |
| 1312 |
% \begin{macro}{\temp_prefix} |
| 1313 |
% Selecting the directory for temporary files. |
| 1314 |
% |
| 1315 |
% \begin{macrocode} |
| 1316 |
\def\tempfileprefix#1{\def\temp_prefix{#1}} |
| 1317 |
\tempfileprefix{} |
| 1318 |
%</pkg> |
| 1319 |
% \end{macrocode} |
| 1320 |
% \end{macro} \end{macro} |
| 1321 |
% |
| 1322 |
% |
| 1323 |
% \subsection{Conditionals} |
| 1324 |
% |
| 1325 |
% \subsubsection{Conditionals in \package{fontinst}} |
| 1326 |
% |
| 1327 |
% \begin{macro}{\then} |
| 1328 |
% \begin{macro}{\if_true} |
| 1329 |
% \begin{macro}{\if_false} |
| 1330 |
% In order to write macros that expand out to nested |\if|-statements, |
| 1331 |
% I say: |
| 1332 |
% \begin{quote} |
| 1333 |
% |\ifblah| \textellipsis\ |\then| \textellipsis\ |\else| |
| 1334 |
% \textellipsis\ |\fi| |
| 1335 |
% \end{quote} |
| 1336 |
% In order to match the |\fi|, |\then| has to be an |\if|. |
| 1337 |
% |
| 1338 |
% \begin{macrocode} |
| 1339 |
%<pkg|doc>\let\then=\iffalse |
| 1340 |
%<*pkg> |
| 1341 |
\def\if_false{\iffalse} |
| 1342 |
\def\if_true{\iftrue} |
| 1343 |
% \end{macrocode} |
| 1344 |
% \end{macro} \end{macro} \end{macro} |
| 1345 |
% |
| 1346 |
% \begin{macro}{\if_defined} |
| 1347 |
% \begin{macro}{\if_undefined} |
| 1348 |
% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.912} |
| 1349 |
% {2000/02/10}{Macro added. (LH)} |
| 1350 |
% These two macros are used as |
| 1351 |
% \begin{quote} |
| 1352 |
% |\if_defined|\marg{control sequence name}|\then|\\ |
| 1353 |
% |\if_undefined|\marg{control sequence name}|\then| |
| 1354 |
% \end{quote} |
| 1355 |
% The latter is functionally equivalent to |
| 1356 |
% \begin{quote} |
| 1357 |
% |\x_cs\ifx|\marg{control sequence name}|\x_relax| |
| 1358 |
% \end{quote} |
| 1359 |
% but it is shorter (1--3 tokens, depending on whether the |
| 1360 |
% unnecessary braces around \meta{control sequence name} are included |
| 1361 |
% or not). The former tests the same thing, but has true and false |
| 1362 |
% cases reversed. |
| 1363 |
% |
| 1364 |
% Apart from that it is shorter, another important reason for |
| 1365 |
% introducing these macros is that the \eTeX\ primitives |
| 1366 |
% |\ifcsname| and |\unless| provide a much better implementation than |
| 1367 |
% what is possible in normal \TeX. Therefore it is desirable to use |
| 1368 |
% these commands as much as possible, and by introducing these macros |
| 1369 |
% one can achieve this without having double definitions for more |
| 1370 |
% than these two macros. |
| 1371 |
% |
| 1372 |
% To avoid trouble with mismatched ifs and tokenizing control |
| 1373 |
% sequences special for \eTeX, |~| is temporarily made a comment |
| 1374 |
% character. I'm not sure |\ifcsname| and |\unless| weren't available |
| 1375 |
% in \eTeX\ versions before 2.0, but that's the oldest version I have |
| 1376 |
% a manual for. |
| 1377 |
% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.914}{2000/05/13} |
| 1378 |
% {Automatically selecting between \protect\TeX\ and \eTeX\ |
| 1379 |
% definitions. (LH)} |
| 1380 |
% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.927}{2003/12/11} |
| 1381 |
% {Modified \eTeX\ definitions to make them work with the |
| 1382 |
% crufty old ``unset is \cs{let} to \cs{relax}'' tradition |
| 1383 |
% of \package{fontinst} implementation. (LH) This was found |
| 1384 |
% to be a show-stopper for using v\,1.926 with \eTeX; |
| 1385 |
% Heiko Oberdiek found the cause of it.} |
| 1386 |
% \changes{1.927}{2004/08/07}{Fixed problem with \cs{unless}. (LH)} |
| 1387 |
% \begin{macrocode} |
| 1388 |
\_a_false\eTeX{2.0} |
| 1389 |
\if_a_\else \catcode`\~=14\x_relax \fi |
| 1390 |
% \end{macrocode} |
| 1391 |
% The following use of |\if| is a trick I learnt from the |
| 1392 |
% implementation of \package{docstrip}. |\if| will expand any amount of |
| 1393 |
% material until it has two unexpandable tokens to compare, hence one |
| 1394 |
% can use it to evaluate arbitrary boolean expressions in a single |
| 1395 |
% \TeX\ conditional, by expressing the expression as something which |
| 1396 |
% expands in \TeX's mouth to the value of the expression (either |0| |
| 1397 |
% or |1|). In this case the expression is ``the control sequence is |
| 1398 |
% defined and that definition is not \cs{relax}''. |
| 1399 |
% \begin{macrocode} |
| 1400 |
~ \def\if_defined#1\then{ |
| 1401 |
~ \if |
| 1402 |
~ \ifcsname#1\endcsname |
| 1403 |
~ \expandafter\ifx \csname#1\endcsname \x_relax |
| 1404 |
~ 0 |
| 1405 |
~ \else |
| 1406 |
~ 1 |
| 1407 |
~ \fi |
| 1408 |
~ \else |
| 1409 |
~ 0 |
| 1410 |
~ \fi |
| 1411 |
~ 1 |
| 1412 |
~ } |
| 1413 |
~ \def\if_undefined{\expandafter\unless\if_defined} |
| 1414 |
% \end{macrocode} |
| 1415 |
% \begin{macrocode} |
| 1416 |
\catcode`\~=\if_a_ 14 \else 10 \fi \x_relax |
| 1417 |
% \end{macrocode} |
| 1418 |
% \begin{macrocode} |
| 1419 |
~ \def\if_defined#1\then{ |
| 1420 |
~ \expandafter\ifx \csname#1\endcsname\x_relax |
| 1421 |
~ \expandafter\if_false |
| 1422 |
~ \else |
| 1423 |
~ \expandafter\if_true |
| 1424 |
~ \fi |
| 1425 |
~ } |
| 1426 |
~ \def\if_undefined#1\then{ |
| 1427 |
~ \expandafter\ifx \csname#1\endcsname\x_relax |
| 1428 |
~ } |
| 1429 |
% \end{macrocode} |
| 1430 |
% \begin{macrocode} |
| 1431 |
\catcode`\~=10\x_relax |
| 1432 |
% \end{macrocode} |
| 1433 |
% \end{macro}\end{macro} |
| 1434 |
% |
| 1435 |
% \begin{macro}{\gobble_if} |
| 1436 |
% It is sometimes best to skip both the then-part and |
| 1437 |
% the else-part of a conditional. |\gobble_if| does this by using the |
| 1438 |
% fact that expanding |\else| skips everything until the next matching |
| 1439 |
% |\fi| without looking for other |\else|s. |
| 1440 |
% \changes{1.900}{1998/12/11}{Macro added. (LH)} |
| 1441 |
% \changes{1.913}{2000/03/03}{Macro redefined; it now works entirely |
| 1442 |
% in the mouth. (LH)} |
| 1443 |
% \begin{macrocode} |
| 1444 |
\def\gobble_if{\iftrue\else} |
| 1445 |
% \end{macrocode} |
| 1446 |
% \end{macro} |
| 1447 |
% |
| 1448 |
% \begin{macro}{\if_or} |
| 1449 |
% \begin{macro}{\or_else} |
| 1450 |
% |\if_or| \textellipsis\ |\or_else| \textellipsis\ |\then| gives the |
| 1451 |
% disjunction of two booleans. |
| 1452 |
% \begin{macrocode} |
| 1453 |
\def\if_or#1\or_else#2\then{ |
| 1454 |
#1\then |
| 1455 |
\expandafter\if_true |
| 1456 |
\else |
| 1457 |
#2\then |
| 1458 |
\expandafter\expandafter\expandafter\if_true |
| 1459 |
\else |
| 1460 |
\expandafter\expandafter\expandafter\if_false |
| 1461 |
\fi |
| 1462 |
\fi |
| 1463 |
} |
| 1464 |
% \end{macrocode} |
| 1465 |
% \end{macro}\end{macro} |
| 1466 |
% |
| 1467 |
% \begin{macro}{\if_equal} |
| 1468 |
% The |\if_equal| macro is a \textellipsis|\then|-style wrapper around the |
| 1469 |
% |\ifx| primitive. Its calling syntax is |
| 1470 |
% \begin{quote} |
| 1471 |
% |\if_equal|\meta{token1}\meta{token2}|\then| |
| 1472 |
% \end{quote} |
| 1473 |
% \changes{1.912}{2000/02/23}{Macro added. (LH)} |
| 1474 |
% \begin{macrocode} |
| 1475 |
\def\if_equal#1\then{\ifx#1} |
| 1476 |
% \end{macrocode} |
| 1477 |
% \end{macro} |
| 1478 |
% |
| 1479 |
% \begin{macro}{\if_file_exists} |
| 1480 |
% |\if_file_exists| checks to see if a file exits, using |\openin|. |
| 1481 |
% |
| 1482 |
% \begin{macrocode} |
| 1483 |
\def\if_file_exists#1\then{ |
| 1484 |
\immediate\openin1=#1\x_relax |
| 1485 |
\ifeof1\x_relax |
| 1486 |
\immediate\closein1 |
| 1487 |
\expandafter\if_false |
| 1488 |
\else |
| 1489 |
\immediate\closein1 |
| 1490 |
\expandafter\if_true |
| 1491 |
\fi |
| 1492 |
} |
| 1493 |
%</pkg> |
| 1494 |
% \end{macrocode} |
| 1495 |
% \end{macro} |
| 1496 |
% |
| 1497 |
% |
| 1498 |
% \subsubsection{Conditionals in \package{fontdoc}} |
| 1499 |
% |
| 1500 |
% \changes{1.909}{1999/10/16}{System for documenting both branches of |
| 1501 |
% \texttt{if} statements in ETX and MTX files added. (LH)} |
| 1502 |
% In order to get a reasonable documentation of branches in an ETX or |
| 1503 |
% MTX file, the code in both branches must be typeset and the positions |
| 1504 |
% of the if, the else, and the fi must be clearly marked. There seems to |
| 1505 |
% be no reasonable way to achieve this if the standard names for the |
| 1506 |
% else and fi are used. Therefore the alternative names |\Else| and |
| 1507 |
% |\Fi| for |\else| and |\fi| have been introduced, to be used as in |
| 1508 |
% for example |
| 1509 |
% \begin{quote} |
| 1510 |
% |\ifisint{monowidth}\then|\\ |
| 1511 |
% \vadjust{}\quad\meta{then-part}\\ |
| 1512 |
% |\Else|\\ |
| 1513 |
% \vadjust{}\quad\meta{else-part}\\ |
| 1514 |
% |\Fi| |
| 1515 |
% \end{quote} |
| 1516 |
% |
| 1517 |
% \begin{macro}{\Else} |
| 1518 |
% \begin{macro}{\Fi} |
| 1519 |
% By default, these are identical to their lowercase counterparts. |
| 1520 |
% \begin{macrocode} |
| 1521 |
%<*pkg|doc> |
| 1522 |
\let\Else=\else |
| 1523 |
\let\Fi=\fi |
| 1524 |
%</pkg|doc> |
| 1525 |
% \end{macrocode} |
| 1526 |
% \end{macro}\end{macro} |
| 1527 |
% |
| 1528 |
% The interesting part begins if the ETX or MTX file gives the command |
| 1529 |
% |\showbranches|, since this means (i) that it wants the branches to be |
| 1530 |
% shown and (ii) that it complies to a simple rule about where to use |
| 1531 |
% |\Else| and |\Fi|. The rule is as follows: If an \texttt{if} statement |
| 1532 |
% is of \package{fontinst} form (it uses |\then|), then it must be |
| 1533 |
% terminated by |\Fi|, and a possible else in the statement must be an |
| 1534 |
% |\Else|. If an \texttt{if} statement is \emph{not} of \package{fontinst} |
| 1535 |
% form (it has no |\then|), then it must be terminated by |\fi|, and a |
| 1536 |
% possible else in the statement must be an |\else|. Only the |
| 1537 |
% \package{fontinst} form \texttt{if} statements are affected by |
| 1538 |
% |\showbranches|. |
| 1539 |
% |
| 1540 |
% \begin{macro}{\showbranches} |
| 1541 |
% \begin{macro}{\generic@if} |
| 1542 |
% The |\showbranches| command changes the definitions of |
| 1543 |
% |\generic@if|, |\then|, |\Else|, and |\Fi| so that the branches of |
| 1544 |
% \texttt{if} statements will be made visible. |\generic@if| is used |
| 1545 |
% to implement all the \package{fontinst} form \texttt{if} statements |
| 1546 |
% in \package{fontdoc}. It is called as |
| 1547 |
% \begin{quote} |
| 1548 |
% |\generic@if|\marg{description} |
| 1549 |
% \end{quote} |
| 1550 |
% and this will by default expand to |\iftrue|, but after executing |
| 1551 |
% |\showbranches| it will instead typeset |
| 1552 |
% \begin{quote} |
| 1553 |
% If \meta{description} then |
| 1554 |
% \end{quote} |
| 1555 |
% and do a bit of additional housekeeping. |
| 1556 |
% |
| 1557 |
% \begin{macrocode} |
| 1558 |
%<*doc> |
| 1559 |
\def\generic@if#1{\iftrue} |
| 1560 |
% \end{macrocode} |
| 1561 |
% \begin{macrocode} |
| 1562 |
\newcommand\showbranches{% |
| 1563 |
\let\generic@if=\branches@if |
| 1564 |
\let\then=\x@relax |
| 1565 |
\let\Else=\branches@else |
| 1566 |
\let\Fi=\branches@fi |
| 1567 |
} |
| 1568 |
% \end{macrocode} |
| 1569 |
% \end{macro}\end{macro} |
| 1570 |
% |
| 1571 |
% \begin{macro}{\saved@slot@number} |
| 1572 |
% The |\saved@slot@number| is used for storing the value of |
| 1573 |
% |\slot@number| at the \texttt{if} until the |\Else|. Unlike |
| 1574 |
% |\slot@number|, it is always set locally. |
| 1575 |
% \begin{macrocode} |
| 1576 |
\newcount\saved@slot@number |
| 1577 |
% \end{macrocode} |
| 1578 |
% \end{macro} |
| 1579 |
% |
| 1580 |
% \begin{macro}{\branches@if} |
| 1581 |
% \begin{macro}{\branches@else} |
| 1582 |
% \begin{macro}{\branches@fi} |
| 1583 |
% \changes{1.916}{2001/01/25}{Commented out test which concatenates |
| 1584 |
% consecutive \cs{Fi}s, since that doesn't work together with the |
| 1585 |
% \texttt{IfBranch} environment. (LH)} |
| 1586 |
% \begin{macro}{\branches@type} |
| 1587 |
% \begin{macro}{\branches@par} |
| 1588 |
% The macros |\branches@if|, |\branches@else|, and |\branches@fi| |
| 1589 |
% contain the definitions of |\generic@if|, |\Else|, and |\Fi| |
| 1590 |
% respectively that are used when branches are to be shown. Their |
| 1591 |
% basic task is to typeset the texts |If #1 then|, |Else|, and |Fi| in |
| 1592 |
% an appropriate style and with appropriate spacing around. A |
| 1593 |
% complicating matter is however that |\slot@number| must have the |
| 1594 |
% same value at the beginning of the \textit{else} part as at the |
| 1595 |
% beginning of the \textit{then} part. To achieve this, the value of |
| 1596 |
% |\slot@number| is saved in |\saved@slot@number| at the \textit{if} |
| 1597 |
% and copied back at the \textit{else}. To make this work even with |
| 1598 |
% nested \textit{if}s, both the \textit{then} branch and the |
| 1599 |
% \textit{else} branch are enclosed in groups and |
| 1600 |
% |\saved@slot@number| is assigned locally. |
| 1601 |
% |
| 1602 |
% There are still some formatting issues to solve, however. In some |
| 1603 |
% cases it works best to put the text of adjacent \textit{if}, |
| 1604 |
% \textit{else}, or \textit{fi} in the same paragraph, and it must be |
| 1605 |
% possible to recognize those cases. This is done by looking at the |
| 1606 |
% macro |\branches@type|, which should expand to |
| 1607 |
% \begin{enumerate} |
| 1608 |
% \item[\texttt{0}] if the preceeding item was an \textit{if}, |
| 1609 |
% \item[\texttt{1}] if the preceeding item was an \textit{else} |
| 1610 |
% preceeded by an \textit{if}, |
| 1611 |
% \item[\texttt{2}] if the preceeding item was an \textit{else} |
| 1612 |
% not preceeded by an \textit{if}, |
| 1613 |
% \item[\texttt{3}] if the preceeding item was a \textit{fi}, |
| 1614 |
% \item[\texttt{4}] if it was anything else. |
| 1615 |
% \end{enumerate} |
| 1616 |
% |\branches@par| is used for resetting |\branches@type| to \texttt{4}. |
| 1617 |
% It is an auto-resetting definition of |\par|. |
| 1618 |
% |
| 1619 |
% \begin{macrocode} |
| 1620 |
\def\branches@if#1{% |
| 1621 |
\ifnum \branches@type=\tw@ |
| 1622 |
\begin{IfBranchDummy}% |
| 1623 |
\textit{ if #1 then}% |
| 1624 |
\else |
| 1625 |
\par |
| 1626 |
\ifFD@tight@\else \addvspace\medskipamount \fi |
| 1627 |
\noindent\textit{If #1 then}% |
| 1628 |
\fi |
| 1629 |
\saved@slot@number=\slot@number |
| 1630 |
\gdef\branches@type{0}% |
| 1631 |
\let\par=\branches@par |
| 1632 |
} |
| 1633 |
% \end{macrocode} |
| 1634 |
% \begin{macrocode} |
| 1635 |
\def\branches@else{% |
| 1636 |
\ifnum \branches@type=\z@ |
| 1637 |
\textit{ relax else}% |
| 1638 |
\gdef\branches@type{1}% |
| 1639 |
\else |
| 1640 |
\par |
| 1641 |
\end{IfBranch}% |
| 1642 |
\noindent\textit{Else}% |
| 1643 |
\gdef\branches@type{2}% |
| 1644 |
\fi |
| 1645 |
\global\slot@number=\saved@slot@number |
| 1646 |
\let\par=\branches@par |
| 1647 |
} |
| 1648 |
% \end{macrocode} |
| 1649 |
% \begin{macrocode} |
| 1650 |
\def\branches@fi{% |
| 1651 |
\ifnum \branches@type=\thr@@ |
| 1652 |
\expandafter\end \expandafter{\@currenvir}% |
| 1653 |
\expandafter\gdef \expandafter\FD@saved@fis |
| 1654 |
\expandafter{\FD@saved@fis \space fi}% |
| 1655 |
\else |
| 1656 |
\end{IfBranch}% |
| 1657 |
\gdef\FD@saved@fis{Fi}% |
| 1658 |
\fi |
| 1659 |
\gdef\branches@type{3}% |
| 1660 |
\let\par=\branches@par |
| 1661 |
} |
| 1662 |
% \end{macrocode} |
| 1663 |
% \begin{macrocode} |
| 1664 |
\gdef\branches@type{4} |
| 1665 |
% \end{macrocode} |
| 1666 |
% \begin{macrocode} |
| 1667 |
\def\branches@par{% |
| 1668 |
\@restorepar |
| 1669 |
\ifnum \branches@type=\thr@@ |
| 1670 |
\noindent\textit{\FD@saved@fis}\par |
| 1671 |
\else |
| 1672 |
\begin{IfBranch}% |
| 1673 |
\fi |
| 1674 |
\gdef\branches@type{4}% |
| 1675 |
} |
| 1676 |
% \end{macrocode} |
| 1677 |
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} |
| 1678 |
% |
| 1679 |
% \begin{environment}{IfBranch} |
| 1680 |
% \changes{1.916}{2001/01/09}{Environment added. (LH)} |
| 1681 |
% \changes{1.920}{2001/09/16}{Removed assignment to \cs{listparindent}. |
| 1682 |
% I don't know why it was there in the first place. (LH)} |
| 1683 |
% \begin{switch}{FD@tight@} |
| 1684 |
% \changes{1.916}{2001/01/09}{Switch added. (LH)} |
| 1685 |
% The branches of a conditional that is being shown are put in an |
| 1686 |
% \texttt{IfBranch} environment, to emphasize the branches as logical |
| 1687 |
% units in the file. Depending on the value of the \texttt{FD@tight@} |
| 1688 |
% switch, there are two different ways that the branches can be |
| 1689 |
% distinguished. In the non-tight setting (\texttt{FD@tight@} false), |
| 1690 |
% there is one |\medskip|\-|amount| of vertical space before and after |
| 1691 |
% the branch, but no indentation. In the tight setting (which is used |
| 1692 |
% for \meta{glyph commands} and \meta{slot commands}), there is no |
| 1693 |
% extra vertical space around the branch, instead it is indented by |
| 1694 |
% $1\,\mathrm{em}$. |
| 1695 |
% \begin{macrocode} |
| 1696 |
\newif\ifFD@tight@ |
| 1697 |
\newenvironment{IfBranch}{% |
| 1698 |
\list{}{% |
| 1699 |
\ifFD@tight@ |
| 1700 |
\setlength\topsep{\z@skip}% |
| 1701 |
\@beginparpenalty=\z@ |
| 1702 |
\@endparpenalty=\z@ |
| 1703 |
\setlength\leftmargin{1em}% |
| 1704 |
\else |
| 1705 |
\setlength\topsep{\medskipamount}% |
| 1706 |
\@beginparpenalty=-10% |
| 1707 |
\@endparpenalty=\@beginparpenalty |
| 1708 |
\setlength\leftmargin{\z@}% |
| 1709 |
\fi |
| 1710 |
\setlength\partopsep{\z@skip}% |
| 1711 |
\setlength\itemsep{\z@skip}% |
| 1712 |
\setlength\parsep{\z@ plus\p@}% |
| 1713 |
\setlength\rightmargin{\z@}% |
| 1714 |
\setlength\itemindent{\z@}% |
| 1715 |
}% |
| 1716 |
\item[]% |
| 1717 |
}{\endlist} |
| 1718 |
% \end{macrocode} |
| 1719 |
% \end{switch}\end{environment} |
| 1720 |
% |
| 1721 |
% \begin{environment}{IfBranchDummy} |
| 1722 |
% \changes{1.916}{2001/01/25}{Environment added. (LH)} |
| 1723 |
% In order to get the nesting right, each |\branches@else| command has |
| 1724 |
% to |\begin| a new environment, but if it is immediately followed by |
| 1725 |
% a |\branches@if| then that environment should not cause an |
| 1726 |
% indentation. In these cases the \texttt{IfBranchDummy} environment |
| 1727 |
% is used instead of \texttt{IfBranch}. |
| 1728 |
% \begin{macrocode} |
| 1729 |
\newenvironment{IfBranchDummy}{}{} |
| 1730 |
%</doc> |
| 1731 |
% \end{macrocode} |
| 1732 |
% \end{environment} |
| 1733 |
% |
| 1734 |
% |
| 1735 |
% \subsubsection{Miscellanea} |
| 1736 |
% |
| 1737 |
% \begin{macro}{\primitiveinput} |
| 1738 |
% |
| 1739 |
% If |\@@input| is defined, I'll assume it's the \LaTeX{} version |
| 1740 |
% of the \TeX{} |\input| primitive. I need this so that I can say |
| 1741 |
% |\expandafter\foo\primitiveinput|, which doesn't work with the |
| 1742 |
% \LaTeX{} version of |\input|. |
| 1743 |
% |
| 1744 |
% \begin{macrocode} |
| 1745 |
%<*pkg> |
| 1746 |
\x_cs\ifx{@@input}\x_relax |
| 1747 |
\let\primitiveinput=\input |
| 1748 |
\else |
| 1749 |
\let\primitiveinput=\@@input |
| 1750 |
\fi |
| 1751 |
% \end{macrocode} |
| 1752 |
% \end{macro} |
| 1753 |
% |
| 1754 |
% |
| 1755 |
% \DescribeMacro{\process_csep_list} |
| 1756 |
% The macro |
| 1757 |
% \begin{quote} |
| 1758 |
% |\process_csep_list|\marg{pretext}\meta{comma-sep~list}^^A |
| 1759 |
% |,\process_csep_list,| |
| 1760 |
% \end{quote} |
| 1761 |
% executes \meta{pretext}\marg{item} for every item in the |
| 1762 |
% \meta{comma-sep~list}. |
| 1763 |
% |
| 1764 |
% \begin{macro}{\process_csep_list} |
| 1765 |
% \begin{macrocode} |
| 1766 |
\def\process_csep_list#1#2,{ |
| 1767 |
\ifx\process_csep_list#2 |
| 1768 |
\expandafter\gobble_one |
| 1769 |
\else |
| 1770 |
\expandafter\identity_one |
| 1771 |
\fi{ |
| 1772 |
#1{#2} |
| 1773 |
\process_csep_list{#1} |
| 1774 |
} |
| 1775 |
} |
| 1776 |
%</pkg> |
| 1777 |
% \end{macrocode} |
| 1778 |
% \end{macro} |
| 1779 |
% |
| 1780 |
% |
| 1781 |
% \begin{macro}{\print@csep@list} |
| 1782 |
% \textit{Use of this macro is now deprecated; use \cs{TypesetList} |
| 1783 |
% instead wherever possible.} The macro call |
| 1784 |
% \begin{quote} |
| 1785 |
% |\print@csep@list|\marg{format}\marg{list} |
| 1786 |
% \end{quote} |
| 1787 |
% prints the comma-separated list \meta{list} in math mode. |
| 1788 |
% \meta{format} can be used to set the style in which the list is |
| 1789 |
% printed, since it is executed in the beginning of the same group as |
| 1790 |
% in which the list is printed. |
| 1791 |
% |
| 1792 |
% The formating is based on changing the |\mathcode| of comma to |
| 1793 |
% |"8000| so that the comma can be used as if it was an active character |
| 1794 |
% without actually having to be one. |
| 1795 |
% \begin{macrocode} |
| 1796 |
%<*doc> |
| 1797 |
\begingroup |
| 1798 |
\catcode`\,=13 |
| 1799 |
\gdef\print@csep@list#1#2{% |
| 1800 |
$% |
| 1801 |
\ifnum "8000=\mathcode`\,\else |
| 1802 |
\mathchardef\private@comma=\mathcode`\,% |
| 1803 |
\mathcode`\,="8000\x@relax |
| 1804 |
\fi |
| 1805 |
#1% |
| 1806 |
\let,=\active@comma |
| 1807 |
#2% |
| 1808 |
$% |
| 1809 |
} |
| 1810 |
\endgroup |
| 1811 |
\def\active@comma{\private@comma \penalty\binoppenalty} |
| 1812 |
%</doc> |
| 1813 |
% \end{macrocode} |
| 1814 |
% \end{macro} |
| 1815 |
% |
| 1816 |
% |
| 1817 |
% |
| 1818 |
% \subsection{Real numbers} |
| 1819 |
% |
| 1820 |
% \TeX's \meta{number}s are merely integers, but \package{fontinst} |
| 1821 |
% needs to store and calculate with numerical entities (most of which |
| 1822 |
% are lengths) that are intrinsically real numbers. Most of the time, |
| 1823 |
% \package{fontinst} does this by using a representation of real numbers |
| 1824 |
% by integers in which a real number $x$ is represented by the integer |
| 1825 |
% that $1000x$ gets rounded to. This representation has proved |
| 1826 |
% sufficiently precise for most purposes. |
| 1827 |
% |
| 1828 |
% There are however a few cases in which real numbers must be delt with |
| 1829 |
% in a more general fashion. Generic routines for this appear in this |
| 1830 |
% subsection. |
| 1831 |
% |
| 1832 |
% \begin{macro}{\make_factor} |
| 1833 |
% \changes{1.903}{1999/05/13}{Macro added. (LH)} |
| 1834 |
% The |\make_factor| macro is meant to be used in the context |
| 1835 |
% \begin{quote} |
| 1836 |
% |\make_factor|\marg{number} |
| 1837 |
% \end{quote} |
| 1838 |
% where \meta{number} can be any legal \TeX\ number. It expands to |
| 1839 |
% the same number divided by 1000, with decimals, so that what it |
| 1840 |
% expands to matches the regular expression |
| 1841 |
% \begin{quote} |
| 1842 |
% |-?[0-9]+\.[0-9][0-9][0-9]| |
| 1843 |
% \end{quote} |
| 1844 |
% |
| 1845 |
% More specifically, |\make_factor| has two tasks to perform: it takes |
| 1846 |
% care of the sign, so that its subsidary macros need only work with |
| 1847 |
% unsigned numbers, and it converts the \meta{number} (which could |
| 1848 |
% well be a countdef or mathchardef token) to a sequence of digits. |
| 1849 |
% \begin{macrocode} |
| 1850 |
%<*pkg> |
| 1851 |
\def\make_factor#1{ |
| 1852 |
\ifnum #1<\z@ |
| 1853 |
-\expandafter\make_factor_i\expandafter{\number-#1} |
| 1854 |
\else |
| 1855 |
\expandafter\make_factor_i\expandafter{\number#1} |
| 1856 |
\fi |
| 1857 |
} |
| 1858 |
% \end{macrocode} |
| 1859 |
% |
| 1860 |
% \begin{macro}{\make_factor_i} |
| 1861 |
% |\make_factor_i| distinguishes between the two main cases of |
| 1862 |
% numbers that in absolute value are less than 1000 and numbers that |
| 1863 |
% in absolute value are greater than or equal to 1000. In the former |
| 1864 |
% case, zeros need to be inserted. In the latter case, some number |
| 1865 |
% of digits need to be stepped over before the decimal point can be |
| 1866 |
% inserted. |
| 1867 |
% \begin{macrocode} |
| 1868 |
\def\make_factor_i#1{ |
| 1869 |
\ifnum #1<\one_thousand |
| 1870 |
\make_factor_ii{#1} |
| 1871 |
\else |
| 1872 |
\make_factor_iii #1 |
| 1873 |
\fi |
| 1874 |
#1 |
| 1875 |
} |
| 1876 |
% \end{macrocode} |
| 1877 |
% \end{macro} |
| 1878 |
% |
| 1879 |
% \begin{macro}{\make_factor_ii} |
| 1880 |
% |\make_factor_ii| inserts extra zeros, in the extent it is |
| 1881 |
% needed. |
| 1882 |
% \begin{macrocode} |
| 1883 |
\def\make_factor_ii#1{ |
| 1884 |
0. |
| 1885 |
\ifnum #1<\one_hundred |
| 1886 |
0 |
| 1887 |
\ifnum #1<10~ 0\fi |
| 1888 |
\fi |
| 1889 |
} |
| 1890 |
% \end{macrocode} |
| 1891 |
% \end{macro} |
| 1892 |
% |
| 1893 |
% \begin{macro}{\make_factor_iii} |
| 1894 |
% |\make_factor_iii| steps over one digit and checks if this is the |
| 1895 |
% correct position for the decimal point. Note that |#2#3| is |
| 1896 |
% exactly the digits in the number that has not been stepped over. |
| 1897 |
% Also note that comparision with |#2#3| would not work, since |#2| |
| 1898 |
% can be |0|. |
| 1899 |
% \begin{macrocode} |
| 1900 |
\def\make_factor_iii#1#2#3\fi#4{ |
| 1901 |
\fi |
| 1902 |
#4 |
| 1903 |
\ifnum 1#3<\one_thousand |
| 1904 |
. |
| 1905 |
\else |
| 1906 |
\make_factor_iii#2#3 |
| 1907 |
\fi |
| 1908 |
} |
| 1909 |
% \end{macrocode} |
| 1910 |
% \end{macro} |
| 1911 |
% \end{macro} |
| 1912 |
% |
| 1913 |
% It also happens that real numbers are represented by dimens, in the |
| 1914 |
% common way that the number 1 is represented by the dimen 1\,pt. For |
| 1915 |
% those cases the following macro is indispensable. |
| 1916 |
% |
| 1917 |
% \begin{macro}{\lose_measure} |
| 1918 |
% Get rid of a trailing |pt| when converting dimension. |
| 1919 |
% \begin{macrocode} |
| 1920 |
{ |
| 1921 |
\catcode`\p=12 |
| 1922 |
\catcode`\t=12 |
| 1923 |
\gdef\lose_measure#1pt{#1} |
| 1924 |
} |
| 1925 |
%</pkg> |
| 1926 |
% \end{macrocode} |
| 1927 |
% \end{macro} |
| 1928 |
% |
| 1929 |
% |
| 1930 |
% \subsection{Hexadecimal numbers} |
| 1931 |
% |
| 1932 |
% Some of the file formats \package{fontinst} can generate requires |
| 1933 |
% that some numbers are written in hexadecimal form rather than in |
| 1934 |
% \TeX's default decimal form. This is somewhat awkward, as it would be |
| 1935 |
% very hard to implement without using explicit arithmetic. |
| 1936 |
% |
| 1937 |
% \begin{macro}{\format_hex} |
| 1938 |
% The |\format_hex| command formats a number as hexadecimal digits. |
| 1939 |
% The syntax is |
| 1940 |
% \begin{quote} |
| 1941 |
% |\format_hex|\marg{command}\marg{value}\marg{digits} |
| 1942 |
% \end{quote} |
| 1943 |
% where \meta{command} will be |\def|ined to be the formatted number. |
| 1944 |
% \meta{value} is the number to format; it must not be negative. |
| 1945 |
% \meta{digits} is the number of digits to generate. If the |
| 1946 |
% \meta{value} is greater than or equal to $16^{\mathit{digits}}$ |
| 1947 |
% then |\a_count| will be set to \meta{value} divided by this number |
| 1948 |
% and the formatted value will be for the corresponding remainder. |
| 1949 |
% \changes{1.928}{2004/11/28}{Macro added. (LH)} |
| 1950 |
% |
| 1951 |
% The macro overwrites |\a_count|, |\b_count|, and |\c_count|. |
| 1952 |
% |
| 1953 |
% \begin{macro}{\format_hex_i} |
| 1954 |
% The |\format_hex_i| macro is the iterator for |\format_hex|. |
| 1955 |
% It is used in the context |
| 1956 |
% \begin{quote} |
| 1957 |
% |\format_hex_i|\marg{command}\marg{control token} |
| 1958 |
% \end{quote} |
| 1959 |
% If the \meta{control token} is |i| then nothing is done. |
| 1960 |
% Otherwise the quotient and remainder of |\a_count| with respect to |
| 1961 |
% $16$ is computed, where the former is assigned to |\a_count| and |
| 1962 |
% the latter is converted to hexadecimal and prepended to the |
| 1963 |
% \meta{command}, after which the macro expands to |
| 1964 |
% |\format_hex_i|\meta{command}. |
| 1965 |
% \begin{macrocode} |
| 1966 |
%<*pkg> |
| 1967 |
\def\format_hex_i#1#2{ |
| 1968 |
\if #2i \else |
| 1969 |
\b_count=\a_count |
| 1970 |
\divide \a_count \sixt@@n |
| 1971 |
\c_count=\a_count |
| 1972 |
\multiply \c_count \sixt@@n |
| 1973 |
\advance \b_count -\c_count |
| 1974 |
\edef#1{ |
| 1975 |
\ifcase\b_count 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or |
| 1976 |
9\or a\or b\or c\or d\or e\or f\fi |
| 1977 |
#1 |
| 1978 |
} |
| 1979 |
\expandafter\format_hex_i \expandafter#1 |
| 1980 |
\fi |
| 1981 |
} |
| 1982 |
% \end{macrocode} |
| 1983 |
% \end{macro} |
| 1984 |
% |
| 1985 |
% To get the loop to run the wanted number of times, one uses the |
| 1986 |
% trick that |\romannumeral| can generate an arbitrary number of |m|s. |
| 1987 |
% The |\identity_one| stuff is to prevent |\number| from processesing |
| 1988 |
% the subsequent |001~|, which will be the last that |\romannumeral| |
| 1989 |
% reads. |
| 1990 |
% \begin{macrocode} |
| 1991 |
\def\format_hex#1#2#3{ |
| 1992 |
\a_count=#2 |
| 1993 |
\let#1\empty_command |
| 1994 |
\expandafter\format_hex_i \expandafter#1 \romannumeral |
| 1995 |
\expandafter\identity_one\expandafter{\number#3}001~ |
| 1996 |
} |
| 1997 |
%</pkg> |
| 1998 |
% \end{macrocode} |
| 1999 |
% \end{macro} |
| 2000 |
% |
| 2001 |
% |
| 2002 |
% |
| 2003 |
% \subsection{Error, warning, and info messages} |
| 2004 |
% |
| 2005 |
% The code in this subsection is an adaptation of code from the |
| 2006 |
% \LaTeX\ kernel---more precisely from the source file |
| 2007 |
% \texttt{lterror.dtx}---and the same is true for some of the comments. |
| 2008 |
% As authors of that code are listed Johannes Braams, David Carlisle, |
| 2009 |
% Alan Jeffrey, Leslie Lamport, Frank Mittelbach, Chris Rowley, and |
| 2010 |
% Rainer Sch\"opf. The original source can be found in the file |
| 2011 |
% \texttt{lterror.dtx} in the \texttt{macros}\slash\texttt{latex}\slash |
| 2012 |
% \texttt{base} directory in any of the Comprehensive \TeX\ Archive |
| 2013 |
% Network FTP sites.\footnote{As if anyone who has managed to get this |
| 2014 |
% far didn't already know that!} |
| 2015 |
% |
| 2016 |
% That should have fulfilled the conditions in the LPPL.^^A |
| 2017 |
% \changes{1.906}{1999/07/23}{Adaptation of \LaTeX's message system |
| 2018 |
% completed. (LH)} |
| 2019 |
% \par\bigskip |
| 2020 |
% |
| 2021 |
% |
| 2022 |
% \subsubsection{General commands} |
| 2023 |
% |
| 2024 |
% \begin{macro}{\messagebreak} |
| 2025 |
% This command prints a new-line inside a message, followed by a |
| 2026 |
% continuation whose exact appearence may depend on the context. |
| 2027 |
% Normally this command is defined to be |\relax|, but inside messages |
| 2028 |
% it gets redefined to a linebreak (|^^J|) followed by the appropriate |
| 2029 |
% continuation. |
| 2030 |
% \changes{1.909}{1999/10/16}{New name for \cs{message_break}. (LH)} |
| 2031 |
% \begin{macrocode} |
| 2032 |
%<pkg>\let\messagebreak\x_relax |
| 2033 |
%<doc>\let\messagebreak\space |
| 2034 |
% \end{macrocode} |
| 2035 |
% \end{macro} |
| 2036 |
% |
| 2037 |
% \begin{macro}{\generic_info} |
| 2038 |
% This takes two arguments: a continuation and a message, and sends |
| 2039 |
% the result to the log file. |
| 2040 |
% \begin{macrocode} |
| 2041 |
%<*pkg> |
| 2042 |
\def\generic_info#1#2{ |
| 2043 |
\begingroup |
| 2044 |
\def\messagebreak{^^J#1} |
| 2045 |
\immediate\write\m@ne{#2\on_line.} |
| 2046 |
\endgroup |
| 2047 |
} |
| 2048 |
% \end{macrocode} |
| 2049 |
% \end{macro} |
| 2050 |
% |
| 2051 |
% \begin{macro}{\generic_warning} |
| 2052 |
% This takes two arguments: a continuation and a message, and sends |
| 2053 |
% the result to the screen. |
| 2054 |
% \begin{macrocode} |
| 2055 |
\def\generic_warning#1#2{ |
| 2056 |
\begingroup |
| 2057 |
\def\messagebreak{^^J#1} |
| 2058 |
\immediate\write\closed_stream{^^J#2\on_line.^^J} |
| 2059 |
\endgroup |
| 2060 |
} |
| 2061 |
% \end{macrocode} |
| 2062 |
% \end{macro} |
| 2063 |
% |
| 2064 |
% \begin{macro}{\generic_error} |
| 2065 |
% ``This macro takes four arguments: a continuation, |
| 2066 |
% an error message, where to go for further information, and the help |
| 2067 |
% information. It displays the error message, and sets the error help |
| 2068 |
% (the result of typing |h| to the prompt), and does a horrible hack |
| 2069 |
% to turn the last context line (which by default is the only context |
| 2070 |
% line) into just three dots. This could be made more efficient.'' |
| 2071 |
% |
| 2072 |
% Thus far the \LaTeX\ comments, but the horrible hack it mensions |
| 2073 |
% has been removed since it just makes things look strange when |
| 2074 |
% |\errorcontextlines| is larger than one. |
| 2075 |
% ^^A What the hack actually does is that it turns |
| 2076 |
% ^^A as much as possible of the topmost context line to spaces. It has |
| 2077 |
% ^^A two ways of achieving this. The first is to make the context line |
| 2078 |
% ^^A too long to display in full, by ending the argument of |\errmessage| |
| 2079 |
% ^^A with the control sequence |
| 2080 |
% ^^A \begin{quote} |
| 2081 |
% ^^A \tiny\verb*+\@err@ +^^A |
| 2082 |
% ^^A \verb*+ + |
| 2083 |
% ^^A \end{quote} |
| 2084 |
% ^^A As its name ends with a long sequence of spaces, it won't be visible; |
| 2085 |
% ^^A the |@err@| appears in the |...| part of the line. The other method |
| 2086 |
% ^^A it uses is to turn every token in the context line that is not part |
| 2087 |
% ^^A of a control sequence name to spaces (as characters, not in |
| 2088 |
% ^^A category) through a |\lowercase| trick. The only characters that |
| 2089 |
% ^^A cannot be turned into spaces this way are the three continuation |
| 2090 |
% ^^A dots. |
| 2091 |
% The ``where to go for further information'' message is currently not |
| 2092 |
% used (it is commented out in |\fontinsterror| below), since there |
| 2093 |
% is no good place to refer to anyway. If the documentation is ever |
| 2094 |
% improved in this respect, it would of course be best to reinsert |
| 2095 |
% this message. Note however that unlike the case in \LaTeX, this |
| 2096 |
% message should end with a |^^J|. |
| 2097 |
% |
| 2098 |
% A complication is that \TeX\ versions older than 3.141 have a bug |
| 2099 |
% which causes |^^J| to not force a linebreak in |\message| and |
| 2100 |
% |\errmessage| commands. So for these old \TeX's we use a |\write| to |
| 2101 |
% produce the message, and then have an empty |\errmessage| command. |
| 2102 |
% This causes an extra line of the form |
| 2103 |
%\begin{verbatim} |
| 2104 |
%! . |
| 2105 |
%\end{verbatim} |
| 2106 |
% to appear on the terminal, but if you do not like it, you can always |
| 2107 |
% upgrade your \TeX! |
| 2108 |
% |
| 2109 |
% Since I don't think many \package{fontinst} users use such old |
| 2110 |
% \TeX s, I removed \LaTeX's test for \TeX\ version at this point. The |
| 2111 |
% code for old \TeX s is still there, but it lies in a \package{docstrip} |
| 2112 |
% module of its own. |
| 2113 |
% |
| 2114 |
% First the `standard case'. |
| 2115 |
% \begin{macrocode} |
| 2116 |
%<*!oldTeX> |
| 2117 |
\def\generic_error#1#2#3#4{ |
| 2118 |
\begingroup |
| 2119 |
\immediate\write\closed_stream{} |
| 2120 |
\def\messagebreak{^^J} |
| 2121 |
\edef\a_macro{{#4}} |
| 2122 |
\errhelp\a_macro |
| 2123 |
\def\messagebreak{^^J#1} |
| 2124 |
\errmessage{#2.^^J^^J#3 |
| 2125 |
Type~\space H~<return>~\space for~immediate~help |
| 2126 |
} |
| 2127 |
\endgroup |
| 2128 |
} |
| 2129 |
%</!oldTeX> |
| 2130 |
% \end{macrocode} |
| 2131 |
% |
| 2132 |
% Secondly the version for old \TeX's. |
| 2133 |
% \begin{macrocode} |
| 2134 |
%<*oldTeX> |
| 2135 |
\def\generic_error#1#2#3#4{% |
| 2136 |
\begingroup |
| 2137 |
\immediate\write\closed_stream{} |
| 2138 |
\def\messagebreak{^^J} |
| 2139 |
\edef\a_macro{{#4}} |
| 2140 |
\errhelp\a_macro |
| 2141 |
\def\messagebreak{^^J#1} |
| 2142 |
\immediate\write\closed_stream{!~#2.^^J^^J#3^^J |
| 2143 |
Type~\space H~<return>~\space for~immediate~help. |
| 2144 |
} |
| 2145 |
\errmessage{} |
| 2146 |
\endgroup |
| 2147 |
} |
| 2148 |
%</oldTeX> |
| 2149 |
% \end{macrocode} |
| 2150 |
% \end{macro} |
| 2151 |
% |
| 2152 |
% |
| 2153 |
% |
| 2154 |
% \begin{macro}{\fontinsterror} |
| 2155 |
% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_error}. (LH)} |
| 2156 |
% \begin{macro}{\fontinstwarning} |
| 2157 |
% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_warning}. (LH)} |
| 2158 |
% \begin{macro}{\fontinstwarningnoline} |
| 2159 |
% \changes{1.909}{1999/10/16}{New name for |
| 2160 |
% \cs{fontinst_warning_no_line}. (LH)} |
| 2161 |
% \begin{macro}{\fontinstinfo} |
| 2162 |
% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_info}. (LH)} |
| 2163 |
% These commands are intended for giving a uniformed, and for the |
| 2164 |
% programmers hopefully simplified, form of error, warning, and info |
| 2165 |
% messages. The syntax is: |
| 2166 |
% \begin{quote} |
| 2167 |
% |\fontinsterror|\marg{subsystem}\marg{error}\marg{help}\\ |
| 2168 |
% |\fontinstwarning|\marg{subsystem}\marg{warning}\\ |
| 2169 |
% |\fontinstwarningnoline|\marg{subsystem}\marg{warning}\\ |
| 2170 |
% |\fontinstinfo|\marg{subsystem}\marg{info} |
| 2171 |
% \end{quote} |
| 2172 |
% A \meta{subsystem} in this context is intended to be some piece of |
| 2173 |
% text which identifies some functionally clearly defined part of |
| 2174 |
% \package{fontinst}. Examples of \meta{subsystem}s could be |
| 2175 |
% \texttt{PL to MTX converter}, \texttt{Ligful (V)PL writer}, and |
| 2176 |
% \texttt{Latin family}. |
| 2177 |
% |
| 2178 |
% The |\fontinsterror| command prints the \meta{error} message, and |
| 2179 |
% presents the interactive prompt; if the user types |h|, then the |
| 2180 |
% \meta{help} information is displayed. The |\fontinstwarning| |
| 2181 |
% command produces a warning but does not present the interactive |
| 2182 |
% prompt. The |\fontinstwarningnoline| command does the same, but |
| 2183 |
% doesn't print the input line number. The |\fontinstinfo| command |
| 2184 |
% writes the message to the |log| file. Within the messages, the |
| 2185 |
% command |\messagebreak| can be used to break a line and |\space| is |
| 2186 |
% a space, for example: |
| 2187 |
% \begin{verbatim} |
| 2188 |
% \def\foo{FOO} |
| 2189 |
% \fontinstwarning{Hungarian}{ |
| 2190 |
% Your~hovercraft~is~full~of~eels,\messagebreak |
| 2191 |
% and~\string\foo\space is~\foo} |
| 2192 |
% \end{verbatim} |
| 2193 |
% produces: |
| 2194 |
% \begin{verbatim} |
| 2195 |
% Hungarian warning: |
| 2196 |
% Your hovercraft is full of eels, |
| 2197 |
% and \foo is FOO on input line 54. |
| 2198 |
% \end{verbatim} |
| 2199 |
% |
| 2200 |
% \begin{macrocode} |
| 2201 |
\def\fontinsterror#1#2#3{ |
| 2202 |
\generic_error{ |
| 2203 |
\four_spaces\four_spaces |
| 2204 |
}{ |
| 2205 |
#1~error:\messagebreak #2 |
| 2206 |
}{ |
| 2207 |
% See~the~#1~package~documentation~for~explanation.^^J |
| 2208 |
}{#3} |
| 2209 |
} |
| 2210 |
% \end{macrocode} |
| 2211 |
% \begin{macrocode} |
| 2212 |
\def\fontinstwarning#1#2{ |
| 2213 |
\generic_warning{ |
| 2214 |
\four_spaces\four_spaces |
| 2215 |
}{ |
| 2216 |
#1~warning:\messagebreak #2 |
| 2217 |
} |
| 2218 |
} |
| 2219 |
% \end{macrocode} |
| 2220 |
% \begin{macrocode} |
| 2221 |
\def\fontinstwarningnoline#1#2{ |
| 2222 |
\fontinstwarning{#1}{#2\gobble_one} |
| 2223 |
} |
| 2224 |
% \end{macrocode} |
| 2225 |
% \begin{macrocode} |
| 2226 |
\def\fontinstinfo#1#2{ |
| 2227 |
\generic_info{ |
| 2228 |
\four_spaces\four_spaces |
| 2229 |
}{ |
| 2230 |
#1~info:\messagebreak #2 |
| 2231 |
} |
| 2232 |
} |
| 2233 |
%</pkg> |
| 2234 |
% \end{macrocode} |
| 2235 |
% \begin{macrocode} |
| 2236 |
%<*doc> |
| 2237 |
\def\fontinsterror#1#2#3{% |
| 2238 |
\Bheading{Error} observed by #1:% |
| 2239 |
\begin{quote}#2.\end{quote}% |
| 2240 |
} |
| 2241 |
% \end{macrocode} |
| 2242 |
% \begin{macrocode} |
| 2243 |
\def\fontinstwarning#1#2{ |
| 2244 |
\Bheading{Warning} from #1:% |
| 2245 |
\begin{quote}#2.\end{quote}% |
| 2246 |
} |
| 2247 |
% \end{macrocode} |
| 2248 |
% \begin{macrocode} |
| 2249 |
\let\fontinstwarningnoline=\fontinstwarning |
| 2250 |
% \end{macrocode} |
| 2251 |
% \begin{macrocode} |
| 2252 |
\def\fontinstinfo#1#2{ |
| 2253 |
\Bheading{Info} from #1:% |
| 2254 |
\begin{quote}#2.\end{quote}% |
| 2255 |
} |
| 2256 |
%</doc> |
| 2257 |
% \end{macrocode} |
| 2258 |
% \end{macro} |
| 2259 |
% \end{macro} |
| 2260 |
% \end{macro} |
| 2261 |
% \end{macro} |
| 2262 |
% |
| 2263 |
% \begin{macro}{\on_line} |
| 2264 |
% The message ` on input line~$n$'. \LaTeX\ has special code for |
| 2265 |
% \TeX~2, but since \package{fontinst} has assumed the existence of |
| 2266 |
% the |\errorcontextlines| parameter since v\,1.500, the removal of |
| 2267 |
% that code shouldn't cause problems for anyone who wasn't already |
| 2268 |
% having related problems. |
| 2269 |
% |
| 2270 |
% \begin{macrocode} |
| 2271 |
%<*pkg> |
| 2272 |
\def\on_line{~on~input~line~\the\inputlineno} |
| 2273 |
% \end{macrocode} |
| 2274 |
% \end{macro} |
| 2275 |
% |
| 2276 |
% \begin{macro}{\four_spaces} |
| 2277 |
% Four spaces. Using |\edef| (rather than |\def| as in \LaTeX) to |
| 2278 |
% save some macro expansions. |
| 2279 |
% \begin{macrocode} |
| 2280 |
\edef\four_spaces{\space\space\space\space} |
| 2281 |
% \end{macrocode} |
| 2282 |
% \end{macro} |
| 2283 |
% |
| 2284 |
% |
| 2285 |
% \subsubsection{Specific errors} |
| 2286 |
% |
| 2287 |
% \begin{macro}{\error_help_a} |
| 2288 |
% \begin{macro}{\error_help_c} |
| 2289 |
% \begin{macro}{\error_help_d} |
| 2290 |
% \begin{macro}{\error_help_e} |
| 2291 |
% \changes{1.912}{2000/02/12}{Macro added. (LH)} |
| 2292 |
% The more common error help messages. The first three are called |
| 2293 |
% |\@eha|, |\@ehc|, and |\@ehd| in \LaTeX. |\@ehb| is of no use for |
| 2294 |
% \package{fontinst}, so it has been omitted. |\error_help_e| is a |
| 2295 |
% new one for \package{fontinst}. |
| 2296 |
% \begin{macrocode} |
| 2297 |
\gdef\error_help_a{ |
| 2298 |
Your~command~was~ignored.\messagebreak |
| 2299 |
Type~\space I~<command>~<return>~\space to~replace~it~ |
| 2300 |
with~another~command,\messagebreak |
| 2301 |
or~\space <return>~\space to~continue~without~it.} |
| 2302 |
\gdef\error_help_c{ |
| 2303 |
Try~typing~\space <return>~ |
| 2304 |
\space to~proceed.\messagebreak |
| 2305 |
If~that~doesn't~work,~type~\space X~<return>~\space to~quit.} |
| 2306 |
\gdef\error_help_d{ |
| 2307 |
You're~in~trouble~here.~\space\error_help_c} |
| 2308 |
\def\error_help_e#1{You~can~continue,~but~the~#1~wrong.} |
| 2309 |
% \end{macrocode} |
| 2310 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 2311 |
% |
| 2312 |
% |
| 2313 |
% \subsubsection{\TeX\ parameters} |
| 2314 |
% |
| 2315 |
% \multchanges{\cs{newlinechar}\cs{errorcontextlines}}{1.914} |
| 2316 |
% {2000/05/20}{Moved to error message subsection. (LH)} |
| 2317 |
% \begin{macro}{\newlinechar} |
| 2318 |
% Set |\newlinechar| for |\errhelp| messages. |
| 2319 |
% \begin{macrocode} |
| 2320 |
\newlinechar=`\^^J |
| 2321 |
% \end{macrocode} |
| 2322 |
% \end{macro} |
| 2323 |
% |
| 2324 |
% \begin{macro}{\errorcontextlines} |
| 2325 |
% By default, show as much error info as you can. |
| 2326 |
% (We assume \package{fontinst} users are \TeX{}perts.) |
| 2327 |
% \begin{macrocode} |
| 2328 |
\errorcontextlines=999 |
| 2329 |
% \end{macrocode} |
| 2330 |
% \end{macro} |
| 2331 |
% |
| 2332 |
% \begin{macro}{\tracinglostchars} |
| 2333 |
% \changes{1.915}{2000/07/31}{Added setting this parameter. (LH)} |
| 2334 |
% Make |\tracinglostchars| positive---this will simplify catching |
| 2335 |
% bugs, as many \package{fontinst} bugs show up in that output is |
| 2336 |
% being generated, but that used to disappear silently when |
| 2337 |
% \package{fontinst} was run under Ini\TeX. |
| 2338 |
% \begin{macrocode} |
| 2339 |
\tracinglostchars=1 |
| 2340 |
%</pkg> |
| 2341 |
% \end{macrocode} |
| 2342 |
% \end{macro} |
| 2343 |
% |
| 2344 |
% \Finale |
| 2345 |
\endinput |