summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/lh/nfssfox.dtx
blob: 42a68fa547a0cd60946d0145d7efa7a259d6d7ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
% \iffalse meta-comment
% nfssfox.dtx
% of nfssfont.dtx
% Part of LH fonts package v3.5(e)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \fi
\def\nfssfoxfileversion{v0.0a}
\def\nfssfoxfiledate{2006/07/23}
% \CheckSum{1234}
% \iffalse
% [nfssfont]
% Copyright (C) 1994 Donald E. Knuth
% Copyright (C) 1994-94,2003 Frank Mittelbach,
% all rights reserved.
% \fi
% 
%
% \title{The program \texttt{nfssfox}}
% \author{Olga Lapko\thanks{Addition to Frank Mittelbach's
% \textup{\texttt{nfssfont.tex}}. Documentation
% and file source: \textup{\texttt{nfssfont.dtx}}
% version v2.1a dated 2003/01/12.}}
% \date{\nfssfoxfiledate}
%
%
% \def\dst{{\normalfont\scshape docstrip}}
% \def\NFSS{\textsf{NFSS}}
% \setcounter{StandardModuleDepth}{1}
%
%
% \maketitle
%
% \section{Introduction}
%
% \emph{Here is used unchanged text from \textup{\texttt{nfssfont.dtx}}
% documentation. The three sentences
% which describe additional macro \cmd{\xtable} (\cmd{\table}
% eXtension with decimal numbers) are emphasized. The name
% \textup{\texttt{nfssfont.tex}} in the next paragraph changed to
% \textup{\texttt{nfssfont.tex}}.}
%
% Within the \NFSS{} distribution there is a \LaTeX{} file
% \texttt{nfssfox.tex} which can be used to test new fonts, produce
% font tables showing all characters, etc. This is an addaption of a
% program originally written by Don Knuth. 
%
% When you run this file through \LaTeX{} you will be asked to enter
% the name of the font to test. Your answer should be the external
% font name without any extension, e.g.\ \texttt{cmr10} (Computer
% Modern Roman 10pt) or \texttt{yinit} (Yannis Haralambous' Initial
% font).
%
% Alternatively (since version 2.1), you can press \meta{return} at
% this point. In that case a dialog is started that asks you for the
% font characteristics in \NFSS{} notation, i.e., first for the
% encoding scheme (default \texttt{T1}), then for the family name
% (default \texttt{cmr}), then for the series (default \texttt{m}),
% then for the shape (default \texttt{n}), and finally for the size
% (default \texttt{10pt}).
%
% You are then requested to enter a command. Probably the most
% important one is |\table|, which will produce a font chart.  To
% switch to a new test font, type |\init|; to finish the test, type
% |\bye|; and to learn about all the other possible tests type
% |\help|.
%
% This is at
% the moment only a crude addaption of the test program for the
% Computer Modern fonts by Donald Knuth.
% 
% \StopEventually{}
% 
% \section{A driver for this document}
%
% The next bit of code contains the documentation driver file for
% \TeX{}, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the 
% \dst{} program.
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
 % \OnlyDescription   % comment out for implementation details
