<< . .

. 41
( : 45)

. . >>

(The extra complications of an aspect ratio or a slant have not been addressed.)
3. Slant fonts. GFtoDVI also makes use of another special type of font, if it is necessary
to typeset slanted rules. The format of such so-called “slant fonts” is quite a bit simpler
than the format of gray fonts.
A slant font contains exactly n characters, in positions 1 to n, for some positive
integer n. The character in position k represents a slanted line k units tall, starting at
the baseline. These lines all have a ¬xed slant ratio s. The vertical “unit” is usually
chosen to be an integral number of pixels, small enough so that it su¬ces to draw rules
that are an integer number of units high; in fact, it should probably be no larger than
the thickness of the rules being drawn.
The following simple algorithm is used to typeset a rule that is m units high:
Compute q = m/n ; then typeset q characters of approximately equal size, namely
(m mod q) copies of character number m/q and q ’ (m mod q) copies of character
number m/q . For example, if n = 15 and m = 100, we have q = 7; a 100-unit-high
rule will be composed of 7 pieces, using characters 14, 14, 14, 14, 14, 15, 15.
GFtoDVI looks at the charht of character n only, so the tfm ¬le need not be
accurate about the heights of the other characters. (This is fortunate, since tfm format
allows at most 15 di¬erent nonzero heights per font.)
The charwd of character k should be k/n times s times the charht of n.
The font slant parameter should be s. It is customary to set the parameter
fontdimen 8 to the thickness of the slanted rules, but GFtoDVI doesn™t look at it.
Here™s an example of a slant-font parameter ¬le, ˜slantcheap6™, for the cheapo
printer and a slant of 1/6:
% Slant font for Cheapo with slope 1/6
if mode<>cheapo: errmessage "This file is for cheapo only"; fi
s=1/6; % the slant ratio
n=30; % the number of characters
r#=.4pt#; % thickness of the rules
u=1; % vertical unit
font_identifier "SLANTCHEAP6";
input slant
336 Appendix H: Hardcopy Proofs

The corresponding program ¬le ˜slant.mf™ looks like this: testfont.tex

% More-or-less general slant font generator for GFtoDVI
% The calling file should set the font_identifier and
% n = number of characters
% s = slant ratio
% r# = rule thickness (in sharp units)
% u = vertical unit (in pixels)
if unknown mag: mag := 1;
elseif (mag<1) or (mag<>floor mag):
errmessage "Sorry, mag must be a positive integer"; mag := 1; fi
mg := mag; mag := 1; mode_setup; u# := u*72.27/pixels_per_inch;
pixels_per_inch := pixels_per_inch*mg; fix_units;
define_whole_pixels(u); define_blacker_pixels(r);
pickup pencircle scaled r; ruler := savepen;
for k=1 upto n:
pickup ruler; draw origin--(k*u*s,k*u); % draw the line
unfill (lft-1,bot -1)--(rt 1,bot -1)
--(rt 1,0)--(lft-1,0)--cycle; % clip the ends
unfill ((lft -1,0)--(rt 1,0)
--(rt 1,top 1)--(lft -1,top 1)--cycle) shifted (k*u*s,k*u);
endchar; endfor
font_size 16pt#;
font_slant s;
fontdimen 8: r#;
font_coding_scheme "GFSLANT";

4. Font samples. The real test of a font is its appearance at the ¬nal size, after it has
actually been typeset. The TEX typesetting system can be used with the following
example macro ¬le ˜testfont.tex™ (in addition to plain TEX format) to put a new font
through its paces.
We shall comment on typical uses of testfont as we examine its parts. At
the beginning, testfont.tex turns o¬ several of TEX™s normal features.
% A testbed for font evaluation
\tracinglostchars=0 % missing characters are OK
\tolerance=1000 % and so are loose lines
\raggedbottom % pages can be short
\nopagenumbers % and they won™t be numbered
\parindent=0pt % nor will paragraphs be indented
\hyphenpenalty=200 % hyphens are discouraged
\doublehyphendemerits=30000 % and two in a row are terrible
\newlinechar=˜@ % we want to type multiline messages
\chardef\other=12 % and redefine "catcodes"
\newcount\m \newcount\n \newcount\p \newdimen\dim % temporary variables
Appendix H: Hardcopy Proofs 337

