Debian Codegraph @

texmf-dist/doc/generic/ofs/ofstest.tex

raw
1 %% This file does many tests with fonts installed in OFS
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % February 2004 Petr Olsak
4 % April 2004
5
6 % You can print probe-texts or tables of fonts of choosen families.
7 % The interactive mode is activated if you type on command prompt:
8
9 % Usage: tex ofstest [file1, file2, ...]
10 % or: csplain ofstest [file1, file2, ...]
11 % or: tex ofstest
12 % * <enter>
13 %
14 % and follow the notices on the screen.
15 %
16 % You can \input this macro in your document.
17 % The interactive mode is disabled automatically in this situation. Example:
18 %
19 % \input ofstest [a35]
20 % \cfam Times \tables \text \mixed
21 % \cfam Courier \tables \text \mixed
22 % \end
23
24 {\nopagenumbers} % usage: tex ofstest [a35] or csplain ofstest [a35]
25
26 \ifx\setfonts\undefined \input ofs \relax \fi
27
28 \ifx\protectreading\undefined
29 \errmessage{Sorry, I need the OFS version <May 2004> at least.}
30 \endinput \fi
31
32 \let\displaymessage=\wlog
33
34 \loadingenc=1
35
36 \let\stmath=\relax
37
38 \ifx\chyph\undefined
39 \def\textlang{en}
40 \def\fotenc{8t}
41 \else
42 \chyph
43 \def\textlang{cz}
44 \def\fotenc{8z}
45 \fi
46
47 \fontdef\rmfont [CMRoman-rm/10]
48 \fontdef\itfont [CMRoman-it/10]
49 \fontdef\boldfont [CMRoman-bf/10]
50 \fontdef\nttfont [CMTypewriter-rm/10]
51 \fontdef\lttfont [Courier-rm/7pt]
52
53 \parindent=10pt
54 \emergencystretch=3em
55 \advance\hoffset by22mm
56
57 \hsize=143mm
58
59 \lineskiplimit=-5pt
60
61 \headline={\lttfont \spaceskip=0pt
62 OFS test \csname datum:\textlang\endcsname \ \dotfill \ \the\pageno}
63 \footline={}
64
65 %%% Main loop of the program
66
67 \def\runtest {\versiontext \testinteractive \readfamily \onestep}
68
69 \def\testinteractive{\ifnum\inputlineno=0 \else \let\readfamily=\relax
70 \let\onestep=\relax \let\trydeclare=\relax \fi}
71
72 \def\onestep {
73 \message{^^J*** What to do with family \thisfamily\space?^^J
74 \space\space\space (type command or \string\help): }
75 \read-1 to \command
76 \if \relax \expandafter\expandafter\expandafter \noexpand
77 \expandafter \readfirsttoken \command:\end
78 \else \expandafter \def\expandafter \command
79 \expandafter {\expandafter \cfam \command}
80 \fi
81 \ifx \thisfamily\astik
82 \def\loopcommands{}
83 \expandafter \pickuploopcommands \command ^^X
84 \ifx \loopcommands\empty \else
85 \bgroup
86 \def\ofslistfamily ##1{%
87 \def\tmpa ####1!.####2/{\def\thisfamily{####2}}%
88 \expandafter\tmpa\string##1/%
89 \loopcommands\relax
90 }%
91 \def\ofslisttext ##1{\if^^J\readfirsttoken ##1:\end
92 \edef\fromfile{\readothertokens ##1:\end}%
93 \else \edef\fromfile{##1}\fi}
94 \ofslistfamilies
95 \egroup
96 \fi
97 \fi
98 \command \relax
99 \onestep
100 }
101 \long\def\pickuploopcommands #1#2^^X{%
102 \ifx \list #1 \addloopcommand #1 \fi
103 \ifx \table #1 \addloopcommand #1 \fi
104 \ifx \text #1 \addloopcommand #1 \fi
105 \ifx \mixed #1 \addloopcommand #1 \fi
106 \ifx \math #1 \addloopcommand #1 \fi
107 \ifx \abet #1 \addloopcommand #1 \fi
108 \ifx \chars #1 \addloopcommand #1 \fi
109 \ifx \all #1 \addloopcommand #1 \fi
110 \def\tmpa{#2}
111 \let\next=\pickuploopcommands
112 \ifx \tmpa\empty \def\next^^X{}\fi
113 \ifx \tmpa\space \def\next ##1^^X{}\fi
114 \next #2^^X
115 }
116 \def\addloopcommand #1{\expandafter\def
117 \expandafter\loopcommands \expandafter{\loopcommands#1}}
118
119 %%% \cfam
120
121 \def\thisfamily{*}
122
123 \def\readfamily {\message{^^J*** Type family name without brackets (or ? or *): }
124 \read-1 to \response
125 \expandafter \testfirsttoken \response ^^X
126 \if \noexpand\nextchar \relax \let\nextread=\readfamily
127 \ifx\nextchar\par \showfonts \hint \fi
128 \expandafter \response \expandafter \relax
129 \else \expandafter \reset \response \to\thisfamily
130 \expandafter \testfamily \fi
131 \nextread
132 }
133 \def\testfamily {
134 \knownfam \thisfamily? \iftrue \let\nextread=\relax
135 \else \ifx\thisfamily\onequestion \showfonts \hint
136 \let\nextread=\readfamily
137 \else \ifx\thisfamily\astik
138 \let\nextread=\relax
139 \else \message{ ... Sorry, unknown family.^^J
140 ... use exactly upper/lower letters^^J} \hint
141 \let\nextread=\readfamily
142 \fi \fi \fi
143 }
144 \def\nreadfamily #1 {\edef\tmpa{#1}%
145 \ifx\tmpa\onequestion \help
146 \else
147 \knownfam #1? \iftrue \edef\thisfamily{#1}
148 \else \ifx\tmpa\astik \edef\thisfamily{#1}\else
149 \message{ ... Sorry, unknown family "#1".^^J}\fi \fi \fi
150 }
151 \def\cfam{\let\interact=\readfamily \let\nointeract=\nreadfamily
152 \futurelet \nextchar \donextchar}
153
154 \def\donextchar {\if \noexpand\nextchar \relax
155 \expandafter \interact
156 \else \expandafter \nointeract \fi}
157
158 \def\reset #1 \to #2{\def#2{#1}}
159
160 \def\testfirsttoken{\futurelet \nextchar \ignorerest}
161 \long\def\ignorerest #1^^X{}
162
163 \let\famlist=\showfonts
164
165 \def\onequestion{?} \def\astik{*}
166 \def\hint{\immediate\write16
167 { ... you can read more declaration files by \string\decl}}
168
169 %%% Help texts
170
171 \def\help {\message{commands:^^J
172 \noexpand\list ..... List all variants of the family \thisfamily^^J
173 \string \table(s) . Tables of all variants of the family \thisfamily^^J
174 \noexpand\abet ..... One line alphabet/digits sample for each variant^^J
175 \noexpand\chars .... Print list of available characters including TeX sequences^^J
176 \noexpand\text ..... One paragraph in all variants of the family \thisfamily^^J
177 \noexpand\mixed .... Paragraph with fonts combined from
178 \string\rm, \string\bf, \string\it \space and \string\bi^^J
179 \noexpand\math ..... Mathematics text combined by fonts from \thisfamily^^J
180 \noexpand\all ...... The same as \noexpand\list \noexpand\table \noexpand\abet
181 \noexpand\chars \noexpand\text \noexpand\mixed \noexpand\math^^J
182 \noexpand\setsize .. Set size of fonts (current size is "\fosize")^^J
183 \noexpand\cfam ..... Change current family^^J
184 FamName ... The same as \noexpand\cfam FamName^^J
185 \noexpand\rem ...... Remove current family or family given in parameter from \string\famlist^^J
186 -----------------------------^^J
187 \noexpand\famlist .. Show list of all declared families (the same as \string\showfonts)^^J
188 \noexpand\decl ..... Input next declaration file^^J
189 \noexpand\remdecl .. Remove all families of given declaration file from famlist^^J
190 \noexpand\help ..... This text^^J
191 \noexpand\morehelp . Show more help information^^J
192 \noexpand\fontusage \space The help screen of the OFS^^J
193 \noexpand\end ...... End of this session
194 }}
195 \def\morehelp {\message{
196 You can type the group of commands on the one "command" prompt.^^J
197 For example: \noexpand\list\noexpand\tables\noexpand\text \end^^J
198 -- program lists all variants, prints tables and texts and exits.^^J
199 ---------------------------^^J
200 If the family is choosen as * then the commands^^J
201 \string\list, \string\table, \string\abet, \string\text,
202 \string\mixed, \string\math^^J
203 will be applied to all families actually declared. Others^^J
204 commands will be run only once after the loop over families is done.^^J
205 ---------------------------^^J
206 The commands
207 \string\cfam, \string\setsize, \string\decl, \string\rem, \string\remdecl^^J
208 can be typed alone (interactive dialog will be started)^^J
209 OR with one parameter separed by space or endline (no dialog is used)^^J
210 Example: \noexpand\cfam Times \noexpand\setsize 12pt \string\table^^J
211 ---------------------------^^J
212 You can type other TeX commands on the "command" prompt.^^J
213 Examples: \string\def\string\fotenc{8t} (another font encoding,
214 current: "\fotenc")^^J
215 \space\space \baselineskip 11pt (another baselineskip,
216 current: "\the\baselineskip")^^J
217 \space\space \string\def\string\fomenc{CM} (another math enconding,
218 current: "\fomenc")^^J
219 \space\space \string\def\string\textlang{en} (another language of samples,
220 current: "\textlang")^^J
221 \space\space \noexpand\notables (the \noexpand\all command will not
222 print tables)
223 }}
224 \def\versiontext {\message{This is ofstest macro, version <May. 2004>}}
225
226 \def\notables {\let\table=\relax}
227
228 %%% \list
229
230 \def\list {\ifx\thisfamily\astik \else
231 \registeredfam \thisfamily? \iftrue
232 \gdef\newmodifylist{}
233 \message{^^J [\thisfamily/\fosize], encoding: \fotenc, variants:}
234 {\let\modifyenc=\ofsaddenctolist \def\modifyread ##1;{}\scanvariants \listvariant }
235 \expandafter \ifx \csname ffe?\thisfamily:\endcsname \relax
236 \immediate\write16 { \space\space All font encodings are allowed.
237 \ifx\eenc\empty\else Extra: \eenc.\fi}
238 \else
239 \immediate\write16 { \space\space Registered font encodings:
240 \csname ffe?\thisfamily:\endcsname.
241 \ifx\eenc\empty\else Extra: \eenc.\fi}
242 \fi
243 \ifx\newmodifylist\empty \else
244 \immediate\write16 { \space\space Modifications: { \modlist}}
245 \fi
246 \else \warnaboutskip {list}
247 \fi \fi
248 }
249 \def\listvariant {%
250 \calculatemetricfile \fontfile\fosize
251 \if|\eenc|\else
252 {\edef\fotenc{\eenc}
253 \calculatemetricfile \fontfile \fosize
254 \xdef\efontfile{\metricfile}}
255 \fi
256 \immediate\write16{ \space\space
257 \texvariant\space (\fontvariant) \space\space\space\metricfile\fosize
258 \if|\eenc|\else \space + \efontfile\fosize\fi}
259 }
260
261 \def\scanvariants #1{%
262 {\let\loadtextfam=\testloadtextfam
263 \let\newvariant=\testnewvariant
264 \let\addtoenc=\ofsaddenctolist
265 \def\runvariant{%
266 \expandafter \ifx \csname reg!.\fontfile\endcsname \empty
267 \else #1\fi}
268 \csname fam!.\thisfamily\endcsname
269 \expandafter \gdef\expandafter \newmodifylist\expandafter {\newmodifylist}%
270 \escapechar=-1
271 \expandafter \savelist \meaning \newmodifylist^^X}
272 }
273 \def\testloadtextfam #1;#2;#3;#4;#5;{\tryloadenc{#5}%
274 \if|#1|\else \savevariant {}#1;\rm {#5} \runvariant \fi
275 \if|#2|\else \savevariant {Bold}#2;\bf {#5} \runvariant \fi
276 \if|#3|\else \savevariant {Italic}#3;\it {#5} \runvariant \fi
277 \if|#4|\else \savevariant {BoldItalic}#4;\bi {#5} \runvariant \fi
278 }
279 \def\testnewvariant #1#2#3(#4) #5;#6;{%
280 \def\texvariant{\string #2}\def\fontvariant{#4}%
281 \def\fontfile{#5}\edef\eenc{#6}%
282 \runvariant}
283
284 \let\oriloadtextfam=\loadtextfam
285 \let\orinewvariant=\newvariant
286
287 \def\savevariant #1#2#3;#4#5{\def\texvariant{\string #4}\xdef\eenc{#5}%
288 \if(#2 \savethisvariant #2#3;\else \savethisvariant (#1) #2#3;\fi}
289 \def\savethisvariant (#1) #2;{\def\fontvariant{#1}\def\fontfile{#2}}
290
291 \def\savelist #1->#2^^X{\gdef\modlist{#2}}
292
293 \def\warnaboutskip #1{\wlog {The \noexpand\fotenc "\fotenc"
294 is unregistered in \thisfamily.
295 \expandafter\noexpand\csname#1\endcsname skipped.}}
296
297 %%% \setsize
298
299 \def\isetsize {\message{%
300 *** Type the new font size (in OFS fortmat)^^J
301 \space\space\space (Examples: "12", "12pt", "4mm", "scaled1200", "mag1.2"): }
302 \read -1 to\response
303 \expandafter \ifx \response\par \else
304 \expandafter \reset \response \to\response
305 \expandafter \setfosize \expandafter \fosize \response:\fi}
306
307 \def\setsize {\let\interact=\isetsize
308 \def\nointeract ##1 {\setfosize\fosize ##1:}
309 \futurelet \nextchar \donextchar}
310
311 %%% \decl
312
313 \def\declare {\message{^^J*** Type declaration file name (allfonts for example): }
314 \read-1 to \infile
315 \input \infile
316 }
317 \def\ndeclare #1 {\input #1
318 \ifx \thisfamily\onequestion \expandafter \readfamily \fi
319 }
320 \def\decl {\let\interact=\declare \let\nointeract=\ndeclare
321 \futurelet \nextchar \donextchar}
322
323 \let\trydeclare=\declare
324
325 \def\rundeclare {\versiontext \testinteractive \trydeclare \readfamily \onestep}
326
327
328 %%% \rem
329
330 \def\removecode {\ifx\removefamily\astik
331 \message{ ... Sorry, you cannot remove * (all) families.^^J
332 ... use \noexpand\cfam to declare the family name^^J
333 ... use \noexpand\undecl to remove more families.^^J
334 ... use \noexpand\remove FamilyName to remove FamilyName}
335 \else \doremovefam \fi
336 }
337 \def\doremovefam {
338 \knownfam \removefamily? \iftrue
339 \edef\act{\def\noexpand\tmpa
340 ####1\noexpand\ofslistfamily
341 \expandafter\noexpand\csname fam!.\removefamily\endcsname
342 ####2^^X{\gdef\noexpand\ofslistfamilies{####1####2}}}\act
343 \expandafter \tmpa\ofslistfamilies^^X%
344 \global \expandafter \let \csname fam!.\removefamily\endcsname = \relax
345 \message{ ... \removefamily\space is removed from declaration famlist}
346 \ifx\removefamily\thisfamily \def\thisfamily{*} \fi
347 \ifx\removefamily\savefamily \def\savefamily{*} \fi
348 \else
349 \message{ ... Sorry, the family \removefamily\space is not declared^^J}
350 \fi
351 }
352 \def\rem {\def\interact{\edef\removefamily{\thisfamily}\removecode}
353 \def\nointeract ##1 {\def\removefamily{##1}\removecode}
354 \futurelet \nextchar \donextchar
355 }
356
357
358 %%% \remdecl
359
360 \def\remdeclcode {%
361 \ifx\response\defaultstext \def\thisdecl{defaults:}
362 \else \edef\thisdecl{\response.tex:}
363 \fi
364 \bgroup
365 \def\ofslisttext ##1##2\ofslisttext{\if^^J\readfirsttoken ##1:\end
366 \edef\tmpa{\readothertokens ##1:\end}%
367 \else \edef\tmpa{##1}\fi
368 \ifx\tmpa\thisdecl ##2\def\ofslisttext ####1####2^^X{}\fi
369 \ofslisttext}
370 \def\ofslistfamily ##1{\def\tmpa ####1!.####2/{####2}%
371 \edef\removefamily{\expandafter\tmpa\string ##1/}%
372 \doremovefam}
373 \expandafter \ofslistfamilies \expandafter \ofslisttext
374 \expandafter {\thisdecl}%
375 \message { ... Sorry, the \thisdecl\space is not present
376 in declaration list}\ofslisttext{}^^X%
377 \egroup
378 }
379 \def\defaultstext{defaults}
380
381 \def\iremdeclcode {\message{%
382 *** What part of famlist should be removed ?^^J
383 \space\space\space (type "defaults" or declaration file name without ".tex"): }
384 \read-1 to\response
385 \expandafter \ifx \response\par \else
386 \expandafter \reset \response \to\response
387 \remdeclcode
388 \fi
389 }
390 \def\remdecl {\let\interact=\iremdeclcode
391 \def\nointeract ##1 {\def\response{##1}\remdeclcode}
392 \futurelet \nextchar \donextchar
393 }
394
395 %%% \text
396
397 \def\text{\ifx\thisfamily\astik \else
398 \registeredfam \thisfamily? \iftrue
399 \expandafter \ifx \csname ffe?\thisfamily:\endcsname \relax
400 \warnaboutnontext \text
401 \else
402 \message{^^J} \message{ [\thisfamily/\fosize]:}
403 \scanvariants \runtext
404 \fi
405 \else \warnaboutskip {text}
406 \fi\fi
407 }
408 \def\runtext {%
409 \message{\texvariant\space text}
410 \calculatemetricfile \fontfile \fosize
411 {\let\loadtextfam=\oriloadtextfam
412 \let\newvariant=\orinewvariant
413 \setfonts [\thisfamily/]
414 \font\ttfont=cmtt10 \fosize\relax
415 \bgroup \let\string=\egroup \texvariant
416 {\escapechar=-1 \xdef\tmp{\texvariant}}
417 \fontdef\fn [\thisfamily-\tmp/!] \fn
418 \nofontmessages
419 \startparagraph 1 \indent \csname text:\textlang\endcsname
420 \medskip\penalty-200}}
421
422 \def\actualfont #1{{\def\texvariant{rm} \xdef\act{%
423 \noexpand\fontdef \noexpand #1[\thisfamily-\texvariant/!]}}
424 \act #1}
425
426 \def\startparagraph #1{\par
427 \ifdim\fontdimen3\the\font=0pt \raggedright \fi
428 \ifdim\fontdimen2\the\font=0pt \rightskip=0pt plus \hsize\fi
429 \noindent\llap {\lttfont \vtop{\hsize=5cm
430 \noindent\hfill\thisfamily
431 \if1#1\space\texvariant\fi
432 \if2#1\space(\fomenc)\break \null\hfill
433 \mathsizes \vskip-\baselineskip \else
434 \if3#1\else \break \null\hfill \thesize/\theskip
435 \vskip-\baselineskip\fi\fi
436 }\kern12pt}\ignorespaces
437 }
438 \def\theskip{\the\baselineskip}
439 \def\thesize{\expandafter\ignoreat\fosize:}
440 \def\ignoreat at#1:{#1}
441 \def\mathsizes{[%
442 \expandafter\ignoreat\textfosize:/%
443 \expandafter\ignoreat\scriptfosize:/%
444 \expandafter\ignoreat\scriptscriptfosize:]}
445
446 \def\famplusvariant{\thisfamily\if|\fontvariant|\else-\fontvariant\fi}
447
448 %%% \abet
449
450 \def\abet {\ifx\thisfamily\astik \else
451 \registeredfam \thisfamily? \iftrue
452 \removelastskip
453 \message{^^J} \message{ [\thisfamily/\fosize]:}
454 \noindent{\lttfont [\thisfamily/\thesize] (enc: \fotenc),
455 declared in
456 \ifx\fromfile\undefined \findfromfile \else \fromfile\fi}\par
457 \scanvariants \runabet
458 \medskip \penalty-200
459 \else \warnaboutskip {abet}
460 \fi\fi
461 }
462 \def\runabet {%
463 \message{\texvariant\space abet}
464 \calculatemetricfile \fontfile \fosize
465 {{\escapechar=-1 \xdef\tmp{\texvariant}}
466 \fontdef\fn [\thisfamily-\tmp/!] \fn
467 \hbox{\llap{\lttfont (\fontvariant) \texvariant\kern12pt}%
468 \csname abet:\textlang\endcsname}
469 }}
470 \def\findfromfile {\bgroup
471 \def\fromfile{??}%
472 \def\ofslisttext ##1{\if^^J\readfirsttoken ##1:\end
473 \edef\fromfile{\readothertokens ##1:\end}%
474 \else \edef\fromfile{##1}\fi}%
475 \def\ofslistfamily ##1{\expandafter
476 \ifx \csname fam!.\thisfamily\endcsname ##1%
477 \def\tmpa####1^^X{}%
478 \expandafter \tmpa
479 \fi}%
480 \ofslistfamilies^^X\fromfile
481 \egroup
482 }
483 \def\all {\list \abet \chars \table \text \mixed \math \vfil\break}
484
485 \def\chars {\ifx\thisfamily\astik \else
486 \registeredfam \thisfamily? \iftrue
487 \expandafter \ifx \csname ffe?\thisfamily:\endcsname \relax
488 \warnaboutnontext \chars
489 \else
490 \message{^^J} \message{ [\thisfamily/]: \string\chars}
491 \bgroup
492 \setfonts[\thisfamily-rm/]
493 \let\characterdef=\listcharacter
494 \let\characterdel=\characternodef
495 \let\accentdef=\listaccent
496 \let\accentdel=\accentnodef
497 \def\modifydef##1;##2{}
498 \def\protectreading##1 {}
499 \let\printcharacterwarn=\boxik
500 \let\printaccentwarn=\boxikdbl
501 \raggedright \rightskip=0pt plus 10em
502 \noindent \llap{\lttfont \thisfamily~(\fotenc)\kern12pt}%
503 \expandafter \let\csname enc:ofs-\fotenc\endcsname =\relax
504 {\def\par{}\endlinechar=-1 \input ofs-\fotenc.tex }
505 \if |\extraenc|\else \par
506 \noindent \llap{\lttfont Extra metric~(\extraenc)\kern12pt}%
507 \expandafter \let\csname enc:ofs-\extraenc\endcsname =\relax
508 {\def\par{}\endlinechar=-1 \input ofs-\extraenc.tex }
509 \fi
510 \ifx\newmodifylist\empty \else \par
511 {\escapechar=-1 \expandafter \savelist \meaning \newmodifylist^^X}
512 \noindent \llap{\lttfont Modifications\kern12pt}%
513 {\lttfont\char`\{\ \modlist\char`\}} \newmodifylist
514 \fi
515 \medskip \penalty-200
516 \egroup \fi
517 \else \warnaboutskip {chars}
518 \fi \fi
519 }
520 \def\listcharacter #1#2#3 {\def\tmpa{#2#3}%
521 % \message{\string#1}%
522 \ifx\tmpa\astik \hbox{\lttfont \string#1:}~{\print#1{}{}}\spc \fi
523 \ifx\tmpa\fotenc \hbox{\lttfont \string#1:}~{\print#1{}{}}\spc \fi
524 \ifx\tmpa\extraenc \hbox{\lttfont \string#1:}~{\print#1{}{}}\spc \fi
525 \def\tmpa{tmpa}\futurelet \tmpb \docharacterdef}
526 \def\print #1{{\savetokenname#1\tmpb\global\let\tmpb=\tmpb}\printcharacter{\tmpb}}
527 \def\listaccent #1#2#3#4 {\def\tmpa{#3#4}%
528 % \message{\string#1 \string#2}%
529 \ifx\tmpa\astik \hbox{\lttfont \string#1~\string#2:}~{#1 #2{}{}}\spc \fi
530 \ifx\tmpa\fotenc \hbox{\lttfont \string#1~\string#2:}~{#1 #2{}{}}\spc \fi
531 \ifx\tmpa\extraenc \hbox{\lttfont \string#1~\string#2:}~{#1 #2{}{}}\spc \fi
532 \def\tmpa{tmpa}\futurelet \tmpb \docharacterdef}
533 \def\boxik#1{\lower1.7pt\vbox{\hrule\hbox{\vrule height6pt depth2pt
534 \kern.2em\lttfont?\kern.2em\vrule}\hrule}}
535 \def\boxikdbl#1#2{\boxik.}
536 \def\spc{\hskip.8em\relax}
537
538 %%% \mixed \math
539
540 \def\mixed{\ifx\thisfamily\astik \else
541 \registeredfam \thisfamily? \iftrue
542 \expandafter \ifx \csname ffe?\thisfamily:\endcsname \relax
543 \warnaboutnontext \mixed
544 \else
545 \message{^^J} \message{ [\thisfamily/\fosize]: mixed text}
546 {\setfonts [\thisfamily/]
547 \nofontmessages
548 \startparagraph 0 \noindent
549 \csname mix:\textlang\endcsname
550 \medskip\penalty-200}
551 \fi
552 \else \warnaboutskip {mixed}
553 \fi \fi
554 }
555 \def\math{\ifx\thisfamily\astik \else
556 \registeredfam \thisfamily? \iftrue
557 \expandafter \ifx \csname ffe?\thisfamily:\endcsname \relax
558 \warnaboutnontext \math
559 \else
560 {\setfonts [\thisfamily/]
561 \def\mathfonts{\defaultmathfonts}
562 \def\mathchars{\defaultmathchars \let\mathchars=\relax}
563 \stmath \setmath[//] \lineskiplimit=-.5pt
564 \message{^^J} \message{ [\thisfamily/\fosize]
565 (\string\fomenc: \fomenc) \mathsizes: math text}
566 \nofontmessages
567 \startparagraph 2 \noindent
568 \ifx\vecfam\undefined \else \def\bi{\fam\vecfam}\fi
569 \ifx\msbmfam\undefined \def\N{{\bf N}}\else \def\N{{\fam\msbmfam N}}\fi
570 \ifx\varmathbb\undefined \else \def\N{\varmathbb{N}}\fi
571 \delimiterfactor=950
572 \csname math:\textlang\endcsname
573 \medskip\penalty-200}
574 \fi
575 \else \warnaboutskip {math}
576 \fi \fi
577 }
578 \def\psenc{PS}
579
580 \def\warnaboutnontext #1{%
581 \message{ [\thisfamily/] is probably non text font, \string#1 skipped.^^J
582 \space\space (The family has no registered text encodings.)}%
583 }
584
585
586 %%% \table
587
588 \def\table{\ifx\thisfamily\astik \else
589 \registeredfam \thisfamily? \iftrue
590 \message{^^J} \message{ [\thisfamily/\fosize]:}
591 \scanvariants \runtable
592 \else \warnaboutskip {table}
593 \fi \fi
594 }
595 \let\tables=\table
596
597 \def\runtable {\onetable
598 \if |\eenc|\else {\edef\fotenc{\eenc}\onetable} \fi}
599
600 \def\onetable{
601 \calculatemetricfile \fontfile \fosize
602 \vfil\break
603 \noindent
604 {\rmfont Table of {\boldfont \famplusvariant},
605 \hfil\break E\ifx\fotenc\eenc xtra e\fi ncoding: \fotenc,
606 fontfile: {\nttfont\metricfile\fosize},\hfil\break
607 command: {\nttfont \string\selectfont [\thisfamily/\fosize]\texvariant
608 \ifx\fotenc\eenc \string\setextrafont\fi}}\par
609 \message{\texvariant\space \ifx\fotenc\eenc ex-\fi table}
610 {\font \fn=\metricfile\fosize\relax \fn \knuthstable}
611 \vfil\break
612 }
613
614 %% Z Knuthova testfont:
615
616 \newcount\mm \newcount\n \newcount\p \newdimen\dim
617 \chardef\other=12
618 \def\oct#1{\hbox{\rmfont'{}\kern-.2em\itfont#1\/\kern.05em}} % octal constant
619 \def\hexx#1{\hbox{\nttfont"#1}} % hexadecimal constant
620 \def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal
621 \mm=\n \divide\mm by 64 \xdef\0{\the\mm}%
622 \multiply\mm by-64 \advance\mm by\n \divide\mm by 8 \xdef\1{\the\mm}}
623 \def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}%
624 \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F%
625 \global\p=\lastpenalty}} % \p=1 if none of the characters exist
626 \def\oddline{\cr
627 \noalign{\nointerlineskip}
628 \multispan{19}\hrulefill&
629 \setbox0=\hbox{\lower 2.3pt\hbox{\hexx{\h x}}}\smash{\box0}\cr
630 \noalign{\nointerlineskip}}
631 \newif\ifskipping
632 \def\evenline{\loop\skippingfalse
633 \ifnum\n<256 \mm=\n \divide\mm 16 \chardef\next=\mm
634 \expandafter\setdigs\meaning\next \testrow
635 \ifnum\p=1 \skippingtrue \fi\fi
636 \ifskipping \global\advance\n 16 \repeat
637 \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi
638 \next}
639 \def\morechart{\cr\noalign{\hrule\penalty5000}
640 \chartline \oddline \mm=\1 \advance\mm 1 \xdef\1{\the\mm}
641 \chartline \evenline}
642 \def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}
643 \def\chartstrut{\lower4.5pt\vbox to14pt{}}
644 \def\knuthstable{$$\global\n=0
645 \halign to\hsize\bgroup
646 \chartstrut##\tabskip0pt plus10pt&
647 &\hfil##\hfil&\vrule##\cr
648 \lower6.5pt\null
649 &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
650 \def\endchart{\cr\noalign{\hrule}
651 \raise11.5pt\null&&&\hexx 8&&\hexx 9&&\hexx A&&\hexx B&
652 &\hexx C&&\hexx D&&\hexx E&&\hexx F&\cr\egroup$$\par}
653 \def\:{\setbox0=\hbox{\char\n}%
654 \ifdim\ht0>7.5pt\reposition
655 \else\ifdim\dp0>2.5pt\reposition\fi\fi
656 \box0\global\advance\n 1 }
657 \def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0
658 \advance\dim 2pt \dp0=\dim}
659 \def\centerlargechars{
660 \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}
661
662 %%% texts in various languages
663
664 \def\langdef #1 {\expandafter\def \csname#1\endcsname}
665
666 \characternodef \textbullet * 0
667 \characternodef \ellipsis * 0
668 \characternodef \fullbar * 0
669 \characternodef \brokenbar * 0
670 \characternodef \onequarter * 0
671 \characternodef \onehalf * 0
672 \characternodef \threequarters * 0
673 \characternodef \trademark * 0
674 \characternodef \registered * 0
675 \characternodef \ligct * 0
676 \characternodef \ligst * 0
677 \characternodef \ligft * 0
678 \characternodef \longs * 0
679 \characternodef \longst * 0
680 \characternodef \sterling * 0
681 \characternodef \euro * 0
682 \characternodef \franc * 0
683 \characternodef \cent * 0
684 \characternodef \yen * 0
685 \characternodef \degree * 0
686 \characternodef \vardigits * 0
687 \characternodef \textbraceleft * 0
688 \characternodef \textbraceright * 0
689
690
691 \langdef datum:cz {\the\day.~\the\month. \the\year}
692
693 \langdef datum:en {\the\year/\the\month/\the\day}
694
695 \langdef text:cz {%
696 Tento text je naps\'an p\'ismem \famplusvariant \space
697 za pou\v zit\'i \TeX{}ov\-sk\'e metriky
698 {\ttfont \fontname\fn}. V\v s\'imejme si m\'en\v e
699 obvykl\'ych slov, jako je slovo \v s\v tast\-n\'y (p\'ismeno \v t uprost\v red slova),
700 nebo t\v reba slovensk\'e ko\v lko. V\v e\v rme, \v ze v\'ysledn\'y text p\r ujde nejen
701 p\v re\v c\'ist, ale bude i typograficky pokud mo\v zno v~po\v r\'adku. Tak\'e je t\v reba
702 \clqq sledovat chov\'an\'i\crqq{} na\v sich \clqq{}uvozovek\crqq. A~co takhle \frqq
703 francouzsk\'e uvozovky po \v cesk\'em zp\r usobu\flqq?
704 \par
705 0123456789,
706 \knownchar\vardigits? \iftrue{\vardigits 0123456789}, \fi
707 ligatury: fi, fl, ffi, ffl, --, ---,
708 kerny: Tel, T\v el, T\'el, VLTAVA.
709
710 Znaky: \dag, \ddag, \textbullet,
711 \P, \ellipsis,
712 \textbraceleft, \fullbar, \brokenbar, \textbraceright,
713 \onequarter, \onehalf, \threequarters,
714 \trademark, \copyright, \registered,
715 \ligct, \ligst, \ligft, \longs, \longst,
716 \S, \sterling, \euro, \franc, \cent,
717 \yen, \degree C.
718 \par\nobreak\medskip
719 {\spaceskip=.3em minus .2em \relax
720 \'A \'a \"A \"a \v C \v c \v D \v d \'E \'e \v E \v e \'I \'i \'L \'l \v L \v l \v N \v n \'O \'o \^O \^o \"O \"o \v R \v r \'R \'r
721 \v S \v s \v T \v t \'U \'u \r U \r u \"U~\"u~\'Y~\'y~\v Z~\v z.}
722 }
723 \langdef text:en {%
724 This text is written by the font \famplusvariant.
725 The \TeX{} font metric {\ttfont \fontname\fn} is used here.
726 Notice how this font looks in the current paragraph.
727 We try to write somethink in ``english quotes''.
728 Digits: 0123456789, {\vardigits 0123456789}
729 ligatures: fi, fl, ffi, ffl, --, ---,
730 kerning: Te, Ti, AVA.
731
732 Characters: \dag, \ddag, \textbullet,
733 \P, \ellipsis,
734 \textbraceleft, \fullbar, \brokenbar, \textbraceright,
735 \onequarter, \onehalf, \threequarters,
736 \trademark, \copyright, \registered,
737 \ligct, \ligst, \ligft, \longs, \longst,
738 \S, \pound, \euro, \franc, \cent,
739 \yen, \degree C.
740 }
741 \langdef abet:cz {%
742 ABCDEOPQRSVWXYZ 0123456789 \&\%?!-\v Z\v z\v s\v c\v e\'a\'e\v t\r u,
743 acbdefghijklmnopqrstuvwxyz%
744 }
745 \langdef abet:en {%
746 ABCDEOPQRSVWXYZ 0123456789 \&\%?!- ``--'' ---:
747 acbdefghijklmnopqrstuvwxyz%
748 }
749 \langdef mix:cz {%
750 {\bf P\v r\'iklad.} Nyn\'i zjist\'ime, zda je mo\v zn\'e kombinovat z\'akladn\'i \v rez s~tu\v cn\'ym
751 (resp. polotu\v cn\'ym) \v rezem a s~kurz\'ivou
752 v~rodin\v e p\'isma {\it\thisfamily}. Pro vyzna\v cov\'an\'i je vhodn\'e pou\v z\'it {\it kurz\'ivu\/} a
753 u\v z m\'en\v e {\bf tu\v cnou variantu} a prakticky v\r ubec se nehod\'i pou\v z\'it
754 {\bi tu\v cnou a sklon\v enou variantu}.
755 Zcela nevhodn\'e je vyzna\v covat podtr\v zen\'im nebo prostrk\'an\'im.
756 To lid\'e s~dobr\'ym vychov\'an\'im ned\v elaj\'i.
757 {\it Vyzna\v cen\'i m\'a b\'yt takov\'e, aby p\v ri \v cten\'i bylo vyzna\v cen\'e m\'isto z\v reteln\v e
758 odli\v sn\'e, ale p\v ri pohledu z~d\'alky z\r ustal text odstavce stejnom\v ern\v e \v sed\'y.}
759 Tomu nejl\'epe vyhovuje kurz\'iva, ale ne ve v\v sech rodin\'ach p\'isma je zda\v ril\'a
760 kuz\'iva k~dispozici.
761 }
762 \langdef mix:en {%
763 {\bf Example.} We try to combine the normal variant with the bold
764 (semibold) and italic variants in the font family {\it\thisfamily}.
765 The best selection to mark the text is the {\it italic}, not so good
766 one is the {\bf bold variant} and somewhat unsuitable
767 one is the {\bi bold italic variant}. The marking of the text by
768 underline or by letter spacing is totally unsiutable.
769 {\it The marked text have to be good distinguised while reading
770 but if you look at the paragraph from more distance the best is to
771 view the uniform-gray area.} The best solution of this task is to
772 use the italic, if this variant is ready in used font family.
773 }
774 \langdef math:cz {%
775 {\bf Pozn\'amka.} Funkci Gamma v bod\v e $x$ zna\v c\'ime $\Gamma(x)$ a
776 po\v c\'it\'ame ji podle vzorce:
777 $$ \Gamma(x) = \int_0^\infty e^{-t} t^{x-1} {\rm d}t \quad (x>0).$$
778 Speci\'aln\v e pro $x=n\in\N$ je $\Gamma(n) = (n-1)\,!$ a pro
779 $\alpha\in(0,1)$ je
780 $$ \Gamma(\alpha)\,\Gamma(1-\alpha) = {\pi \over \sin \pi \alpha}.$$
781 {\bf Definice.} Nech\v t $\bi A$ je \v ctvercov\'a matice s~$n$ sloupci a
782 \v r\'adky a s~prvky $a_{i,j}$. Pak \v c\'islo
783 $$ \mathop{\rm det}{\bi A} = \left|{\bi A}\right| =
784 \sum_{\Pi=(j_1,j_2,\ldots,j_n)} \mathop{\rm sgn}\Pi\cdot
785 a_{1,j_1}\,a_{2,j_2}\cdots a_{n,j_n} $$
786 naz\'yv\'ame {\it determinantem\/} matice $\bi A$.
787 }
788 \langdef math:en {%
789 {\bf Notice.} The value of the function Gamma in the real
790 number~$x$ can be calculaded by:
791 $$ \Gamma(x) = \int_0^\infty e^{-t} t^{x-1} {\rm d}t \quad (x>0).$$
792 Especially, for $n\in\N$ is $\Gamma(n) = (n-1)\,!$ and for
793 $\alpha\in(0,1)$ is
794 $$ \Gamma(\alpha)\,\Gamma(1-\alpha) = {\pi \over \sin \pi \alpha}.$$
795 {\bf Definition.} Let $\bi A$ is a square matrix with $n$ columns
796 and rows and with elements $a_{i,j}$. The number
797 $$ \mathop{\rm det}{\bi A} = \left|{\bi A}\right| =
798 \sum_{\Pi=(j_1,j_2,\ldots,j_n)} \mathop{\rm sgn}\Pi\cdot
799 a_{1,j_1}\,a_{2,j_2}\cdots a_{n,j_n} $$
800 is called {\it determinant\/} of the matrix $\bi A$.
801 }
802
803 %%% Brackets after \input ofstest
804
805 \def\processOFSoption #1,{\if ^^X#1\let\next=\runtest
806 \else \input #1 \fi \next}
807 \def\testOFSoptions {\ifx [\tmpa \expandafter \readOFSoptions
808 \else \expandafter \rundeclare \fi}
809
810 \endOFSmacro
811