\begin{document}
   \DocInput{nfssfox.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
% \section{The code}
%
% A testbed for font evaluation (see The METAFONTbook, Appendix H)
% changed for \LaTeX{} with \NFSS.
%
% This program should get a complete rewrite some day or at least some
% code documentation. Any volunteers?
%    \begin{macrocode}
%<*code>
%%
%%modified nfssfont.tex from LaTeX's base
%%
\documentclass{article}               %FMi
\nofiles                              %FMi
\textwidth=470pt                      %FMi
\oddsidemargin=0pt                    %FMi
\textheight=1000pt                    %FMi
\def\sevenrm{\fontsize{7}{9pt}\rmfamily}    %FMi
\def\fiverm{\fontsize55\rmfamily}

\typeout{**********************************************}
\typeout{* NFSS font test program version <\nfssfoxfileversion>}
\typeout{*}
\typeout{* Follow the instructions}
\typeout{**********************************************}
\typeout{}

\tracinglostchars=0
\tolerance=1000
\raggedbottom
\parindent=0pt
%\newlinechar=`@               %FMi
\hyphenpenalty=200
\doublehyphendemerits=30000
%    \end{macrocode}
%    
%    \begin{macrocode}
\newcount\m \newcount\n \newcount\p \newdimen\dim
\chardef\other=12

\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
\def\hours{\n=\time \divide\n 60
  \m=-\n \multiply\m 60 \advance\m \time
  \twodigits\n\twodigits\m}
\def\twodigits#1{\ifnum #1<10 0\fi \number#1}
%    \end{macrocode}
%    
%    We first ask for a real external font name\ldots
%    \begin{macrocode}
\def\init{%
 \typein[\currfontname]%
   {Input external font name, e.g., cmr10^^J%
    (or <enter> for NFSS classification of font):}%
%    \end{macrocode}
%    If the user answers with ``return'' we ask for the \NFSS{}
%    classification of the font in form of encoding, family, series,
%    shape, and size offering a default each time.
%    \begin{macrocode}
 \ifx\currfontname\empty
  \begingroup
  \typein[\encoding]{^^J^^J*** NFSS classification 
                     ***^^J^^JFont encoding [T1]:}%
  \ifx\encoding\empty
   \fontencoding{T1}%
  \else
%    \end{macrocode}
%    The requested encoding might not be loaded, so we pretend that it
%    was loaded here to avoid an error, after all we only need it to
%    find out the external font name.
%    \begin{macrocode}
    \expandafter\let\csname T@\encoding\endcsname\empty
    \fontencoding\encoding
  \fi
  \typein[\family]{Font family [cmr]:}%
  \relax
  \ifx\family\empty
    \fontfamily{cmr}%
  \else
    \fontfamily\family
  \fi
  \typein[\series]{Font series [m]:}%
  \ifx\series\empty
    \fontseries{m}%
  \else
    \fontseries\series
  \fi
  \typein[\shape]{Font shape [n]:}%
  \ifx\shape\empty
    \fontshape{n}%
  \else
    \fontshape\shape
  \fi
  \typein[\size]{Font size [10pt]:}%
  \ifx\size\empty
    \fontsize{10}{10}%
  \else
    \fontsize\size\size
  \fi
%    \end{macrocode}
%    Finally select the font and globally assign it to |\currfontname|.
%    \begin{macrocode}
  \selectfont\xdef\currfontname{\fontname\font}%
  \endgroup
 \fi
 \startfont
 \message{Now type a test command (\string\help\space for help):}}
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\startfont{\font\testfont=\currfontname
  \leftline{\sevenrm Test of \currfontname\unskip\ on \today\ at \hours}
  \medskip
  \testfont \setbaselineskip
  \ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt
  \else\rightskip=0pt plus 2em \fi
  \spaceskip=\fontdimen2\testfont % space between words (\raggedright)
  \xspaceskip=\fontdimen2\testfont \advance\xspaceskip 
  by\fontdimen7\testfont}
%    \end{macrocode}
%    
%    \begin{macrocode}
{\catcode`\|=0 \catcode`\\=\other
|gdef|help{|message{%
\init switches to another font;^^J%
\stop or \bye finishes the run;^^J%
\table prints the font layout in tabular format;^^J%
\text prints a sample text, assuming TeX text font conventions;^^J%
\sample combines \table and \text;^^J%
\mixture mixes a background character with a series of others;^^J%
\alternation interleaves a background character with a series;^^J%
\alphabet prints all lowercase letters within a given background;^^J%
\ALPHABET prints all uppercase letters within a given background;^^J%
\series prints a series of letters within a given background;^^J%
\lowers prints a comprehensive test of lowercase;^^J%
\uppers prints a comprehensive test of uppercase;^^J%
\digits prints a comprehensive test of numerals;^^J%
\math prints a comprehensive test of TeX math italic;^^J%
\names prints a text that mixes upper and lower case;^^J%
\punct prints a punctuation test;^^J%
\bigtest combines many of the above routines;^^J%
\help repeats this message;^^J%
and you can use ordinary TeX commands (e.g., to \input a file).}}}

\def\setbaselineskip{\setbox0=\hbox{\n=0
\loop\char\n \ifnum \n<255 \advance\n 1 \repeat}
\baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\setchar#1{{\escapechar-1\message{\string#1 character = }%
  \def\do##1{\catcode`##1=\other}\dospecials
  \read-1 to\next
  \expandafter\finsetchar\next\next#1}}
\def\finsetchar#1#2\next#3{\global\chardef#3=`#1
  \ifnum #3=`\# \global\chardef#3=#2 \fi}
\def\promptthree{\setchar\background
  \setchar\starting \setchar\ending}

\def\mixture{\promptthree \domix\mixpattern}
\def\alternation{\promptthree \domix\altpattern}
\def\mixpattern{\0\1\0\0\1\1\0\0\0\1\1\1\0\1}
\def\altpattern{\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0}
\def\domix#1{\par\chardef\0=\background \n=\starting
  \loop \chardef\1=\n #1\endgraf
  \ifnum \n<\ending \advance\n 1 \repeat}

