summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/typespec/TypeSp09.tex
blob: 072845299cc1a1424b8dba5a7ba56475eedc43fb (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
%%% Stephen Moye
%%% Stephen_Moye@brown.edu
%%% Brown University
%%% Graphic Services

\newdimen\leading
\newdimen\ascheight
\newdimen\xheight
\newdimen\adjust
\newdimen\sampletextwd
\newdimen\gutter
\newdimen\dist
\newdimen\dspsize
\newdimen\dspsizeincr
\newdimen\depth
\newdimen\mainleading

\newcount\scratch
\newcount\divisor
\newcount\spconv
\newcount\divisor
\newcount\scratch
\newcount\sscratch
\newcount\intgp
\newcount\fracp
\newcount\dsplineno
\newcount\xascrnum

\newtoks\texttoks
\newtoks\dspfont

%%%

\vbadness10000

%%%

\def\setleading{%
\setbox0=\hbox{Ilpgy}%
\setbox1=\hbox{x}%
\xheight=\ht1 
\ascheight=\ht0
\depth=\dp0
\leading=\ht0
\advance\leading \depth
\leading=1.25\leading
\dimen0=\ascheight
\divide\dimen0 by 2\relax
\advance\dimen0-\xheight
%%% Account for large x-height
\ifdim\dimen0<0pt \else \advance\leading-\dimen0\fi
%%% Account for missing descenders -- smallcaps for instance
\ifdim\depth<.1\ascheight \advance \leading .4\ascheight\fi}

%%% Calculates ratio of x-height to ascender height
\def\calcxaratio#1{%
\dimen0=\the\fontdimen5#1
\xascrnum=\dimen0%
\divisor=\number\ascheight
\multiply\xascrnum by 100\relax
\divide\xascrnum by\ascheight}