Then there are macros to print the time and date”an extremely valuable
thing to have on any proofsheet.
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
\def\twodigits#1{\ifnum #1<10 0\fi \number#1}
An online “menu” of the available test routines will be typed at your terminal
if you request \help.
{\catcode˜\|=0 \catcode˜\\=\other % use | as the escape, temporarily
\init switches to another font;@%
\end or \bye finishes the run;@%
\table prints the font layout in tabular format;@%
\text prints a sample text, assuming TeX text font conventions;@%
\sample combines \table and \text;@%
\mixture mixes a background character with a series of others;@%
\alternation interleaves a background character with a series;@%
\alphabet prints all lowercase letters within a given background;@%
\ALPHABET prints all uppercase letters within a given background;@%
\series prints a series of letters within a given background;@%
\lowers prints a comprehensive test of lowercase;@%
\uppers prints a comprehensive test of uppercase;@%
\digits prints a comprehensive test of numerals;@%
\math prints a comprehensive test of TeX math italic;@%
\names prints a text that mixes upper and lower case;@%
\punct prints a punctuation test;@%
\bigtest combines many of the above routines;@%
\help repeats this message;@%
and you can use ordinary TeX commands (e.g., to \input a file).}}}
The program prompts you for a font name. If the font is in your local directory
instead of a system directory, you might have to specify the directory name as part of
the font name. You should also specify scaling if the font has been magni¬ed, as in
the example of Chapter 5. Several fonts can be tested during a single run, if you say
˜\init™ before ˜\end™.
\def\init{\message{@Name of the font to test = }
\read-1 to\fontname \startfont
\message{Now type a test command (\string\help\space for help):}}
\def\startfont{\font\testfont=\fontname \spaceskip=0pt
\leftline{\sevenrm Test of \fontname\unskip\ on \today\ at \hours}
\testfont \setbaselineskip
338 Appendix H: Hardcopy Proofs

\ifdim\fontdimen6\testfont<10pt \rightskip=0pt plus 20pt ragged right
\else\rightskip=0pt plus 2em \fi
background character
\spaceskip=\fontdimen2\testfont % space between words (\raggedright) starting character
ending character
\advance\xspaceskip by\fontdimen7\testfont} alternation

The speci¬ed font will be called \testfont. As soon as you have speci¬ed it, \init
calls on \startfont, which puts a title line on the page; then it chooses what it hopes
will be a good distance between baselines, and gets ready to typeset text with “ragged
right” margins. (The code above improves on plain TEX™s \raggedright.)
The baselineskip distance is taken to be 6 pt plus the height of the tallest
character plus the depth of the deepest character. This is the distance between base-
lines for “series” tests, but it is decreased by 4 pt when the sample text is set. If
you want to change the baseline distance chosen by testfont, you can just say, e.g.,

\loop\char\n \ifnum \n<255 \advance\n 1 \repeat} % 256 chars in \box0
\baselineskip=6pt \advance\baselineskip\ht0 \advance\baselineskip\dp0 }

When testfont prompts you for a “background character” or a “starting
character” or an “ending character,” you can type the character you want (assuming
ASCII code); or you can say, e.g., ˜#35™ to get character code number 35. Codes 0“32
and 127“255 have to be speci¬ed with the ˜#™ option, on non-fancy installations of TEX,
and so does code 35 (which is the ASCII code of ˜#™ itself).

\def\setchar#1{{\escapechar-1\message{\string#1 character = }%
\read-1 to\next
\ifnum #3=˜\# \global\chardef#3=#2 \fi}
\setchar\starting \setchar\ending}

(The TEX hackery here is a bit subtle, because special characters like ˜\™ and ˜$™ must
temporarily lose their special signi¬cance.)
Suppose the background character is ˜o™ and the starting and ending characters
are respectively ˜p™ and ˜q™. Then the \mixture operation will typeset ˜opooppooopppop™
and ˜oqooqqoooqqqoq™; the \alternation operation will typeset ˜opopopopopopopopo™
and ˜oqoqoqoqoqoqoqoqo™. Other patterns could be added in a similar way.

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

The \series operation puts the background character between all the others lowers
(e.g., ˜opoqo™). Special series containing the lowercase letters of TEX text fonts (includ-
ing ˜ß™, ˜¦™, ˜“™, and ø™) and the uppercase letters (including ˜Æ™, ˜’™, and ˜˜™) are names
provided. Although \mixture and \alternation show you the e¬ects of ligatures and punct
kerning, \series does not.

\def\series{\promptthree \!\doseries\starting\ending\par}
\def\doseries#1#2{\n=#1\loop\char\n\!\ifnum\n<#2\advance\n 1 \repeat}

(A long series might ¬ll more than one line; TEX™s \discretionary break operation is
used here so that the background character will end the line and be repeated at the
beginning of the next.)
A “comprehensive” test uses a series of background characters against a series
of others. The series will consist of lowercase letters (˜\lowers™), uppercase letters
(˜\uppers™), or numerals (˜\digits™).

\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}

The \names test puts uppercase letters and accents together with lowercase
letters. The accents will look funny if the test font doesn™t have them in plain TEX™s
favorite positions.

\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}

Punctuation marks are tested in juxtaposition with di¬erent sorts of letters,
by the ˜\punct™ macro:

\$1,234.56 + 7/8 = 9\% @ \#0\par}
\def\dopunct#1{#1,\ #1:\ #1;\ ˜#1™\
?˜#1?\ !˜#1!\ (#1)\ [#1]\ #1*\ #1.\par}
340 Appendix H: Hardcopy Proofs

