1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
29 \def\nfssfontfileversion{v2.2d}
30 \def\nfssfontfiledate{2015/02/01}
34 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
35 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
36 %% Digits \0\1\2\3\4\5\6\7\8\9
37 %% Exclamation \! Double quote \" Hash (number) \#
38 %% Dollar \$ Percent \% Ampersand \&
39 %% Acute accent \' Left paren \( Right paren \)
40 %% Asterisk \* Plus \+ Comma \,
41 %% Minus \- Point \. Solidus \/
42 %% Colon \: Semicolon \; Less than \<
43 %% Equals \= Greater than \> Question mark \?
44 %% Commercial at \@ Left bracket \[ Backslash \\
45 %% Right bracket \] Circumflex \^ Underscore \_
46 %% Grave accent \` Left brace \{ Vertical bar \|
47 %% Right brace \} Tilde \~}
50 % Copyright (C) 1994 Donald E. Knuth
51 % Copyright (C) 1994-94, 2003, 2006 Frank Mittelbach,
52 % all rights reserved.
56 % \title{The program \texttt{nfssfont}}
57 % \author{Frank Mittelbach\thanks{Adapted from code written
58 % by Donald E.~Knuth}}
59 % \date{\nfssfontfiledate}
62 % \def\dst{{\normalfont\scshape docstrip}}
63 % \def\NFSS{\textsf{NFSS}}
64 % \setcounter{StandardModuleDepth}{1}
67 % \MaintainedByLaTeXTeam{latex}
70 % \section{Introduction}
72 % Within the \NFSS{} distribution there is a \LaTeX{} file
73 % \texttt{nfssfont.tex} which can be used to test new fonts, produce
74 % font tables showing all characters, etc. This is an addaption of a
75 % program originally written by Don Knuth.
77 % When you run this file through \LaTeX{} you will be asked to enter
78 % the name of the font to test. Your answer should be the external
79 % font name without any extension, e.g.\ \texttt{cmr10} (Computer
80 % Modern Roman 10pt) or \texttt{yinit} (Yannis Haralambous' Initial
83 % Alternatively (since version 2.1), you can press \meta{return} at
84 % this point. In that case a dialog is started that asks you for the
85 % font characteristics in \NFSS{} notation, i.e., first for the
86 % encoding scheme (default \texttt{T1}), then for the family name
87 % (default \texttt{cmr}), then for the series (default \texttt{m}),
88 % then for the shape (default \texttt{n}), and finally for the size
89 % (default \texttt{10pt}).
91 % You are then requested to enter a command. Probably the most
92 % important one is |\table|, which will produce a font chart. To
93 % switch to a new test font, type |\init|; to finish the test, type
94 % |\bye|; and to learn about all the other possible tests type
98 % the moment only a crude addaption of the test program for the
99 % Computer Modern fonts by Donald Knuth.
103 % \section{A driver for this document}
105 % The next bit of code contains the documentation driver file for
106 % \TeX{}, i.e., the file that will produce the documentation you are
107 % currently reading. It will be extracted from this file by the
111 \documentclass{ltxdoc}
112 % \OnlyDescription % comment out for implementation details
114 \DocInput{nfssfont.dtx}
121 % A testbed for font evaluation (see The METAFONTbook, Appendix H)
122 % changed for \LaTeX{} with \NFSS.
124 % This program should get a complete rewrite some day or at least some
125 % code documentation. Any volunteers?
128 \documentclass{article}
130 \setlength\textwidth{470pt}
131 \setlength\oddsidemargin{0pt}
132 \addtolength\textheight{7\baselineskip}
133 \addtolength\topmargin{-3\baselineskip}
135 \def\sevenrm{\fontencoding{OT1}\fontsize{7}{9pt}\rmfamily}
137 \typeout{**********************************************}
138 \typeout{* NFSS font test program version <\nfssfontfileversion>}
140 \typeout{* Follow the instructions}
141 \typeout{**********************************************}
148 %\newlinechar=`@ %FMi
150 \doublehyphendemerits=30000
154 \newcount\m \newcount\n \newcount\p \newdimen\dim
157 \def\today{\ifcase\month\or
158 January\or February\or March\or April\or May\or June\or
159 July\or August\or September\or October\or November\or December\fi
160 \space\number\day, \number\year}
161 \def\hours{\n=\time \divide\n 60
162 \m=-\n \multiply\m 60 \advance\m \time
163 \twodigits\n\twodigits\m}
164 \def\twodigits#1{\ifnum #1<10 0\fi \number#1}
167 % We first ask for a real external font name\ldots
170 \typein[\currfontname]%
171 {Input external font name, e.g., cmr10^^J%
172 (or <enter> for NFSS classification of font):}%
174 % If the answer is a real font name (like ``cmr10'') then we have no idea
175 % what the encoding of this font is, so in this case we record the word
176 % ``unknown'' and internally assume |T1| encoding. Commands other than
177 % |\table| are then most likely going to fail, unless that assumption was
180 \def\encoding{unknown}%
181 \fontencoding{T1}\selectfont
183 % If the user answers with ``return'' we ask for the \NFSS{}
184 % classification of the font in form of encoding, family, series,
185 % shape, and size offering a default each time.
187 \ifx\currfontname\empty
188 \typein[\encoding]{^^J^^J*** NFSS classification
189 ***^^J^^JFont encoding [T1]:}%
195 % Depending on the chosen encoding we have the problem, that the encoding
196 % support information may not be available (only for |T1| and |OT1| this is
197 % preloaded in the kernel, all other encodings normally need a declaration in
198 % the preamble). So here we attempt to load this support file even though
199 % it is actually already too late for this.
202 \lowercase{\def\noexpand\next{\encoding enc.def}}}%
205 \InputIfFileExists\next
208 % If the encoding support file is not found this may indicate an error, eg
209 % something misspelled. However, it may equally mean that we dealing
210 % with a math font encoding for which no encoding support is
213 {\PackageWarningNoLine{nfssfont}%
214 {Encoding file `\next' not found.%
216 You might have misspelt the name of the encoding
218 or perhaps this encoding is not a text encoding,
220 in which case you will probably only be able to
222 run the \noexpand\table command successfully}%
224 % But actually the situation is even worse, as some math
225 % encodings do have such support files. So for them we need to make the encoding
226 % known to NFSS in some other way, otherwise we could not even find the
227 % external font name, let alone typesetting a |\table|.
229 \expandafter\let\csname T@\encoding\endcsname\empty
233 \fontencoding\encoding
235 \typein[\family]{Font family [cmr]:}%
242 \typein[\series]{Font series [m]:}%
248 \typein[\shape]{Font shape [n]:}%
254 \typein[\size]{Font size [10pt]:}%
261 % Finally select the font and assign it to |\currfontname|.
263 \selectfont\edef\currfontname{\fontname\font}%
266 \message{Now type a test command (\string\help\space for help):}}
270 \def\startfont{\font\testfont=\currfontname
271 \leftline{\sevenrm Test of font \currfontname\unskip\ (encoding
272 \encoding\unskip) on \today\ at \hours}
274 \testfont \setbaselineskip
275 \ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt
276 \else\rightskip=0pt plus 2em \fi
277 \spaceskip=\fontdimen2\testfont % space between words (\raggedright)
278 \xspaceskip=\fontdimen2\testfont \advance\xspaceskip
279 by\fontdimen7\testfont}
283 {\catcode`\|=0 \catcode`\\=\other
284 |gdef|help{|message{%
285 \init switches to another font;^^J%
286 \stop or \bye finishes the run;^^J%
287 \table prints the font layout in tabular format;^^J%
288 \text prints a sample text, assuming TeX text font conventions;^^J%
289 \sample combines \table and \text;^^J%
290 \mixture mixes a background character with a series of others;^^J%
291 \alternation interleaves a background character with a series;^^J%
292 \alphabet prints all lowercase letters within a given background;^^J%
293 \ALPHABET prints all uppercase letters within a given background;^^J%
294 \series prints a series of letters within a given background;^^J%
295 \lowers prints a comprehensive test of lowercase;^^J%
296 \uppers prints a comprehensive test of uppercase;^^J%
297 \digits prints a comprehensive test of numerals;^^J%
298 \math prints a comprehensive test of TeX math italic;^^J%
299 \names prints a text that mixes upper and lower case;^^J%
300 \punct prints a punctuation test;^^J%
301 \bigtest combines many of the above routines;^^J%
302 \help repeats this message;^^J%
303 and you can use ordinary TeX commands (e.g., to \input a file).}}}
305 \def\setbaselineskip{\setbox0=\hbox{\n=0
306 \loop\char\n \ifnum \n<255 \advance\n 1 \repeat}
307 \baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }
311 \def\setchar#1{{\escapechar-1\message{\string#1 character = }%
312 \def\do##1{\catcode`##1=\other}\dospecials
314 \expandafter\finsetchar\next\next#1}}
315 \def\finsetchar#1#2\next#3{\global\chardef#3=`#1
316 \ifnum #3=`\# \global\chardef#3=#2 \fi}
317 \def\promptthree{\setchar\background
318 \setchar\starting \setchar\ending}
320 \def\mixture{\promptthree \domix\mixpattern}
321 \def\alternation{\promptthree \domix\altpattern}
322 \def\mixpattern{\0\1\0\0\1\1\0\0\0\1\1\1\0\1}
323 \def\altpattern{\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0}
324 \def\domix#1{\par\chardef\0=\background \n=\starting
325 \loop \chardef\1=\n #1\endgraf
326 \ifnum \n<\ending \advance\n 1 \repeat}
328 \def\!{\discretionary{\background}{\background}{\background}}
329 \def\series{\promptthree \!\doseries\starting\ending\par}
330 \def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}
331 \def\complower{\!\doseries{`a}{`z}\doseries{'31}{'34}\par}
332 \def\compupper{\!\doseries{`A}{`Z}\doseries{'35}{'37}\par}
333 \def\compdigs{\!\doseries{`0}{`9}\par}
334 \def\alphabet{\setchar\background\complower}
335 \def\ALPHABET{\setchar\background\compupper}
337 \def\lowers{\docomprehensive\complower{`a}{`z}{'31}{'34}}
338 \def\uppers{\docomprehensive\compupper{`A}{`Z}{'35}{'37}}
339 \def\digits{\docomprehensive\compdigs{`0}{`4}{`5}{`9}}
340 \def\docomprehensive#1#2#3#4#5{\par\chardef\background=#2
341 \loop{#1} \ifnum\background<#3\m=\background\advance\m 1
342 \chardef\background=\m \repeat \chardef\background=#4
343 \loop{#1} \ifnum\background<#5\m=\background\advance\m 1
344 \chardef\background=\m \repeat}
348 \def\names{ {\AA}ngel\aa\ Beatrice Claire
349 Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris
350 Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave
351 Pauline Qu\^eneau Roxanne Sabine T\~a{\'\j}a Ur\v{s}ula
352 Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie\par}
353 \def\punct{\par\dopunct{min}\dopunct{pig}\dopunct{hid}
354 \dopunct{HIE}\dopunct{TIP}\dopunct{fluff}
355 \$1,234.56 + 7/8 = 9\% @ \#0\par}
356 \def\dopunct#1{#1,\ #1:\ #1;\ `#1'\ ?`#1?\ !`#1!\ (#1)\ [#1]\
360 hamburgefonstiv HAMBURGEFONSTIV\par
361 \names \punct \lowers \uppers \digits}
363 \def\math{\textfont1=\testfont \skewchar\testfont=\skewtrial
364 \mathchardef\Gamma="100 \mathchardef\Delta="101
365 \mathchardef\Theta="102 \mathchardef\Lambda="103 \mathchardef\Xi="104
366 \mathchardef\Pi="105 \mathchardef\Sigma="106 \mathchardef\Upsilon="107
367 \mathchardef\Phi="108 \mathchardef\Psi="109 \mathchardef\Omega="10A
368 \def\ii{i} \def\jj{j}
369 \def\\##1{|##1|+}\mathtrial
370 \def\\##1{##1_2+}\mathtrial
371 \def\\##1{##1^2+}\mathtrial
372 \def\\##1{##1/2+}\mathtrial
373 \def\\##1{2/##1+}\mathtrial
374 \def\\##1{##1,{}+}\mathtrial
375 \def\\##1{d##1+}\mathtrial
376 \let\ii=\imath \let\jj=\jmath \def\\##1{\hat##1+}\mathtrial}
377 \newcount\skewtrial \skewtrial='177
378 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L \\M \\N
379 \\O \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z \\a \\b \\c \\d \\e \\f
380 \\g \\h \\\ii \\\jj \\k \\l \\m \\n \\o \\p \\q \\r \\s \\t \\u \\v \\w
381 \\x \\y \\z \\\alpha \\\beta \\\gamma \\\delta \\\epsilon \\\zeta
382 \\\eta \\\theta \\\iota \\\kappa \\\lambda \\\mu \\\nu \\\xi \\\pi
383 \\\rho \\\sigma \\\tau \\\upsilon \\\phi \\\chi \\\psi \\\omega
384 \\\vartheta \\\varpi \\\varphi \\\Gamma \\\Delta \\\Theta \\\Lambda
385 \\\Xi \\\Pi \\\Sigma \\\Upsilon \\\Phi \\\Psi \\\Omega \\\partial
387 \def\mathsy{\begingroup\skewtrial='060 % for math symbol font tests
388 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L
389 \\M \\N \\O \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z$\par}
392 % Here we have to ensure that we use a suitable encoding otherwise our
393 % octal and hexadecimal constants will appear in whatever encoding the
396 \def\oct#1{\hbox{\fontencoding{OT1}\rmfamily\'{}\kern-.2em\itshape
397 #1\/\kern.05em}}% octal constant
398 \def\hex#1{\hbox{\fontencoding{OT1}\rmfamily
399 \H{}\ttfamily#1}}% hexadecimal constant
400 \def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal
401 \m=\n \divide\m by 64 \xdef\0{\the\m}%
402 \multiply\m by-64 \advance\m by\n \divide\m by 8 \xdef\1{\the\m}}
403 \def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}%
404 \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F%
405 \global\p=\lastpenalty}} % \p=1 if none of the characters exist
407 \noalign{\nointerlineskip}
408 \multispan{19}\hrulefill&
409 \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr
410 \noalign{\nointerlineskip}}
412 \def\evenline{\loop\skippingfalse
413 \ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m
414 \expandafter\setdigs\meaning\next \testrow
415 \ifnum\p=1 \skippingtrue \fi\fi
416 \ifskipping \global\advance\n 16 \repeat
417 \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi
419 \def\morechart{\cr\noalign{\hrule\penalty5000}
420 \chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m}
421 \chartline \evenline}
422 \def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}
423 \def\chartstrut{\lower4.5pt\vbox to14pt{}}
424 \def\table{$$\global\n=0
425 \halign to\hsize\bgroup
426 \chartstrut##\tabskip0pt plus10pt&
427 &\hfil##\hfil&\vrule##\cr
429 &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
430 \def\endchart{\cr\noalign{\hrule}
431 \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
432 &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}
433 \def\:{\setbox0=\hbox{\noboundary\char\n\noboundary}%
434 \ifdim\ht0>7.5pt\reposition
435 \else\ifdim\dp0>2.5pt\reposition\fi\fi
436 \box0\global\advance\n 1 }
437 \def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0
438 \advance\dim 2pt \dp0=\dim}
439 \def\centerlargechars{
440 \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}
444 \def\text{{\advance\baselineskip-4pt
445 \setbox0=\hbox{abcdefghijklmnopqrstuvwxyz}
447 \ifdim 15pc>2\wd0 \hsize=15pc \else \hsize=2\wd0 \fi
449 On November 14, 1885, Senator \& Mrs.~Leland Stanford called together
450 at their San Francisco mansion the 24~prominent men who had been
451 chosen as the first trustees of The Leland Stanford Junior University.
452 They handed to the board the Founding Grant of the University, which
453 they had executed three days before. This document---with various
454 amendments, legislative acts, and court decrees---remains as the
455 University's charter. In bold, sweeping language it stipulates that
456 the objectives of the University are ``to qualify students for
457 personal success and direct usefulness in life; and to promote the
458 publick welfare by exercising an influence in behalf of humanity and
459 civilization, teaching the blessings of liberty regulated by law, and
460 inculcating love and reverence for the great principles of government
461 as derived from the inalienable rights of man to life, liberty, and
462 the pursuit of happiness.'' \moretext
463 (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)\par}}
464 \def\moretext{?`But aren't Kafka's Schlo\ss{} and \AE sop's
465 \OE uvres often na\"\i ve vis-\`a-vis the d\ae monic ph\oe nix's
466 official r\^ole in fluffy souffl\'es? }
467 \def\omitaccents{\let\moretext=\relax}
469 \def\sample{\table\text}
473 \def\bye{\end{document}}
476 % The redefinition of |\typeout| around the |\begin{document}|
477 % prevents \LaTeX{} from reporting that there is no |.aux| file.
478 % This is a bad hack, I agree :-)
480 \let\oldtypeout\typeout
483 % And another bad hack: to be able to load an encoding definition file
484 % after |\begin{document}| I disable the preamble only setting.
487 \let\@preamblecmds\@empty
491 \let\typeout\oldtypeout
493 \ifx\noinit!\else\init\fi
498 % \DeleteShortVerb{\|}