%%% Type factor = ([Type size] * [# of characters in a sample])/(linear length of sample)
%%% Based on {\it Brown's Index}, Bruce Brown, Greenwood Publishing, Great Britain 1983
\def\typefact#1{%
\dist=10pt
\font\facttext=#1 at\dist
\spconv=\number\dist
\multiply\spconv by 12
\multiply\spconv by 204
\setbox1=\hbox{\facttext\freqabc}%
\divisor=\number\wd1
\divide\divisor by 100
\divide\spconv by \divisor
\scratch=\spconv 
	\divide\scratch100
 \divisor=\scratch
 \multiply \scratch100
 \advance\spconv-\scratch
 \hbox{\number\divisor.\ifnum\spconv<10 0\the\spconv \else \the\spconv\fi}}
 
%%% Convert from TeX's bulky 4-decimal point measurements to 1
\def\prettypt#1{\dist=#1%
\multiply\dist10%
\scratch=\number\dist
\divide\scratch65536%
\intgp=\scratch \divide\intgp10%
\sscratch=\intgp 
\multiply\sscratch10 \advance\scratch-\sscratch
\fracp=\scratch
\hbox{\the\intgp.\the\fracp}pt}

\def\displaytype#1{%
\font\bigtype=#1 at 24pt
\font\medtype=#1 at 18pt
\font\normtype=#1 at 14pt
\font\smalltype=#1 at 12pt
\font\tinytype=#1 at 10pt
\font\tinytinytype=#1 at 8pt}

\texttoks={\emergencystretch2em Brick quiz whangs jumpy veldt fox.
Nymphs vex, beg quick fjord waltz.
Quick wafting zephyrs vex bold Jim.
West quickly gave Bert handsome prizes for six juicy plums.
Freight to me sixty dozen quart jars and twelve black pans.
My help squeezed back in again and joined the weavers after six.
Turgid saxophones blew over Mick's jazzy quiff.
Five wine experts jokingly quizzed sample chablis.
My grandfather picks up quartz and valuable onyx jewels.
Mix Zapf with Veljovic and get quirky Beziers.
All questions asked by five watch experts amazed the judge.
Back in June we delivered oxygen equipment of the same size.
We have just quoted on nine dozen boxes of grey lamp wicks.
A large fawn jumped quickly over white zinc boxes.
The exodus of jazzy pigeons is craved by squeamish walkers.}

\def\freqabc{zjqx%
       kkvv%
       bbbbppppyyyywwwwgggg%
       mmmmmmffffffccccccuuuuuu%
       lllllllldddddddd%
       hhhhhhhhhhhhrrrrrrrrrrrrssssssssssss%
       ooooooooooooooiiiiiiiiiiiiiinnnnnnnnnnnnnn%
       aaaaaaaaaaaaaaaatttttttttttttttttt%
       eeeeeeeeeeeeeeeeeeeeeeee}% 204 chars

%%% #1 - Font TeX name; #2 - number of lines in sample
%%% #3 - Printed name of font
\def\textbox#1#2#3{#1%\setleading%%
\setbox0=\vtop{%
\hbadness10000\hsize\sampletextwd\the\texttoks}%
\setbox1=\vsplit0 to #2\baselineskip
\vtop{\hsize\sampletextwd\centerline{\strut#1[#3]}\smallskip\unvbox1\relax%
%%% Comment-out the following line if you don't want/need numbers in the sample text
1\hfill2\hfill3\hfill4\hfill5\hfill6\hfill7\hfill8\hfill9\hfill0\hfill\&\null\par%
}}

\def\setupmargnote{%
\tinytinytype \setleading \baselineskip=\leading \vskip\baselineskip}

%%% 1-type size; 2-Number of lines;
%%% 3-TeX type name 1; 4-Printed type name 1;
%%% 5-TeX type name 2; 6-Printed type name 2
\def\lineoftwo#1#2#3#4#5#6{%
\begingroup
\font\typeone=#3 at #1%
%% Set up baselineskip for the two samples
%% and the info for the margin notes for the
%% sample on the left:
\typeone\setleading \calcxaratio{\typeone}
 \baselineskip=\leading
 \mainleading=\leading
\font\typetwo=#5 at #1%
\line{%
\llap{\vtop{\setupmargnote%
   \halign{\hfill##\cr#1\cr
   \prettypt{\the\mainleading}\cr
   \typefact{#3}\cr
   0.\the\xascrnum\cr}}\enskip}\hss%
\textbox{\typeone}{#2}{#4}%
\hskip\gutter
%% Setup the info for the margin note describing
%% the sample on the right
\typetwo \setleading \calcxaratio{\typetwo}
\textbox{\typetwo}{#2}{#6}%
\hss
\rlap{\enskip\vtop{\setupmargnote%
			\halign{##\hfil\cr#1\cr
   \prettypt{\the\mainleading}\cr
   \typefact{#5}\cr
   0.\the\xascrnum\cr}}}%
}\endgroup}

\def\lineofone#1#2#3#4{%
\begingroup
\font\typeone=#3 at #1 \typeone \setleading \calcxaratio{\typeone}
\baselineskip=\leading
\line{\hss%%
\hbox{\textbox{\typeone}{#2}{#4}%
\hss
\rlap{\enskip\vtop{\setupmargnote%
			\halign{##\hfil\cr
   #1\cr
   \prettypt{\the\mainleading}\cr
   \typefact{#3}\cr
   0.\the\xascrnum\cr}}}}%
\hss}\endgroup}

\def\comment#1{%
\bigskip
\hrule
\smallskip
\line{\hfill\vbox{\hyphenpenalty10000 \emergencystretch1em%
\leftskip0pt plus 4em \rightskip0pt \parfillskip0pt
\tinytinytype\setleading\hsize.75\sampletextwd\noindent#1}}}

%%% Calculates the largest display typesize to fit \hsize
%%% First typeset it very small (.1pt) and measure its width
%%% then scale it to get it to fit to \hsize
\def\dabc{AGQMstaefgpy1234?!\&}
\def\makedisplay#1{%
\dspfont={#1}
\font\dsp=\the\dspfont\space at .1pt
\setbox0=\hbox{\dsp \dabc}%
\dspsize=\hsize 
\scratch=\dspsize \multiply\scratch10 \divisor=\wd0
\divide\scratch by \divisor
\dspsize=\scratch pt \divide\dspsize by 100
%%% Calculates the increment such that smallest display size is 12pt
\dspsizeincr=\dspsize \advance\dspsizeincr by -12pt
\divide\dspsizeincr by 6 \dsplineno7
%%% Make the display
\bgroup
\loop\font\dsp=\the\dspfont\space at \dspsize \dsp \baselineskip1em
		\hbox to\hsize{\dabc\hfill\hss\rlap{\tinytinytype\enskip\prettypt{\the\dspsize}}}%
 	\vskip.075in\relax
		\ifnum\dsplineno>1 \global\advance\dsplineno by-1\relax
			\advance\dspsize by -\dspsizeincr \font\dsp=\the\dspfont\space at \dspsize\repeat
\egroup}

%%%
%%% Example
%%%

%%% Setup

\parindent0pt
\nopagenumbers
\hsize6in
\hoffset.25in
\gutter1pc
\sampletextwd2.85in
\displaytype{Helvetica}


%%%
%%% The Page
%%%

\leftline{\medtype BodoniClassic}
\smallskip
\hrule
\bigskip

%%% Display Type
\makedisplay{BodoniClassic-Roman}

\bigskip
\hrule
\bigskip

\lineoftwo{10pt}{9}{BodoniClassic-Roman}{Bodoni Classic}{BodoniClassic-Italic}{Bodoni Classic Italic}

\bigskip

\lineoftwo{10pt}{9}{BodoniClassic-Bold}{BodoniClassic bold}{BodoniClassic-BoldItalic}{BodoniClassic BoldItalic}

\comment{BodoniClassic, drawn by Bruce Rogers; italic by Frederick Warde}

%%%
%%% The End
%%%

\bye