Mixtures and alternations and series are excellent ways to discover that letters text
are too dark, too light, or too tightly spaced. But a font also has to be readable; in
fact, this is the number one objective. So testfont provides a sample ˜\text™. One of Kafka
the sentences is optional, because it contains lots of accents and unusual letters; you AEsop
can omit it from the text by saying ˜\omitaccents™. Furthermore, you can type your
own text, online, or you can input one from a ¬le, instead of using this canned example.
\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
\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? }
Now comes one of the hardest parts of the ¬le, from the TEX standpoint: The
\table macro prints a font diagram, omitting groups of sixteen characters that are
entirely absent from the font. The format of this table is the same as that used in
Appendix F of The TEXbook. When the font contains unusually large characters that
ought to be vertically centered, you should say ˜\centerlargechars™ before ˜\table™.
(A TEX math symbol font or math extension font would use this feature.)
\def\oct#1{\hbox{\rm\™{}\kern-.2em\it#1\/\kern.05em}} % octal constant
\def\hex#1{\hbox{\rm\H{}\tt#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}%
\global\p=\lastpenalty}} % \p=1 if none of the characters exist
\setbox0=\hbox{\lower 2.3pt\hbox{\hex{\h x}}}\smash{\box0}\cr
Appendix H: Hardcopy Proofs 341

\newif\ifskipping sample
\ifnum\n<256 \m=\n \divide\m 16 \chardef\next=\m math
\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
\chartline \oddline \m=\1 \advance\m 1 \xdef\1{\the\m}
\chartline \evenline}
\def\chartstrut{\lower4.5pt\vbox to14pt{}}
\halign to\hsize\bgroup
\chartstrut##\tabskip0pt plus10pt&
\raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B&
&\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}
\box0\global\advance\n 1 }
\advance\dim 2pt \dp0=\dim}
Two of the most important combinations of tests are treated now: \sample
prints the \table and the text; \bigtest gives you the works, plus a mysterious word
that is traditional in type specimens:
hamburgefonstiv HAMBURGEFONSTIV\par
\names \punct \lowers \uppers \digits}
Finally, there™s a \math routine useful for checking out the spacing in the math
italic fonts used by plain TEX; \mathsy does a similar thing for the uppercase letters
in a math symbols font.
\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
342 Appendix H: Hardcopy Proofs

\def\ii{i} \def\jj{j} init
\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}
The last line of testfont is
and it means “automatically call ˜\init™ unless ˜\noinit™ is an exclamation point.”
Why this? Well, you might have your own test ¬le from which you™d like to use the
facilities of testfont, without typing commands online. If your ¬le says ˜\let\noinit!
\input testfont™ TEX will read in testfont but the routine will not prompt you for
a ¬le name. The ¬le can then continue to test one or more fonts by saying, e.g.,
\def\fontname{cmbx10 }\startfont\sample\vfill\eject
\def\fontname{cmti10 scaled \magstep3}\startfont\sample\vfill\eject
thereby de¬ning \fontname directly, and using \startfont to do the initialization
instead of \init.
To conclude this appendix, let™s look at the listing of a ¬le that can be used
to test special constructions in math fonts with the conventions of plain TEX:
\raggedright \rightskip=2em plus 5em minus 2em
$\hbar \not\equiv B$, but $\sqrt C \mapsto \sqrt x$,
$Z \hookrightarrow W$, $Z \hookleftarrow W$,
$Z \longmapsto W$, $Z \bowtie W$, $Z \models W$,
$Z \Longrightarrow W$, $Z \longrightarrow W$,
$Z \longleftarrow W$, $Z \Longleftarrow W$,
$Z \longleftrightarrow W$, $Z \Longleftrightarrow W$,
$\overbrace{\hbox{very long things for testing}}$,
Appendix H: Hardcopy Proofs 343

$\underbrace{\hbox{very long things for testing}}$, SHAKESPEARE
$Z \choose W$, $Z \brack W$, $Z \brace W$, $Z \sqrt W$,
$Z \cong W$, $Z \notin W$, $Z \rightleftharpoons W$,
$\widehat Z$, $\widehat{ZW}$, $\widehat{Z+W}$,
$\widetilde Z$, $\widetilde{ZW}$, $\widetilde{Z+W}$.
\def\biggg#1{{\hbox{$\left#1\vbox to20.5pt{}\right.$}}}
\def\bigggl{\mathopen\biggg} \def\bigggr{\mathclose\biggg}
\def\Biggg#1{{\hbox{$\left#1\vbox to23.5pt{}\right.$}}}
\def\Bigggl{\mathopen\Biggg} \def\Bigggr{\mathclose\Biggg}
\sizetest () \sizetest [] \sizetest \lgroup\rgroup
\sizetest \lmoustache\rmoustache \sizetest \vert\Vert

<< . .

. 41
( : 45)

. . >>