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 % Copyright (C) 1994 Donald E. Knuth
35 % Copyright (C) 1994-94, 2003, 2006 Frank Mittelbach,
36 % all rights reserved.
40 % \title{The program \texttt{nfssfont}}
41 % \author{Frank Mittelbach\thanks{Adapted from code written
42 % by Donald E.~Knuth}}
43 % \date{\nfssfontfiledate}
46 % \def\dst{{\normalfont\scshape docstrip}}
47 % \def\NFSS{\textsf{NFSS}}
48 % \setcounter{StandardModuleDepth}{1}
51 % \MaintainedByLaTeXTeam{latex}
54 % \section{Introduction}
56 % Within the \NFSS{} distribution there is a \LaTeX{} file
57 % \texttt{nfssfont.tex} which can be used to test new fonts, produce
58 % font tables showing all characters, etc. This is an addaption of a
59 % program originally written by Don Knuth.
61 % When you run this file through \LaTeX{} you will be asked to enter
62 % the name of the font to test. Your answer should be the external
63 % font name without any extension, e.g.\ \texttt{cmr10} (Computer
64 % Modern Roman 10pt) or \texttt{yinit} (Yannis Haralambous' Initial
67 % Alternatively (since version 2.1), you can press \meta{return} at
68 % this point. In that case a dialog is started that asks you for the
69 % font characteristics in \NFSS{} notation, i.e., first for the
70 % encoding scheme (default \texttt{T1}), then for the family name
71 % (default \texttt{cmr}), then for the series (default \texttt{m}),
72 % then for the shape (default \texttt{n}), and finally for the size
73 % (default \texttt{10pt}).
75 % You are then requested to enter a command. Probably the most
76 % important one is |\table|, which will produce a font chart. To
77 % switch to a new test font, type |\init|; to finish the test, type
78 % |\bye|; and to learn about all the other possible tests type
82 % the moment only a crude addaption of the test program for the
83 % Computer Modern fonts by Donald Knuth.
87 % \section{A driver for this document}
89 % The next bit of code contains the documentation driver file for
90 % \TeX{}, i.e., the file that will produce the documentation you are
91 % currently reading. It will be extracted from this file by the
95 \documentclass{ltxdoc}
96 % \OnlyDescription % comment out for implementation details
98 \DocInput{nfssfont.dtx}
105 % A testbed for font evaluation (see The METAFONTbook, Appendix H)
106 % changed for \LaTeX{} with \NFSS.
108 % This program should get a complete rewrite some day or at least some
109 % code documentation. Any volunteers?
112 \documentclass{article}
114 \setlength\textwidth{470pt}
115 \setlength\oddsidemargin{0pt}
116 \addtolength\textheight{7\baselineskip}
117 \addtolength\topmargin{-3\baselineskip}
119 \def\sevenrm{\fontencoding{OT1}\fontsize{7}{9pt}\rmfamily}
121 \typeout{**********************************************}
122 \typeout{* NFSS font test program version <\nfssfontfileversion>}
124 \typeout{* Follow the instructions}
125 \typeout{**********************************************}
132 %\newlinechar=`@ %FMi
134 \doublehyphendemerits=30000
138 \newcount\m \newcount\n \newcount\p \newdimen\dim
141 \def\today{\ifcase\month\or
142 January\or February\or March\or April\or May\or June\or
143 July\or August\or September\or October\or November\or December\fi
144 \space\number\day, \number\year}
145 \def\hours{\n=\time \divide\n 60
146 \m=-\n \multiply\m 60 \advance\m \time
147 \twodigits\n\twodigits\m}
148 \def\twodigits#1{\ifnum #1<10 0\fi \number#1}
151 % We first ask for a real external font name\ldots
154 \typein[\currfontname]%
155 {Input external font name, e.g., cmr10^^J%
156 (or <enter> for NFSS classification of font):}%
158 % If the answer is a real font name (like ``cmr10'') then we have no idea
159 % what the encoding of this font is, so in this case we record the word
160 % ``unknown'' and internally assume |T1| encoding. Commands other than
161 % |\table| are then most likely going to fail, unless that assumption was
164 \def\encoding{unknown}%
165 \fontencoding{T1}\selectfont
167 % If the user answers with ``return'' we ask for the \NFSS{}
168 % classification of the font in form of encoding, family, series,
169 % shape, and size offering a default each time.
171 \ifx\currfontname\empty
172 \typein[\encoding]{^^J^^J*** NFSS classification
173 ***^^J^^JFont encoding [T1]:}%
179 % Depending on the chosen encoding we have the problem, that the encoding
180 % support information may not be available (only for |T1| and |OT1| this is
181 % preloaded in the kernel, all other encodings normally need a declaration in
182 % the preamble). So here we attempt to load this support file even though
183 % it is actually already too late for this.
186 \lowercase{\def\noexpand\next{\encoding enc.def}}}%
189 \InputIfFileExists\next
192 % If the encoding support file is not found this may indicate an error, eg
193 % something misspelled. However, it may equally mean that we dealing
194 % with a math font encoding for which no encoding support is
197 {\PackageWarningNoLine{nfssfont}%
198 {Encoding file `\next' not found.%
200 You might have misspelt the name of the encoding
202 or perhaps this encoding is not a text encoding,
204 in which case you will probably only be able to
206 run the \noexpand\table command successfully}%
208 % But actually the situation is even worse, as some math
209 % encodings do have such support files. So for them we need to make the encoding
210 % known to NFSS in some other way, otherwise we could not even find the
211 % external font name, let alone typesetting a |\table|.
213 \expandafter\let\csname T@\encoding\endcsname\empty
217 \fontencoding\encoding
219 \typein[\family]{Font family [cmr]:}%
226 \typein[\series]{Font series [m]:}%
232 \typein[\shape]{Font shape [n]:}%
238 \typein[\size]{Font size [10pt]:}%
245 % Finally select the font and assign it to |\currfontname|.
247 \selectfont\edef\currfontname{\fontname\font}%
250 \message{Now type a test command (\string\help\space for help):}}
254 \def\startfont{\font\testfont=\currfontname
255 \leftline{\sevenrm Test of font \currfontname\unskip\ (encoding
256 \encoding\unskip) on \today\ at \hours}
258 \testfont \setbaselineskip
259 \ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt
260 \else\rightskip=0pt plus 2em \fi
261 \spaceskip=\fontdimen2\testfont % space between words (\raggedright)
262 \xspaceskip=\fontdimen2\testfont \advance\xspaceskip
263 by\fontdimen7\testfont}
267 {\catcode`\|=0 \catcode`\\=\other
268 |gdef|help{|message{%
269 \init switches to another font;^^J%
270 \stop or \bye finishes the run;^^J%
271 \table prints the font layout in tabular format;^^J%
272 \text prints a sample text, assuming TeX text font conventions;^^J%
273 \sample combines \table and \text;^^J%
274 \mixture mixes a background character with a series of others;^^J%
275 \alternation interleaves a background character with a series;^^J%
276 \alphabet prints all lowercase letters within a given background;^^J%
277 \ALPHABET prints all uppercase letters within a given background;^^J%
278 \series prints a series of letters within a given background;^^J%
279 \lowers prints a comprehensive test of lowercase;^^J%
280 \uppers prints a comprehensive test of uppercase;^^J%
281 \digits prints a comprehensive test of numerals;^^J%
282 \math prints a comprehensive test of TeX math italic;^^J%
283 \names prints a text that mixes upper and lower case;^^J%
284 \punct prints a punctuation test;^^J%
285 \bigtest combines many of the above routines;^^J%
286 \help repeats this message;^^J%
287 and you can use ordinary TeX commands (e.g., to \input a file).}}}
289 \def\setbaselineskip{\setbox0=\hbox{\n=0
290 \loop\char\n \ifnum \n<255 \advance\n 1 \repeat}
291 \baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }
295 \def\setchar#1{{\escapechar-1\message{\string#1 character = }%
296 \def\do##1{\catcode`##1=\other}\dospecials
298 \expandafter\finsetchar\next\next#1}}
299 \def\finsetchar#1#2\next#3{\global\chardef#3=`#1
300 \ifnum #3=`\# \global\chardef#3=#2 \fi}
301 \def\promptthree{\setchar\background
302 \setchar\starting \setchar\ending}
304 \def\mixture{\promptthree \domix\mixpattern}
305 \def\alternation{\promptthree \domix\altpattern}
306 \def\mixpattern{\0\1\0\0\1\1\0\0\0\1\1\1\0\1}
307 \def\altpattern{\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0}
308 \def\domix#1{\par\chardef\0=\background \n=\starting
309 \loop \chardef\1=\n #1\endgraf
310 \ifnum \n<\ending \advance\n 1 \repeat}
312 \def\!{\discretionary{\background}{\background}{\background}}
313 \def\series{\promptthree \!\doseries\starting\ending\par}
314 \def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}
315 \def\complower{\!\doseries{`a}{`z}\doseries{'31}{'34}\par}
316 \def\compupper{\!\doseries{`A}{`Z}\doseries{'35}{'37}\par}
317 \def\compdigs{\!\doseries{`0}{`9}\par}
318 \def\alphabet{\setchar\background\complower}
319 \def\ALPHABET{\setchar\background\compupper}
321 \def\lowers{\docomprehensive\complower{`a}{`z}{'31}{'34}}
322 \def\uppers{\docomprehensive\compupper{`A}{`Z}{'35}{'37}}
323 \def\digits{\docomprehensive\compdigs{`0}{`4}{`5}{`9}}
324 \def\docomprehensive#1#2#3#4#5{\par\chardef\background=#2
325 \loop{#1} \ifnum\background<#3\m=\background\advance\m 1
326 \chardef\background=\m \repeat \chardef\background=#4
327 \loop{#1} \ifnum\background<#5\m=\background\advance\m 1
328 \chardef\background=\m \repeat}
332 \def\names{ {\AA}ngel\aa\ Beatrice Claire
333 Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris
334 Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave
335 Pauline Qu\^eneau Roxanne Sabine T\~a{\'\j}a Ur\v{s}ula
336 Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie\par}
337 \def\punct{\par\dopunct{min}\dopunct{pig}\dopunct{hid}
338 \dopunct{HIE}\dopunct{TIP}\dopunct{fluff}
339 \$1,234.56 + 7/8 = 9\% @ \#0\par}
340 \def\dopunct#1{#1,\ #1:\ #1;\ `#1'\ ?`#1?\ !`#1!\ (#1)\ [#1]\
344 hamburgefonstiv HAMBURGEFONSTIV\par
345 \names \punct \lowers \uppers \digits}
347 \def\math{\textfont1=\testfont \skewchar\testfont=\skewtrial
348 \mathchardef\Gamma="100 \mathchardef\Delta="101
349 \mathchardef\Theta="102 \mathchardef\Lambda="103 \mathchardef\Xi="104
350 \mathchardef\Pi="105 \mathchardef\Sigma="106 \mathchardef\Upsilon="107
351 \mathchardef\Phi="108 \mathchardef\Psi="109 \mathchardef\Omega="10A
352 \def\ii{i} \def\jj{j}
353 \def\\##1{|##1|+}\mathtrial
354 \def\\##1{##1_2+}\mathtrial
355 \def\\##1{##1^2+}\mathtrial
356 \def\\##1{##1/2+}\mathtrial
357 \def\\##1{2/##1+}\mathtrial
358 \def\\##1{##1,{}+}\mathtrial
359 \def\\##1{d##1+}\mathtrial
360 \let\ii=\imath \let\jj=\jmath \def\\##1{\hat##1+}\mathtrial}
361 \newcount\skewtrial \skewtrial='177
362 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L \\M \\N
363 \\O \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z \\a \\b \\c \\d \\e \\f
364 \\g \\h \\\ii \\\jj \\k \\l \\m \\n \\o \\p \\q \\r \\s \\t \\u \\v \\w
365 \\x \\y \\z \\\alpha \\\beta \\\gamma \\\delta \\\epsilon \\\zeta
366 \\\eta \\\theta \\\iota \\\kappa \\\lambda \\\mu \\\nu \\\xi \\\pi
367 \\\rho \\\sigma \\\tau \\\upsilon \\\phi \\\chi \\\psi \\\omega
368 \\\vartheta \\\varpi \\\varphi \\\Gamma \\\Delta \\\Theta \\\Lambda
369 \\\Xi \\\Pi \\\Sigma \\\Upsilon \\\Phi \\\Psi \\\Omega \\\partial
371 \def\mathsy{\begingroup\skewtrial='060 % for math symbol font tests
372 \def\mathtrial{$\\A \\B \\C \\D \\E \\F \\G \\H \\I \\J \\K \\L
373 \\M \\N \\O \\P \\Q \\R \\S \\T \\U \\V \\W \\X \\Y \\Z$\par}
376 % Here we have to ensure that we use a suitable encoding otherwise our
377 % octal and hexadecimal constants will appear in whatever encoding the
380 \def\oct#1{\hbox{\fontencoding{OT1}\rmfamily\'{}\kern-.2em\itshape
381 #1\/\kern.05em}}% octal constant
382 \def\hex#1{\hbox{\fontencoding{OT1}\rmfamily
383 \H{}\ttfamily#1}}% hexadecimal constant
384 \def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal
385 \m=\n \divide\m by 64 \xdef\0{\the\m}%
386 \multiply\m by-64 \advance\m by\n \divide\m by 8 \xdef\1{\the\m}}
387 \def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}%
388 \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F%
389 \global\p=\lastpenalty}} % \p=1 if none of the characters exist
391 \noalign{\nointerlineskip}
392 \multispan{19}\hrulefill&
393 \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr
394 \noalign{\nointerlineskip}}
396 \def\evenline{\loop\skippingfalse
397 \ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m
398 \expandafter\setdigs\meaning\next \testrow
399 \ifnum\p=1 \skippingtrue \fi\fi
400 \ifskipping \global\advance\n 16 \repeat
401 \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi
403 \def\morechart{\cr\noalign{\hrule\penalty5000}
404 \chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m}
405 \chartline \evenline}
406 \def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}
407 \def\chartstrut{\lower4.5pt\vbox to14pt{}}
408 \def\table{$$\global\n=0
409 \halign to\hsize\bgroup
410 \chartstrut##\tabskip0pt plus10pt&
411 &\hfil##\hfil&\vrule##\cr
413 &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
414 \def\endchart{\cr\noalign{\hrule}
415 \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
416 &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}
417 \def\:{\setbox0=\hbox{\noboundary\char\n\noboundary}%
418 \ifdim\ht0>7.5pt\reposition
419 \else\ifdim\dp0>2.5pt\reposition\fi\fi
420 \box0\global\advance\n 1 }
421 \def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0
422 \advance\dim 2pt \dp0=\dim}
423 \def\centerlargechars{
424 \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}
428 \def\text{{\advance\baselineskip-4pt
429 \setbox0=\hbox{abcdefghijklmnopqrstuvwxyz}
431 \ifdim 15pc>2\wd0 \hsize=15pc \else \hsize=2\wd0 \fi
433 On November 14, 1885, Senator \& Mrs.~Leland Stanford called together
434 at their San Francisco mansion the 24~prominent men who had been
435 chosen as the first trustees of The Leland Stanford Junior University.
436 They handed to the board the Founding Grant of the University, which
437 they had executed three days before. This document---with various
438 amendments, legislative acts, and court decrees---remains as the
439 University's charter. In bold, sweeping language it stipulates that
440 the objectives of the University are ``to qualify students for
441 personal success and direct usefulness in life; and to promote the
442 publick welfare by exercising an influence in behalf of humanity and
443 civilization, teaching the blessings of liberty regulated by law, and
444 inculcating love and reverence for the great principles of government
445 as derived from the inalienable rights of man to life, liberty, and
446 the pursuit of happiness.'' \moretext
447 (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)\par}}
448 \def\moretext{?`But aren't Kafka's Schlo\ss{} and \AE sop's
449 \OE uvres often na\"\i ve vis-\`a-vis the d\ae monic ph\oe nix's
450 official r\^ole in fluffy souffl\'es? }
451 \def\omitaccents{\let\moretext=\relax}
453 \def\sample{\table\text}
457 \def\bye{\end{document}}
460 % The redefinition of |\typeout| around the |\begin{document}|
461 % prevents \LaTeX{} from reporting that there is no |.aux| file.
462 % This is a bad hack, I agree :-)
464 \let\oldtypeout\typeout
467 % And another bad hack: to be able to load an encoding definition file
468 % after |\begin{document}| I disable the preamble only setting.
471 \let\@preamblecmds\@empty
475 \let\typeout\oldtypeout
477 \ifx\noinit!\else\init\fi
482 % \DeleteShortVerb{\|}