\def\!{\discretionary{\background}{\background}{\background}}
\def\series{\promptthree \!\doseries\starting\ending\par}
\def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}
\def\complower{\!\doseries{`a}{`z}\doseries{'31}{'34}\par}
\def\compupper{\!\doseries{`A}{`Z}\doseries{'35}{'37}\par}
\def\compdigs{\!\doseries{`0}{`9}\par}
\def\alphabet{\setchar\background\complower}
\def\ALPHABET{\setchar\background\compupper}

\def\lowers{\docomprehensive\complower{`a}{`z}{'31}{'34}}
\def\uppers{\docomprehensive\compupper{`A}{`Z}{'35}{'37}}
\def\digits{\docomprehensive\compdigs{`0}{`4}{`5}{`9}}
\def\docomprehensive#1#2#3#4#5{\par\chardef\background=#2
  \loop{#1} \ifnum\background<#3\m=\background\advance\m 1
  \chardef\background=\m \repeat \chardef\background=#4
  \loop{#1} \ifnum\background<#5\m=\background\advance\m 1
  \chardef\background=\m \repeat}
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\names{ {\AA}ngel\aa\ Beatrice Claire
  Diana \'Erica Fran\c{c}oise Ginette H\'el\`ene Iris
  Jackie K\=aren {\L}au\.ra Mar{\'\i}a N\H{a}ta{\l}{\u\i}e {\O}ctave
  Pauline Qu\^eneau Roxanne Sabine T\~a{\'\j}a Ur\v{s}ula
  Vivian Wendy Xanthippe Yv{\o}nne Z\"azilie\par}
\def\punct{\par\dopunct{min}\dopunct{pig}\dopunct{hid}
  \dopunct{HIE}\dopunct{TIP}\dopunct{fluff}
  \$1,234.56 + 7/8 = 9\% @ \#0\par}
\def\dopunct#1{#1,\ #1:\ #1;\ `#1'\ ?`#1?\ !`#1!\ (#1)\ [#1]\ 
               #1*\ #1.\par}

\def\bigtest{\sample
  hamburgefonstiv HAMBURGEFONSTIV\par
  \names \punct \lowers \uppers \digits}

\def\math{\textfont1=\testfont \skewchar\testfont=\skewtrial
 \mathchardef\Gamma="100 \mathchardef\Delta="101
 \mathchardef\Theta="102 \mathchardef\Lambda="103 \mathchardef\Xi="104
 \mathchardef\Pi="105 \mathchardef\Sigma="106 \mathchardef\Upsilon="107
 \mathchardef\Phi="108 \mathchardef\Psi="109 \mathchardef\Omega="10A
 \def\ii{i} \def\jj{j}
 \def\\##1{|##1|+}\mathtrial
 \def\\##1{##1_2+}\mathtrial
 \def\\##1{##1^2+}\mathtrial
 \def\\##1{##1/2+}\mathtrial
 \def\\##1{2/##1+}\mathtrial
 \def\\##1{##1,{}+}\mathtrial
 \def\\##1{d##1+}\mathtrial
 \let\ii=\imath \let\jj=\jmath \def\\##1{\hat##1+}\mathtrial}
\newcount\skewtrial \skewtrial='177
\def\mathtrial{$\\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 \\a \\b \\c \\d \\e \\f
 \\g \\h \\\ii \\\jj \\k \\l \\m \\n \\o \\p \\q \\r \\s \\t \\u \\v \\w
 \\x \\y \\z \\\alpha \\\beta \\\gamma \\\delta \\\epsilon \\\zeta
 \\\eta \\\theta \\\iota \\\kappa \\\lambda \\\mu \\\nu \\\xi \\\pi
 \\\rho \\\sigma \\\tau \\\upsilon \\\phi \\\chi \\\psi \\\omega
 \\\vartheta \\\varpi \\\varphi \\\Gamma \\\Delta \\\Theta \\\Lambda
 \\\Xi \\\Pi \\\Sigma \\\Upsilon \\\Phi \\\Psi \\\Omega \\\partial
 \\\ell \\\wp$\par}
\def\mathsy{\begingroup\skewtrial='060 % for math symbol font tests
 \def\mathtrial{$\\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$\par}
 \math\endgroup}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\oct#1{\hbox{\rmfamily\'{}\kern-.2em\itshape
           #1\/\kern.05em}} % octal constant
\def\hex#1{\hbox{\rmfamily\H{}\ttfamily#1}} % hexadecimal constant
\def\setdigs#1"#2{\gdef\h{#2}% \h=hex prefix; \0\1=corresponding octal
 \m=\n \divide\m by 64 \xdef\0{\the\m}%
 \multiply\m by-64 \advance\m by\n \divide\m by 8 \xdef\1{\the\m}}
\def\testrow{\setbox0=\hbox{\penalty 1\def\\{\char"\h}%
 \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F%
 \global\p=\lastpenalty}} % \p=1 if none of the characters exist
\def\oddline{\cr
  \noalign{\nointerlineskip}
  \multispan{19}\hrulefill&
  \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr
  \noalign{\nointerlineskip}}
\newif\ifskipping
\def\evenline{\loop\skippingfalse
 \ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m
 \expandafter\setdigs\meaning\next \testrow
 \ifnum\p=1 \skippingtrue \fi\fi
 \ifskipping \global\advance\n 16 \repeat
 \ifnum\n=256 \let\next=\endchart\else\let\next=\morechart\fi
 \next}
\def\morechart{\cr\noalign{\hrule\penalty5000}
 \chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m}
 \chartline \evenline}
\def\chartline{&\oct{\0\1x}&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}
\def\chartstrut{\lower4.5pt\vbox to14pt{}}
\def\table{$$\global\n=0
  \halign to\hsize\bgroup
    \chartstrut##\tabskip0pt plus10pt&
    &\hfil##\hfil&\vrule##\cr
    \lower6.5pt\null
    &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}
%    \end{macrocode}
%
% \emph{The additions analogous to textfox.tex: the table with decimal numbers.}
%
% \emph{The \cmd{\xtable} command prints also decimal codes of letters.
% Macro \cmd{\smashnum} toggles numbers in tabular cells when necessary.}
%    \begin{macrocode}
\def\xtable{$$\global\let\smashnum\empty\global\n=0
  \halign to\hsize\bgroup
    \chartstrut##\tabskip0pt plus10pt&
    &\hfil##\hfil&\vrule\smashnum##\cr
    \lower6.5pt\null
    &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7
     \global\let\smashnum\ssmashnum&\evenline}
%    \end{macrocode}
% \emph{The definition of \cmd{\ssmashnum}. It puts decimal numbers.}
%    \begin{macrocode}
\def\ssmashnum{\smash{\hbox to0pt{\fiverm
  \kern.2em\lower1.5ex\hbox{\number\n}\hss}}}
\def\endchart{\cr\noalign{\global\let\smashnum\empty\hrule}
  \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
  &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}
\def\:{\setbox0=\hbox{\char\n}%
  \ifdim\ht0>7.5pt\reposition
  \else\ifdim\dp0>2.5pt\reposition\fi\fi
  \box0\global\advance\n 1 }
\def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0
  \advance\dim 2pt \dp0=\dim}
\def\centerlargechars{
  \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\text{{\advance\baselineskip-4pt
\setbox0=\hbox{abcdefghijklmnopqrstuvwxyz}
\ifdim\hsize>2\wd0
   \ifdim 15pc>2\wd0 \hsize=15pc \else \hsize=2\wd0 \fi
\fi
On November 14, 1885, Senator \& Mrs.~Leland Stanford called together
at their San Francisco mansion the 24~prominent men who had been
chosen as the first trustees of The Leland Stanford Junior University.
They handed to the board the Founding Grant of the University, which
they had executed three days before. This document---with various
amendments, legislative acts, and court decrees---remains as the
University's charter.  In bold, sweeping language it stipulates that
the objectives of the University are ``to qualify students for
personal success and direct usefulness in life; and to promote the
publick welfare by exercising an influence in behalf of humanity and
civilization, teaching the blessings of liberty regulated by law, and
inculcating love and reverence for the great principles of government
as derived from the inalienable rights of man to life, liberty, and
the pursuit of happiness.'' \moretext
(!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)\par}}
\def\moretext{?`But aren't Kafka's Schlo{\ss} and {\AE}sop's
{\OE}uvres often na{\"\i}ve vis-\`a-vis the d{\ae}monic ph{\oe}nix's
official r\^ole in fluffy souffl\'es? }
\def\omitaccents{\let\moretext=\relax}

\def\sample{\table\text}
%    \end{macrocode}
%    
%    \begin{macrocode}
\def\bye{\end{document}}       %FMi
%    \end{macrocode}
%
%    The redefinition of |\typeout| around the |\begin{document}|
%    prevents \LaTeX{} from reporting that there is no |.aux| file.
%    This is a bad hack, I agree :-)
%    \begin{macrocode}
\let\oldtypeout\typeout        %FMi
\def\typeout#1{}               %FMi
\begin{document}               %FMi
\let\typeout\oldtypeout        %FMi

\ifx\noinit!\else\init\fi
%</code>
%    \end{macrocode}
%    
%
% \DeleteShortVerb{\|}
% \Finale
%
\endinput