Debian Codegraph @

texmf-dist/tex/generic/fntproof/fntproof.tex

raw
1 % fntproof.tex
2 %
3 % Copyright 2010 by Daniel H. Luecking. Placed in the public domain.
4 % If you make any changes, please remove or modify this copyright notice
5 % before distributing your version, preferably with a different name.
6 %
7 % This is a noninteractive version of testfont.tex. Instead of prompting
8 % for font names and commands, the user supplies them on the command
9 % line, or in a file.
10 %
11 %
12 % Original testfont.tex comment:
13 % A testbed for font evaluation (see The METAFONTbook, Appendix H)
14 %
15 % (Most code changes from testfont.tex are explained in comments preceded
16 % by "%DHL:")
17 %
18 \def\fntproofversion{1.0}
19 \immediate\write16{This is fntproof.tex, version \fntproofversion.}
20 \tracinglostchars=0
21 \tolerance=1000
22 \raggedbottom
23 \parindent=0pt
24 \hyphenpenalty=200
25 \doublehyphendemerits=30000
26 \hyphenation{prom-i-nent}%
27 %
28 \newcount\m \newcount\n \newcount\p \newdimen\dim
29 \chardef\other=12
30 %
31 \def\today{\ifcase\month\or
32 January\or February\or March\or April\or May\or June\or
33 July\or August\or September\or October\or November\or December\fi
34 \space\number\day, \number\year}%
35 \def\hours{\n=\time \divide\n 60
36 \m=-\n \multiply\m 60 \advance\m \time
37 \twodigits\n\twodigits\m}%
38 \def\twodigits#1{\ifnum #1<10 0\fi \number#1}%
39 %
40 %DHL: These are used to sanitize the fontname.
41 % Odd capitals to avoid overwriting other's macros (Knuth's own
42 % overwriting notwithstanding :)
43 \def\sTripprefix#1>{}%
44 \def\sAnitize#1{\edef#1{\expandafter\sTripprefix\meaning#1}}
45 \def\gobble#1{}%
46 \def\firstofone#1{#1}%
47 %
48 % Modified from ifmtarg.sty, works around certain errors.
49 \begingroup
50 \catcode`\Q=3
51 \long\gdef\xifmtarg#1#2Q#3#4#5\relax{#4}%
52 \long\gdef\ifnotempty#1{\xifmtarg#1QQ\firstofone\gobble\relax}%
53 \endgroup
54 %
55 %DHL: For debug purposes: a command to read and show the file name.
56 % This to test whether TeX special characters in the font name are
57 % properly handled.
58 %\def\showfont{%
59 % \begingroup
60 % \def\do##1{\catcode`##1=\other}\dospecials
61 % \catcode`\ =10\relax\xshowfont
62 %}%
63 %\def\xshowfont#1 {%
64 % \newlinechar`\^^J%
65 % \message{^^J --> Font name #1 read from command line. <--^^J}%
66 % \endgroup
67 %}%
68 %
69 %DHL: \init will not prompt, but just read up to the next space.
70 % We allow anything but whitespace in a filename. The filename argument
71 % (of \xinit) is delimited by the next space. Alternatively, an
72 % initial left brace is assumed to be grouping around the full font
73 % name. In that case, \yinit reads the whole group
74 \def\init{\futurelet\next\doinit}% to see if a brace follows
75 \def\doinit{%
76 \begingroup
77 \def\do##1{\catcode`##1=\other}\dospecials\catcode`\ =10\relax
78 \ifx\next\bgroup
79 \catcode`\{=1 \catcode`\}=2
80 \expandafter\yinit
81 \else
82 \expandafter\xinit
83 \fi}
84 \def\yinit #1{\fininit{#1}}%
85 \def\xinit#1 {\fininit{#1}}%
86 \def\fininit#1{%
87 \def\thisfont{#1}\sAnitize\thisfont\global\let\thisfont\thisfont
88 \endgroup
89 \par\everypar{}%
90 \startfont
91 }%
92 %
93 %DHL:
94 % This defines \everypar so that the first fontname triggers \init,
95 % a lot like mproof.tex.
96 \def\Init{\par\everypar{{\setbox0\lastbox}\everypar{}\init}}%
97 %
98 %DHL: \startfont is identical to the one in testfont.tex, except I've
99 % added a \filbreak between fonts and a conditional to turn off the
100 % header.
101 \def\startfont{\font\testfont=\thisfont \spaceskip=0pt
102 \filbreak
103 \ifheaders \par
104 \leftline{\sevenrm Test of \thisfont\unskip\ on \today\ at \hours}%
105 \fi
106 \medskip
107 \testfont \setbaselineskip
108 \ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt
109 \else\rightskip=0pt plus 2em \fi
110 \spaceskip=\fontdimen2\testfont % space between words (\raggedright)
111 \xspaceskip=\fontdimen2\testfont \advance\xspaceskip by\fontdimen7\testfont}%
112 %
113 \newif\ifheaders \headerstrue
114 %DHL:
115 % \getthisfont defines \thisfont to be the \fontname of the current
116 % font. Unlike \init it does not sanitize \thisfont as \fontname returns
117 % category 12 characters.
118 %
119 % \initcurrentfont performs the functions of \init on the current font,
120 % including defining \thisfont.
121 %
122 % \theheader prints the header even when \headersfalse was issued. It
123 % requires a definition for \thisfont.
124 \def\getthisfont{\edef\thisfont{\fontname\font}}%
125 \def\initcurrentfont{\noinit\getthisfont\startfont}%
126 \def\theheader{%
127 \leftline{\sevenrm Test of \thisfont\ on \today\ at \hours}}%
128 %
129 %DHL:
130 % One change to \help is use of "^^J" instead of "@" as \newlinechar.
131 % Since no other command needs this, I have made it a local assignment.
132 % I've added some delimiting lines as well.
133 \begingroup
134 \catcode`\|=0 \catcode`\\=\other
135 |gdef|help{{|newlinechar`^^J|message{^^J%
136 === Main commands ==============^^J%
137 \init switches to another font;^^J%
138 \end or \bye finishes the run;^^J%
139 \table prints the font layout in tabular format;^^J%
140 \fonttable must be used instead of \table in LaTeX;^^J
141 \text prints a sample text, assuming TeX text font conventions;^^J%
142 \sample combines \table and \text;^^J%
143 \mixture mixes a background character with a series of others;^^J%
144 \alternation interleaves a background character with a series;^^J%
145 \alphabet prints all lowercase letters within a given background;^^J%
146 \ALPHABET prints all uppercase letters within a given background;^^J%
147 \series prints a series of letters within a given background;^^J%
148 \lowers prints a comprehensive test of lowercase;^^J%
149 \uppers prints a comprehensive test of uppercase;^^J%
150 \digits prints a comprehensive test of numerals;^^J%
151 \math prints a comprehensive test of TeX math italic;^^J%
152 \names prints a text that mixes upper and lower case;^^J%
153 \punct prints a punctuation test;^^J%
154 \bigtest combines many of the above routines;^^J%
155 \help repeats this message;^^J%
156 and you can use ordinary TeX commands (e.g., to \input a file).^^J%
157 === More commands ==============^^J%
158 \noinit turns off automatic initialization of the first word as a font;^^J%
159 \headersfalse \headerstrue turn off/resume printing of header text;^^J%
160 \theheader print the header text;^^J%
161 \thisfont print the name of font specified by \init;^^J%
162 \getthisfont define \thisfont to be the current font;^^J%
163 ==================================^^J^^J}}}%
164 |endgroup
165 %
166 \def\setbaselineskip{\setbox0=\hbox{\n=0
167 \loop\char\n \ifnum \n<255 \advance\n 1 \repeat}
168 \baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }%
169 %
170 %DHL: This is used just before reading character arguments.
171 \def\beginspecial{%
172 \begingroup
173 \def\do##1{\catcode`##1=\other}\dospecials
174 \catcode`\{=1\catcode`\}=2\catcode`\\=0\catcode`\ =10
175 }%
176 \let\endspecial\endgroup
177 %
178 %DHL:
179 % We delay reading anything until the \catcode changes in \beginspecial.
180 \long\def\setchar{\beginspecial\Xsetchar}%
181 %
182 %DHL:
183 % #1 is the character name (\background, \starting or \ending)
184 % #2 is the command to be run after the characters are "set".
185 % #3 is the actual character.
186 % Calls \dosetchar, then ends group and issues saved command
187 \long\def\Xsetchar#1#2#3{\dosetchar#1{#3}\endspecial#2}%
188 %
189 %DHL:
190 % #1 as in \Xsetchar
191 % #2 actual character
192 % Inserts character as a delimited parameter for \finsetchar
193 % We could do all this in \Xsetchar, but I needed to isolate
194 % this part for use in \getthree.
195 \def\dosetchar#1#2{%
196 \def\next{#2}\expandafter\finsetchar\next\next#1}%
197 %
198 %DHL:
199 % #1 is first token of character, #2 is the rest, possibly empty
200 % #3 is the character command (same as #1 in \setchar).
201 % If the first part is #, and the rest is not empty, assume the rest is
202 % a number.
203 \def\finsetchar#1#2\next#3{\global\chardef#3=`#1
204 \ifnum #3=`\#\relax \ifnotempty{#2}{\global\chardef#3=#2\relax}\fi}%
205 %
206 %DHL:
207 % As \setchar no longer prompts for input, \promptthree is
208 % changed to \getthree.
209 \def\getthree{%
210 \beginspecial
211 \dogetthree
212 }%
213 \long\def\dogetthree#1#2#3#4{%
214 \dosetchar\background{#2}%
215 \dosetchar\starting{#3}%
216 \dosetchar\ending{#4}%
217 \endspecial#1%
218 }%
219 %DHL: The commands themselves. Very few changes at from here
220 % to the end.
221 %
222 %DHL:
223 % Extra braces in \mixture and \alternation because \getthree takes
224 % the code to run as an argument. This is so it can get at the character
225 % arguments that follow.
226 \def\mixture{\getthree{\domix\mixpattern}}%
227 \def\alternation{\getthree{\domix\altpattern}}%
228 \def\mixpattern{\0\1\0\0\1\1\0\0\0\1\1\1\0\1}%
229 \def\altpattern{\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0}%
230 \def\domix#1{\par\chardef\0=\background \n=\starting
231 \loop \chardef\1=\n #1\endgraf
232 \ifnum \n<\ending \advance\n 1 \repeat}%
233 %
234 \def\!{\discretionary{\background}{\background}{\background}}%
235 %DHL: Extra braces in \series also. Same reason as above.
236 \def\series{\getthree{\!\doseries\starting\ending\par}}%
237 \def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}%
238 \def\complower{\!\doseries{`a}{`z}\doseries{'31}{'34}\par}%
239 \def\compupper{\!\doseries{`A}{`Z}\doseries{'35}{'37}\par}%
240 \def\compdigs{\!\doseries{`0}{`9}\par}%
241 \def\alphabet{\setchar\background\complower}%
242 \def\ALPHABET{\setchar\background\compupper}%
243 %
244 \def\lowers{\docomprehensive\complower{`a}{`z}{'31}{'34}}%
245 \def\uppers{\docomprehensive\compupper{`A}{`Z}{'35}{'37}}%
246 \def\digits{\docomprehensive\compdigs{`0}{`4}{`5}{`9}}%
247 \def\docomprehensive#1#2#3#4#5{\par\chardef\background=#2
248 \loop{#1} \ifnum\background<#3\m=\background\advance\m 1
249 \chardef\background=\m \repeat \chardef\background=#4
250 \loop{#1} \ifnum\background<#5\m=\background\advance\m 1
251 \chardef\background=\m \repeat}%
252 %
253 \def\names{ {\AA}ngel\aa\ Beatrice Claire
254 Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris
255 Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave
256 Pauline Qu\^eneau Roxanne Sabine T\~a{\'\j}a Ur\v{s}ula
257 Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie\par}%
258 \def\punct{\par\dopunct{min}\dopunct{pig}\dopunct{hid}%
259 \dopunct{HIE}\dopunct{TIP}\dopunct{fluff}%
260 \$1,234.56 + 7/8 = 9\% @ \#0\par}%
261 \def\dopunct#1{#1,\ #1:\ #1;\ `#1'\ ?`#1?\ !`#1!\ (#1)\ [#1]\ #1*\ #1.\par}%
262 %
263 \def\bigtest{\sample
264 hamburgefonstiv HAMBURGEFONSTIV\par
265 \names \punct \lowers \uppers \digits}%
266 %
267 \def\math{\textfont1=\testfont \skewchar\testfont=\skewtrial
268 \mathchardef\Gamma="100 \mathchardef\Delta="101
269 \mathchardef\Theta="102 \mathchardef\Lambda="103 \mathchardef\Xi="104
270 \mathchardef\Pi="105 \mathchardef\Sigma="106 \mathchardef\Upsilon="107
271 \mathchardef\Phi="108 \mathchardef\Psi="109 \mathchardef\Omega="10A
272 \def\ii{i} \def\jj{j}
273 \def\\##1{|##1|+}\mathtrial
274 \def\\##1{##1_2+}\mathtrial
275 \def\\##1{##1^2+}\mathtrial
276 \def\\##1{##1/2+}\mathtrial
277 \def\\##1{2/##1+}\mathtrial
278 \def\\##1{##1,{}+}\mathtrial
279 \def\\##1{d##1+}\mathtrial
280 \let\ii=\imath \let\jj=\jmath \def\\##1{\hat##1+}\mathtrial}%
281 \newcount\skewtrial \skewtrial='177
282 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L \\M \\N \\O
283 \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z \\a \\b \\c \\d \\e \\f \\g
284 \\h \\\ii \\\jj \\k \\l \\m \\n \\o \\p \\q \\r \\s \\t \\u \\v \\w \\x \\y
285 \\z \\\alpha \\\beta \\\gamma \\\delta \\\epsilon \\\zeta \\\eta \\\theta
286 \\\iota \\\kappa \\\lambda \\\mu \\\nu \\\xi \\\pi \\\rho \\\sigma \\\tau
287 \\\upsilon \\\phi \\\chi \\\psi \\\omega \\\vartheta \\\varpi \\\varphi
288 \\\Gamma \\\Delta \\\Theta \\\Lambda \\\Xi \\\Pi \\\Sigma \\\Upsilon
289 \\\Phi \\\Psi \\\Omega \\\partial \\\ell \\\wp$\par}%
290 \def\mathsy{\begingroup\skewtrial='060 % for math symbol font tests
291 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L
292 \\M \\N \\O \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z$\par}
293 \math\endgroup}%
294 %
295 \def\oct#1{\hbox{\rm\'{}\kern-.2em\it#1\/\kern.05em}}% octal constant
296 \def\hex#1{\hbox{\rm\H{}\tt#1}}% hexadecimal constant
297 \def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal
298 \m=\n \divide\m by 64 \xdef\0{\the\m}%
299 \multiply\m by-64 \advance\m by\n \divide\m by 8 \xdef\1{\the\m}}%
300 \def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}%
301 \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F%
302 \global\p=\lastpenalty}}% \p=1 if none of the characters exist
303 \def\oddline{\cr
304 \noalign{\nointerlineskip}
305 \multispan{19}\hrulefill&
306 \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr
307 \noalign{\nointerlineskip}}%
308 \newif\ifskipping
309 \def\evenline{\loop\skippingfalse
310 \ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m
311 \expandafter\setdigs\meaning\next \testrow
312 \ifnum\p=1 \skippingtrue \fi\fi
313 \ifskipping \global\advance\n 16 \repeat
314 \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi
315 \next}%
316 \def\morechart{\cr\noalign{\hrule\penalty5000}
317 \chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m}
318 \chartline \evenline}%
319 \def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}%
320 \def\chartstrut{\lower4.5pt\vbox to14pt{}}%
321 \def\fonttable{$$\global\n=0
322 \halign to\hsize\bgroup
323 \chartstrut##\tabskip0pt plus10pt&
324 &\hfil##\hfil&\vrule##\cr
325 \lower6.5pt\null
326 &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}%
327 \def\endchart{\cr\noalign{\hrule}
328 \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
329 &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}%
330 \def\:{\setbox0=\hbox{\noboundary\char\n\noboundary}%
331 \ifdim\ht0>7.5pt\reposition
332 \else\ifdim\dp0>2.5pt\reposition\fi\fi
333 \box0\global\advance\n 1 }%
334 \def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0
335 \advance\dim 2pt \dp0=\dim}%
336 \def\centerlargechars{
337 \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}%
338 %
339 \def\text{{\advance\baselineskip-4pt
340 \setbox0=\hbox{abcdefghijklmnopqrstuvwxyz}
341 \ifdim\hsize>2\wd0 \ifdim 15pc>2\wd0 \hsize=15pc \else \hsize=2\wd0 \fi\fi
342 On November 14, 1885, Senator \& Mrs.~Leland Stanford called
343 together at their San Francisco mansion the 24~prominent men who had
344 been chosen as the first trustees of The Leland Stanford Junior University.
345 They handed to the board the Founding Grant of the University, which they
346 had executed three days before. This document---with various amendments,
347 legislative acts, and court decrees---remains as the University's charter.
348 In bold, sweeping language it stipulates that the objectives of the University
349 are ``to qualify students for personal success and direct usefulness in life;
350 and to promote the publick welfare by exercising an influence in behalf of
351 humanity and civilization, teaching the blessings of liberty regulated by
352 law, and inculcating love and reverence for the great principles of
353 government as derived from the inalienable rights of man to life, liberty,
354 and the pursuit of happiness.'' \moretext
355 (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)\par}}%
356 \def\moretext{?`But aren't Kafka's Schlo{\ss} and {\AE}sop's {\OE}uvres
357 often na{\"\i}ve vis-\`a-vis the d{\ae}monic ph{\oe}nix's official r\^ole
358 in fluffy souffl\'es? }%
359 \def\omitaccents{\let\moretext=\relax}%
360 %
361 \def\sample{\fonttable\text}%
362 %DHL: Adjustments for LaTeX:
363 \ifx\AtBeginDocument\UndEfInEd
364 \let\table\fonttable
365 \else
366 \ifx\sevenrm\UndEfInEd
367 \def\sevenrm{\normalfont\fontfamily{cmr}\fontsize{7}{9}\selectfont}%
368 \fi
369 \fi
370 %
371 %DHL:
372 % \Init causes first fontname to auto-\init itself. For this purpose, the
373 % fontname must begin with a character with category 11 or 12. As in
374 % testfont.tex, this can be turned off by \let\noinit! before this file is
375 % input. With fntproof, we have the alternative of using the command
376 % \noinit *after* it is input.
377 \ifx\noinit!\else\Init\fi \def\noinit{\everypar{}}%