Debian Codegraph @

texmf-dist/fonts/source/public/knuth-lib/manfnt.mf

raw
1 % Special font for the TeX and METAFONT manuals
2 % This file was prepared "hastily" and hasn't been "polished".
3 % In particular, some characters won't work when aspect_ratio<>1.
4
5 font_size 10pt#;
6 em#:=10pt#; ht#:=250/36pt#;
7 mode_setup;
8
9 font_identifier "MANFNT";
10 font_coding_scheme "PI";
11
12 message "Hex symbols";
13 width1#=.4pt#*(ht#/(100/36pt#));
14 width2#=.6pt#*(ht#/(100/36pt#));
15 define_blacker_pixels(width1,width2);
16
17 beginchar(1,2ht#,ht#,0); "Original hex"; % \hexa
18 pickup pencircle scaled width1;
19 w:=2good.x .5w;
20 x1=x4=good.x 0; x2=x5=.5w; x3=x6=good.x w;
21 y1=y2=y3=good.y h; y4=y5=y6=good.y 0;
22 draw z1..z6; draw z2..z5; draw z3..z4;
23 for k=1 upto 6: drawdot z[k]; endfor
24 labels (1,2,3,4,5,6); endchar;
25
26 beginchar(2,2ht#,ht#,0); "Top/bot adjusted hex"; % \hexb
27 pickup pencircle scaled width1;
28 w:=2good.x .5w;
29 x1=x4=good.x 0; x2=x5=.5w; x3=x6=good.x w;
30 top y1=h; y1=y2=y3; bot y4=0; y4=y5=y6;
31 draw z1..z6; draw z2..z5; draw z3..z4;
32 for k=1 upto 6: drawdot z[k]; endfor
33 labels (1,2,3,4,5,6); endchar;
34
35 beginchar(3,2ht#,ht#,0); "Bold top/bot adjusted hex"; % \hexc
36 pickup pencircle scaled width2;
37 w:=2good.x .5w;
38 x1=x4=good.x 0; x2=x5=.5w; x3=x6=good.x w;
39 top y1=h; y1=y2=y3; bot y4=0; y4=y5=y6;
40 draw z1..z6; draw z2..z5; draw z3..z4;
41 for k=1 upto 6: drawdot z[k]; endfor
42 labels (1,2,3,4,5,6); endchar;
43
44 beginchar(4,2ht#,ht#,0); "Bold top/bot/lft/rt adjusted hex"; % \hexd
45 pickup pencircle scaled width2;
46 w:=2good.x .5w;
47 lft x1=0; x1=x4; x2=x5=.5w; rt x3=w-1; x3=x6;
48 top y1=h; y1=y2=y3; bot y4=0; y4=y5=y6;
49 draw z1..z6; draw z2..z5; draw z3..z4;
50 for k=1 upto 6: drawdot z[k]; endfor
51 labels (1,2,3,4,5,6); endchar;
52
53 beginchar(5,2ht#,ht#,0); "Hex corrected for darkness in the center"; % \hexe
54 pickup pencircle scaled width1;
55 w:=2good.x .5w;
56 top z1=(0,h); top z2=(.5w,h); top z3=(w,h);
57 bot z4=(0,0); bot z5=(.5w,0); bot z6=(w,0);
58 for k=1 upto 6: drawdot z[k]; endfor
59 z1'=.25[z1,z6]; z6'=.75[z1,z6]; theta1:=angle(z6-z1)+90;
60 z3'=.25[z3,z4]; z4'=.75[z3,z4]; theta3:=angle(z4-z3)+90;
61 z7=z8=.5[z1,z6];
62 penpos1'(width1,theta1); penpos6'(width1,theta1); penpos7(.6width1,theta1);
63 penpos3'(width1,theta3); penpos4'(width1,theta3); penpos8(.6width1,theta3);
64 draw z1..z1'; penstroke z1'e{z6'-z1'}..z7e..{z6'-z1'}z6'e; draw z6'..z6;
65 draw z2..z5;
66 draw z3..z3'; penstroke z3'e{z4'-z3'}..z8e..{z4'-z3'}z4'e; draw z4'..z4;
67 penlabels(1,1',7,2,3,3',8,4,4',5,6,6'); endchar;
68
69 message "Stick A's";
70 b#:=250/36pt#; a#:=150/36pt#; s#:=30/36pt#;
71 standardwidth#:=.4pt#;
72 darkwidth#:=.8pt#; lightwidth#:=.2pt#;
73 define_blacker_pixels(standardwidth,darkwidth,lightwidth);
74 define_pixels(b,a,s);
75 def stick_A(expr alpha)(text pentype)=
76 beginchar (incr(charcode),s#+a#+s#,b#,0);
77 pickup pentype;
78 bot z1=(good.x s,0); z5=z1+(a,0);
79 z3=(1/2[x1,x5],good.y b);
80 z2=alpha[z1,z3]; z4=alpha[z5,z3];
81 draw z1..z3; draw z3..z5; draw z2..z4;
82 drawdot z1; drawdot z5; drawdot z3;
83 labels(1,2,3,4,5); endchar; enddef;
84 charcode:=5; % the first A will be number 6
85
86 stick_A((3-sqrt5)/2, % (area above bar / area below) = golden ratio % \Aa
87 pencircle scaled standardwidth);
88
89 for alpha=.2 step .05 until .5+10epsilon:
90 stick_A(alpha,pencircle scaled standardwidth); endfor % chars 7..13
91
92 beginchar(14,s#+a#+s#,b#,0);
93 pickup pencircle scaled standardwidth;
94 bot z1=(good.x s,0); z5=z1+(a,0);
95 z3=(1/2[x1,x5],good.y b);
96 z4-z2=whatever*dir20; 1/2[y2,y4]=2/3[y3,y1];
97 z2=whatever[z1,z3]; z4=whatever[z3,z5];
98 draw z1..z3; draw z3..z5; draw z2..z4;
99 drawdot z1; drawdot z5; drawdot z3;
100 labels(1,2,3,4,5); endchar;
101
102 stick_A((3-sqrt5)/2,pencircle xscaled darkwidth yscaled lightwidth); % \Ab=15
103 stick_A((3-sqrt5)/2,
104 pencircle xscaled darkwidth yscaled lightwidth rotated 30); % \Ac=16
105
106 message "Kidney beans";
107 standardwidth#:=.4pt#;
108 darkwidth#:=.8pt#; lightwidth#:=.2pt#;
109 define_blacker_pixels(standardwidth,darkwidth,lightwidth);
110 b#:=100/36pt#;
111 define_pixels(b);
112 def bean(text pentype)=
113 beginchar (incr(charcode),2b#,1.5b#,0);
114 pickup pentype;
115 z1=(0,b); z2=(b,b); z3=(2b,b);
116 z4=(0,0); z5=(b,0); z6=(2b,0);
117 draw z5..z4..z1..z3..z6..cycle;
118 labels(1,2,3,4,5,6); endchar; enddef;
119 charcode:=16; % the first bean will be number 17
120
121 bean(pencircle scaled standardwidth); % \beana=17
122 bean(pencircle scaled darkwidth); % \beanb=18
123 bean(pencircle xscaled darkwidth yscaled lightwidth); % \beanc=19
124 bean(pencircle xscaled darkwidth yscaled lightwidth rotated 30); % \beand=20
125
126 message "Pen nibs";
127 bigthickwidth#:=8pt#; littlethickwidth#:=2pt#;
128 define_blacker_pixels(bigthickwidth,littlethickwidth);
129
130 beginchar(21,bigthickwidth#,0,0); % \niba
131 pickup pencircle xscaled bigthickwidth yscaled littlethickwidth;
132 lft z1=(0,good.y 0);
133 drawdot z1;
134 labels(1); endchar;
135
136 beginchar(22,bigthickwidth#,0,0); % \nibb
137 pickup pencircle xscaled bigthickwidth yscaled littlethickwidth rotated 30;
138 lft z1=(0,good.y 0);
139 drawdot z1;
140 labels(1); endchar;
141
142 beginchar(23,littlethickwidth#,0,0); % \nibc
143 pickup pencircle yscaled bigthickwidth xscaled littlethickwidth;
144 lft z1=(0,good.y 0);
145 drawdot z1;
146 labels(1); endchar;
147
148 message "Ionian letters";
149 em#:=10pt#; cap#:=7pt#;
150 thin#:=1/3pt#; thick#:=5/6pt#;
151 slab#:=.8pt#;
152 stem#:=.9pt#;
153 o#:=1/5pt#;
154
155 define_pixels(em,cap);
156 define_blacker_pixels(thin,thick,slab,stem);
157 define_corrected_pixels(o);
158
159 curve_sidebar=round 1/18em;
160
161 %vardef pentaper@#(expr lt,rt) = % dropped from PLAIN
162 % x@#l:=lt[x@#l,x@#]; x@#r:=rt[x@#r,x@#];
163 % y@#l:=lt[y@#l,y@#]; y@#r:=rt[y@#r,y@#] enddef;
164
165
166 % ill-fated example wasn't attractive enough by itself:
167 %bar:=slab;
168 %beginchar(24,0.6em#,cap#,0); % "The letter T"; \IOT=24
169 %penpos1(bar,70);
170 %penpos2(bar,35);
171 %penpos4(bar,35);
172 %penpos5(bar,55);
173 %x1=0; y1r=h; y2r=y4r=.2[y1r,y1]; y5l=.3[y1l,y1];
174 %x2l=1/3[x1l,x5l]; x4l=2/3[x1l,x5l]; x5=w;
175 %penpos6(stem,20); pentaper6(.1,0);
176 %penpos3(x6r-x6l,0);
177 %penpos7(stem,10);
178 %y3=y2; x3=.5w;
179 %x6r=x3r; y6=2/3h;
180 %x7=x6; y7=0;
181 %penstroke z1e{curl infinity}..z2e..z4e..{curl infinity}z5e;
182 %penstroke z3e..z6e{down}..z7e;
183 %labels.top(1r,2l,2,2r,4l,4,4r,6);
184 %labels.lft(1,1l,6l);
185 %labels.rt(5,5r,5l,6r);
186 %labels.bot(3l,3,3r,7,7r,7l);
187 %endchar;
188
189 beginchar(25,5/9em#,cap#,0); % "The letter S"; /IOS=25
190 penpos1(slab,70);
191 penpos2(.5slab,80);
192 penpos3(.5[slab,thick],200);
193 penpos5(.5[slab,thick],210);
194 penpos6(.7slab,80);
195 penpos7(.25[slab,thick],72);
196 x1=x5; y1r=.94h+o;
197 x2=x4=x6=.5w; y2r=h+o; y4=.54h; y6l=-o;
198 x3r=.04em; y3=.5[y4,y2];
199 x5l=w-.03em; y5=.5[y4,y6];
200 .5[x7l,x7]=.04em; y7l=.12h-o;
201 path trial; trial=z3{down}..z4..{down}z5;
202 pair dz; dz=direction 1 of trial;
203 penpos4(thick,angle dz-90);
204 penstroke z1e..z2e{left}..z3e{down}..z4e{dz}..z5e{down}..z6e{left}..z7e;
205 labels.lft(2,3r,5r,6,7);
206 labels.rt(1,3l,4,5l);
207 labels.top(1r,2r,3,4l,5,6r,7r);
208 labels.bot(1l,2l,4r,6l,7l);
209 endchar;
210
211 beginchar(26,0.8em#,cap#,0); % "The letter O"; \IOO=26
212 penpos1(thick,10); penpos2(.1[thin,thick],90-10);
213 penpos3(thick,180+10); penpos4(thin,270-10);
214 x1l=w-x3l=curve_sidebar; x2=x4=.5w;
215 y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
216 penstroke z1e{down}..z2e{right}..z3e{up}..z4e{left}..cycle;
217 penlabels(1,2,3,4); endchar;
218
219 beginchar(27,.35em#,cap#,0); % "The letter I"; \IOI=27
220 penpos1(stem,15); penpos2(.9stem,12); penpos3(stem,10);
221 x1=x2=x3=.5w; y1=h; y2=.55h; y3=0; x2l:=1/6[x2l,x2];
222 penstroke z1e..z2e{down}..z3e;
223 penlabels(1,2,3); endchar;
224
225 %ligtable 24: 24 kern .05em#, 26 kern -.05em#; % TT and TO are adjusted
226
227 message "Cubes and such";
228 s#:=5pt#; define_pixels(s); % side of the square
229 beginchar(28,5/3s#,4/3s#,0); % "Possible cube"; \cubea=28
230 z1=(-epsilon,-epsilon); z2=(s+epsilon,-epsilon);
231 z3=(-epsilon,s+epsilon); z4=(s+epsilon,s+epsilon);
232 for k=1 upto 4: z[k+4]=z[k]+(2/3s,1/3s); endfor
233 pickup pencircle scaled .4pt;
234 draw z5--z6--z8--z7--cycle;
235 pickup pencircle scaled 1.6pt;
236 erase draw z2--z4--z3;
237 pickup pencircle scaled .4pt;
238 draw z1--z2--z4--z3--cycle;
239 for k=1 upto 4: draw z[k]--z[k+4]; endfor
240 labels.top(1,2,5,6);
241 labels.bot(3,4,7,8);
242 endchar;
243
244 beginchar(29,5/3s#,4/3s#,0); % "Impossible cube"; \cubeb=29
245 z1=(-epsilon,-epsilon); z2=(s+epsilon,-epsilon);
246 z3=(-epsilon,s+epsilon); z4=(s+epsilon,s+epsilon);
247 for k=1 upto 4: z[k+4]=z[k]+(2/3s,1/3s); endfor
248 pickup pencircle scaled .4pt;
249 draw z3--z4; draw z5--z6;
250 cullit; pickup pencircle scaled 1.6pt;
251 undraw z7--1/2[z7,z5];
252 undraw z2--1/2[z2,z4];
253 cullit; pickup pencircle scaled .4pt;
254 draw z3--z1--z2--z4;
255 draw z5--z7--z8--z6;
256 for k=1 upto 4: draw z[k]--z[k+4]; endfor
257 labels.top(1,2,5,6);
258 labels.bot(3,4,7,8);
259 endchar;
260
261 beginchar(30,10pt#,7pt#,2pt#); % bicentennial star
262 pair center; center=(.5w,2pt);
263 numeric radius; radius=5pt;
264 for k=0 upto 4: z[k]=center+(radius,0) rotated(90+360/5k); endfor
265 def :: = ..tension 5.. enddef;
266 path star; star=z0::z2::z4::z1::z3::cycle;
267 pickup pencircle scaled .4pt; draw star;
268 cullit; pickup pencircle scaled 1.6pt;
269 for k=0 upto 4: undraw subpath(k+.55,k+.7) of star; endfor
270 cullit; pickup pencircle scaled .4pt;
271 for k=0 upto 4: draw subpath(k+.47,k+.8) of star; endfor
272 labels(0,1,2,3,4); endchar;
273
274 beginchar(31,2/3*11pt#,.5*11pt#,0); % \oneu=31
275 pickup pencircle scaled 3/4pt yscaled 1/3 rotated 30;
276 save ww; ww=3/2w;
277 save t; transform t;
278 t=identity rotatedaround((.5ww,h),-90);
279 x2=.35ww; x3=good.x .6ww;
280 y2=good.y .2h; top y3=round .8h+eps;
281 save p; path p; p=z2{right}...{up}z3;
282 top z1=point .5 of p transformed t;
283 draw (z1...p);
284 labels(1,2,3); endchar;
285
286 beginchar(38,11pt#,11pt#,0); % \fouru=38
287 pickup pencircle scaled 3/4pt yscaled 1/3 rotated 30;
288 save t; transform t;
289 t=identity rotatedaround((.5w,.5h),-90);
290 x2=.35w; x3=good.x .6w;
291 y2=good.y .1h; top y3=round .4h+eps;
292 save p; path p; p=z2{right}...{up}z3;
293 top z1=point .5 of p transformed t;
294 draw (z1...p);
295 addto currentpicture also currentpicture transformed t;
296 addto currentpicture also currentpicture transformed(t transformed t);
297 labels.bot(1,3); labels.rt(2); endchar;
298
299 beginchar(39,11pt#,11pt#,0); % \fourc=39
300 pickup pencircle scaled 3/4pt yscaled 1/3 rotated 30;
301 save t; transform t;
302 t=identity rotatedaround((.5w,.5h),-90);
303 x2=.35w; x3=good.x .6w;
304 y2=good.y .1h; top y3=round .4h+eps;
305 save p; path p; p=z2{right}...{up}z3;
306 top z1=point .5 of p transformed t;
307 draw (z1...p) rotatedaround((.5w,.5h),-45)
308 withpen pencircle scaled 3/4pt yscaled 1/3 rotated-15;
309 addto currentpicture also currentpicture transformed t;
310 addto currentpicture also currentpicture transformed(t transformed t);
311 labels.bot(1,3); labels.rt(2); endchar;
312
313 message "Circle variations";
314
315 beginchar(32,5pt#,5pt#,0); "Quarter circle"; % \circa
316 pickup pencircle scaled (.4pt+blacker);
317 draw quartercircle scaled 10pt; endchar;
318
319 beginchar(33,5pt#,5pt#,0); "Filled quarter circle"; % \circb
320 fill ((0,0)--quartercircle--cycle) scaled 10pt; endchar;
321
322 beginchar(34,5pt#,5pt#,0); "Rotated quarter circle"; % \circc
323 pickup pencircle scaled (.4pt+blacker);
324 draw quartercircle rotated 90 scaled 10pt shifted (5pt,0); endchar;
325
326 beginchar(35,5pt#*sqrt2,5pt#,0); "Cone"; % \circd
327 pickup pencircle scaled (.4pt+blacker);
328 draw ((0,0)--quartercircle--cycle)
329 rotated 45 scaled 10pt shifted (.5w,0); endchar;
330
331 beginchar(36,10pt#,7.5pt#,2.5pt#); "Concentric circles"; % \circe
332 pickup pencircle scaled (.4pt+blacker);
333 for D=.2w,.6w,w:
334 draw fullcircle scaled D shifted (.5w,.5[-d,h]);
335 endfor endchar;
336
337 beginchar(37,10pt#,7.5pt#,2.5pt#); "Concentric diamonds"; % \circf
338 pickup pencircle scaled (.4pt+blacker);
339 for D=.2w,.6w,w:
340 draw unitsquare shifted -(.5,.5) rotated 45
341 scaled (D/sqrt2) shifted (.5w,.5[-d,h]);
342 endfor endchar;
343
344 message "Miscellaneous symbols"; % mostly from the old manfnt
345
346 beginchar(oct"171",15pt#,7.5pt#,2.5pt#); % arrow for errata lists
347 curve#:=30/36pt#; dcurve#:=60/36pt#; bar#:=25/36pt#;
348 define_whole_blacker_pixels(curve,dcurve,bar);
349 penpos1(curve,90); penpos2(curve,90); penpos3(dcurve,90);
350 penpos4(dcurve,90); penpos5(curve,90); penpos6(curve,90);
351 y1r=vround(y1r-(y1-.5[-d,h])); y2=y5=y6=y1=y0; y4l=-d; y3r=h;
352 x1=0; x2=.1w; x3=.2w; x4=.55w; x5=.65w;
353 x2l:=x2l+.25curve; x5r:=x5r-.25curve;
354 penstroke z1e--z2e--z3e--z4e--z5e; % crooked arrow
355 penpos13(bar,0); penpos14(bar,0); x0=w;
356 y13-y0=y0-y14=.24h+eps; x13=x14=7/8w-eps;
357 penpos15(.5bar,angle(z14-z0)); z15l=z0; penpos16(.5bar,angle(z13-z0)); z16l=z0;
358 z19=.381966[.5[z13,z14],z0];
359 numeric t; path p; p=z14l{z19-z14}..z16r;
360 t=xpart(p intersectiontimes((0,y6l)--(w,y6l))); x6=xpart point t of p;
361 filldraw z0..{z14-z19}z14r--subpath (0,t) of\\(z14l{z19-z14}..z16r)
362 --z6l--z5l--z5r--z6r--subpath (t,0) of\\(z13l{z19-z13}..z15r)
363 --z13r{z19-z13}..z0 & cycle; % arrowhead and link
364 penlabels(range 1 thru 19); endchar;
365
366 beginchar(oct"170", 5pt#, 6.25pt#, 0); "Triangle for exercises";
367 x1=x2=w-x3=round .43pt; y3=.5+floor.5h;
368 z1-z2=(z3-z2) rotated 60;
369 y1:=.5sqrt3+round(y1-.5sqrt3); y2:=h-y1;
370 fill z1--z2--z3--cycle;
371 labels(1,2,3); endchar;
372
373 beginchar("6",256/36pt#,250/36pt#,0); % upper triangle for Addison-Wesley logo
374 x1=round 5/36pt; x2=round .5w; x2-x1=x3-x2=(y2-y1)/(sqrt 3);
375 y1=y3=0; fill z1--z2--z3--cycle; labels(1,2,3); endchar;
376
377 beginchar("7",256/36pt#,250/36pt#,0); % lower triangle for Addison-Wesley logo
378 x1=round 5/36pt; x2=round .5w; x2-x1=x3-x2=(y1-y2)/(sqrt 3);
379 y1=y3; y2=0; fill z1--z2--z3--cycle; labels(1,2,3); endchar;
380
381 def font_setup=
382 define_pixels(u,tiny,axis,hheight,border);
383 define_blacker_pixels(hair,thin,thick,rulethickness);
384 pickup if tiny<.5: nullpen else: pencircle scaled tiny fi;
385 tinypen:=savepen;
386 currenttransform:=identity yscaled aspect_ratio slanted slant;
387 enddef;
388
389 % typical cmr10 parameters
390 u#:=20/36pt#;
391 tiny#:=0;
392 axis#:=90/36pt#;
393 hheight#:=250/36pt#;
394 border#:=20/36pt#;
395 hair#:=8/36pt#;
396 thin#:=9/36pt#;
397 thick#:=25/36pt#;
398 fixwidth:=0;
399 slant:=0;
400 rulethickness#:=.4pt#;
401
402 baselinedistance#:=11pt#;
403 heavyline#:=50/36pt#;
404 font_setup;
405 define_whole_pixels(baselinedistance);
406 define_blacker_pixels(heavyline);
407
408 beginchar(127,25u#,hheight#+border#,0); "Dangerous bend sign";
409 pickup pencircle scaled rulethickness;
410 top y1=25/27h; lft x4=0;
411 x1+x1=x1a+x1b=x4b+x2a=x4+x2=x4a+x2b=x3b+x3a=x3+x3=w;
412 x4a=x4b=x4+u; x3b=x1a=x1-2u;
413 y4+y4=y4a+y4b=y3b+y1a=y3+y1=y3a+y1b=y2b+y2a=y2+y2=0;
414 y1a=y1b=y1-2/27h; y4b=y2a=y4+4/27h;
415 draw z1a..z1..z1b---z2a..z2..z2b---
416 z3a..z3..z3b---z4a..z4..z4b---cycle; % signboard
417 x10=x11=x12=x13=good.x(.5w-u); x14=x15=x16=x17=w-x10;
418 y10=y14=28/27h+epsilon; bot y13=-baselinedistance;
419 z11=(z10..z13) intersectionpoint (z1a{z1a-z4b}..z1{right});
420 y15=y11; y16=y12=-y11; y17=y20=y21=y13;
421 draw z11--z10--z14--z15; draw z12--z13; draw z16--z17; % signpost
422 x20=w-x21; x21-x20=16u; draw z20--z21; % ground level
423 x38=w-x31; x38-x31=8u; x32=x34=x38; x31=x35=x37;
424 y31=-y38=12/27h; y32=-y37=9/27h; y34=-y35=3/27h;
425 pickup pencircle scaled heavyline;
426 draw z32{z32-z31}..z34---z35..z37{z38-z37}; % the dangerous bend
427 pickup penrazor xscaled heavyline rotated (angle(z32-z31)+90);
428 draw z31--z32; draw z37--z38; % upper and lower bars
429 labels(1,1a,1b,2,2a,2b,3,3a,3b,4,4a,4b,10,11,12,13,14,15,16,17,20,21,
430 31,32,33,34,35,36,37,38);
431 picture dbend; dbend=currentpicture;
432 endchar;
433 beginchar(126,25u#,hheight#+border#,0); "Lefthanded ditto";
434 currentpicture:=dbend reflectedabout((.5w,0),(.5w,h));
435 endchar;
436 beginchar(0,25u#,hheight#+border#,0); "Reverse video ditto";
437 fill (0,-11pt)--(w,-11pt)--(w,h)--(0,h)--cycle;
438 addto currentpicture also -dbend;
439 endchar;
440
441 beginchar(oct"140",3.75pt#,7pt#,4/3pt#); "special 1/7 for a quotation";
442 currenttransform:=currenttransform slanted(2/7/aspect_ratio);
443 y3=y4=.5[h,-d]=.5[y2,y5]; y5=y6;
444 x1=x2=x7=.5w; x5+x6=x3+x4=w; x5=x3+1/6pt;
445 pickup pencircle xscaled .5pt yscaled .35pt;
446 bot y2=top y3+pt; top y1=h; bot y7=-d; lft x3=0; % y2 moved up 1/3pt (Feb 5)
447 draw z1..z2; draw z3..z4;
448 draw z5--z6..{down}z7;
449 labels(1,2,3,4,5,6,7);
450 endchar;
451 currenttransform:=currenttransform slanted(-2/7/aspect_ratio);
452
453 % Circumscribed circles
454 pickup pencircle scaled(.4pt+blacker); rpen:=savepen;
455 def begincircle(expr code,units,depth,asp,superness)=
456 beginchar(code,units*20/36pt#,0,0); pickup rpen;
457 aa:=.5(w++depth*pt/asp);
458 x2=x4=.5[x1,x3]=.5w; y1=y3=.5[y2,y4]=-.5round(depth*pt);
459 x1=good.x(x2+aa); y2=good.y(y1+asp*aa);
460 draw superellipse(z1,z2,z3,z4,superness); labels(1,2,3,4) enddef;
461
462 "Ellipse for floating-point mod operator"; % also for pseudo coin top
463 begincircle(oct"130",29,5,.5,.75786); endchar;
464
465 "Edge and bottom of pseudo coin";
466 begincircle(oct"133",29,5,.5,.75786); charht:=2pt#;
467 erase fill rt z1--(rt x1,top y2)--(lft x3,top y2)--lft z3--cycle;
468 x0=x1; x5=x3; y0=y5=y1+2pt; draw z0--z1; draw z3--z5; labels(0,5); endchar;
469
470 "Circle to enclose two digits";
471 begincircle(oct"131",19,7.5,1,.75786); endchar;
472
473 "Circle to enclose an exponent of 2";
474 begincircle(oct"132",9,6,1,1/sqrt2); endchar;
475
476 % Now we do the \qc font from TeXbook Appendix D
477 pickup pencircle scaled ceiling pt; ptpen:=savepen;
478
479 beginchar("a",10pt#,5.5pt#,4.5pt#); pickup ptpen; % W to S
480 bot y1=lft x2=0; x2=.5[x1,x1+w]; y1=.5[y2,y2+h+d];
481 draw z1{right}..{down}z2; labels(1,2); endchar;
482
483 beginchar("b",10pt#,5.5pt#,4.5pt#); pickup ptpen; % W to N
484 bot y1=lft x2=0; x2=.5[x1,x1+w]; y1=.5[y2,y2-h-d];
485 draw z1{right}..{up}z2; labels(1,2); endchar;
486
487 beginchar("c",10pt#,5.5pt#,4.5pt#); pickup ptpen; % E to N
488 bot y1=lft x2=0; x2=.5[x1,x1-w]; y1=.5[y2,y2-h-d];
489 draw z1{left}..{up}z2; labels(1,2); endchar;
490
491 beginchar("d",10pt#,5.5pt#,4.5pt#); pickup ptpen; % E to S
492 bot y1=lft x2=0; x2=.5[x1,x1-w]; y1=.5[y2,y2+h+d];
493 draw z1{left}..{down}z2; labels(1,2); endchar;
494
495 fontdimen 8: pt#; % rule thickness in \qc
496
497 message "METAFONT logo";
498
499 def arc(suffix i,j) =
500 (z.i{0,y.j-y.i}..
501 (beta[x.i,x.j],beta[y.j,y.i]){z.j-z.i}..
502 z.j{x.j-x.i,0}) enddef;
503
504 def double_arc(suffix i,j,k) =
505 arc(i,j) & reverse arc(k,j) enddef;
506
507 alpha:=.45; % controls bar location and similar things
508 beta:=.2; % controls squareness of bowls
509
510 def setparameters(text parameter_equations) =
511 string code.M,code.E,code.T,code.A,code.F,code.O,code.N;
512 numeric h#, xx#, yy#, o#, s#, u#, px#, py#;
513 numeric leftstemloc, barheight;
514 parameter_equations;
515 yy#=(h#/13.5u#)*xx#; define_whole_pixels(xx,yy);
516 define_pixels(s,u);
517 define_corrected_pixels(o);
518 py#=.9px#; define_blacker_pixels(px,py);
519 pickup pencircle xscaled px yscaled py;
520 logo_pen:=savepen;
521 leftstemloc:=good.x((2.5u#+s#)*pt);
522 barheight:=good.y(alpha*h#*pt);
523 ligtable code.T: code.A kern -.5u#;
524 ligtable code.F: code.O kern -u#;
525 enddef;
526
527 def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
528 beginchar(code.c,n*u#+2s#,h#,0); pickup logo_pen enddef;
529
530 def do_it =
531 beginlogochar(M,18);
532 x1=x2=leftstemloc; x4=x5=w-x1; x3=w-x3;
533 y1=y5; y2=y4; bot.y1=-o; top y2=h+o; y3=y1+yy;
534 draw z1--z2--z3--z4--z5;
535 labels(1,2,3,4,5);
536 endchar;
537
538 beginlogochar(E,14);
539 x1=x2=x3=leftstemloc; x4=x6=w-x1+o; x5=x4-xx;
540 y1=y6; y2=y5; y3=y4; bot.y1=0; top.y3=h; y2=barheight;
541 draw z6--z1--z3--z4; draw z2..z5;
542 labels(1,2,3,4,5,6);
543 endchar;
544
545 beginlogochar(T,13);
546 italcorr h#*slant+.5u#;
547 if odd(w-px): w:=w+1; fi % allows a symmetric stem
548 lft x1=-epsilon; x2=w-x1; x3=x4=.5w; % I tried lft x1=s-o; not as good
549 y1=y2=y3; top.y1=h; bot.y4=-o;
550 draw z1..z2; draw z3..z4;
551 labels(1,2,3,4);
552 endchar;
553
554 beginlogochar(A,15); % changed from 16 on Oct 16!
555 x1+x4=x2+x3=2x5=w; x1=x2=leftstemloc;
556 y1=y4; y2=y3; bot.y1=-o; top.y5=h+o; y2=barheight;
557 draw double_arc(2,5,3); draw z1--z2--z3--z4;
558 labels(1,2,3,4,5);
559 endchar;
560
561 beginlogochar(F,14);
562 x1=x2=x3=leftstemloc; x4=w-x1+o; x5=x4-xx;
563 y2=y5; y3=y4; bot.y1=-o; top.y3=h; y2=barheight;
564 draw z1--z3--z4; draw z2..z5;
565 labels(1,2,3,4,5);
566 endchar;
567
568 beginlogochar(O,15);
569 x1+x2=x3+x4=w; x1=good.x(1.5u+s); x3=x4;
570 bot.y3=-o; top.y4=h+o; y1=y2=barheight;
571 draw double_arc(1,4,2); draw double_arc(2,3,1);
572 labels(1,2,3,4);
573 endchar;
574
575 beginlogochar(N,15);
576 x1+x4=x1+x3=x2+x5=w; x1=x2=leftstemloc;
577 y1=y4=y3-yy; bot.y1=-o; y2=y5; top.y5=h+o;
578 draw z1--z2--z3; draw z4..z5;
579 labels(1,2,3,4,5);
580 endchar;
581 enddef; % the end of "do_it"
582
583 % ten-point size
584 message " ten point";
585 setparameters(h#=6; % height of characters, in pt
586 slant:=0;
587 xx#=0.6; % extra length of certain features, in pt
588 u#=4/9; % unit width, in pt
589 s#=0; % extra sidebar, in pt
590 o#=1/9; % overshoot of curves, in pt
591 px#=2/3; % horizontal thickness of pen, in pt
592 code.M="M"; code.E="E"; code.T="T"; code.A="A";
593 code.F="F"; code.O="O"; code.N="N")
594 do_it;
595
596 currenttransform:=currenttransform slanted(.25/aspect_ratio);
597 % ten-point size, slanted: 89:;<=>: = METAFONT!
598 message " slanted ten point";
599 setparameters(h#=6; % height of characters, in pt
600 slant:=.25;
601 xx#=0.6; % extra length of certain features, in pt
602 u#=4/9; % unit width, in pt
603 s#=0; % extra sidebar, in pt
604 o#=1/9; % overshoot of curves, in pt
605 px#=2/3; % horizontal thickness of pen, in pt
606 code.M="8"; code.E="9"; code.T=":"; code.A=";";
607 code.F="<"; code.O="="; code.N=">")
608 do_it;
609 currenttransform:=currenttransform slanted(-.25/aspect_ratio);
610
611 % nine-point size: hijklmnj = METAFONT!
612 message " nine point";
613 setparameters(h#=.9*6; % height of characters, in pt
614 slant:=0;
615 xx#=.9*0.6; % extra length of certain features, in pt
616 u#=.91*4/9; % unit width, in pt
617 s#=.08; % extra sidebar, in pt
618 o#=1/10; % overshoot of curves, in pt
619 px#=.9*2/3; % horizontal thickness of pen, in pt
620 code.M="h"; code.E="i"; code.T="j"; code.A="k";
621 code.F="l"; code.O="m"; code.N="n")
622 do_it;
623 font_quad 18u#+2s#; % we take spacing from the 9-point logo font
624 font_normal_space 6u#+2s#;
625 font_normal_stretch 3u#;
626 font_normal_shrink 2u#;
627
628 % eight-point size: opqrstuq = METAFONT!
629 message " eight point";
630 setparameters(h#=.8*6; % height of characters, in pt
631 slant:=0;
632 xx#=.8*0.6; % extra length of certain features, in pt
633 u#=.82*4/9; % unit width, in pt
634 s#=.2; % extra sidebar, in pt
635 o#=1/12; % overshoot of curves, in pt
636 px#=.8*2/3; % horizontal thickness of pen, in pt
637 code.M="o"; code.E="p"; code.T="q"; code.A="r";
638 code.F="s"; code.O="t"; code.N="u")
639 do_it;
640
641 % eight-point size, magnified 10/8: /0123451 = METAFONT!
642 message " magnified eight point";
643 setparameters(h#=.8*6*10/8; % height of characters, in pt
644 slant:=0;
645 xx#=.8*0.6*10/8; % extra length of certain features, in pt
646 u#=.82*4/9*10/8; % unit width, in pt
647 s#=.2*10/8; % extra sidebar, in pt
648 o#=1/12*10/8; % overshoot of curves, in pt
649 px#=.8*2/3*10/8; % horizontal thickness of pen, in pt
650 code.M="/"; code.E="0"; code.T="1"; code.A="2";
651 code.F="3"; code.O="4"; code.N="5")
652 do_it;
653
654 currenttransform:=currenttransform slanted(2/7/aspect_ratio);
655 % eight-point size, slanted: \]^_efg^ = METAFONT!
656 message " slanted eight point";
657 slant:=2/7;
658 setparameters(h#=.8*6; % height of characters, in pt
659 xx#=.8*0.6; % extra length of certain features, in pt
660 u#=.82*4/9; % unit width, in pt
661 s#=.2; % extra sidebar, in pt
662 o#=1/12; % overshoot of curves, in pt
663 px#=.8*2/3; % horizontal thickness of pen, in pt
664 code.M="\"; code.E="]"; code.T="^"; code.A="_";
665 code.F="e"; code.O="f"; code.N="g")
666 do_it;
667 currenttransform:=currenttransform slanted(-2/7/aspect_ratio);
668
669 % special size for the title page: ()*+,-.* = METAFONT!
670 message " title page size";
671 setparameters(h#=250/9; % height of characters, in pt (same as cmssc40)
672 slant:=0;
673 xx#=2.9; % extra length of certain features, in pt
674 u#=(1+sqrt5)/2; % unit width, in pt
675 s#=.2; % extra sidebar, in pt
676 o#=4/9; % overshoot of curves, in pt
677 px#=4; % horizontal thickness of pen, in pt
678 code.M="("; code.E=")"; code.T="*"; code.A="+";
679 code.F=","; code.O="-"; code.N=".")
680 do_it;
681
682 currenttransform:=currenttransform slanted(-1/9/aspect_ratio);
683 % backslanted skinny bold: BCDGHIJD = METAFONT!
684 message " weird skinny bold condensed";
685 setparameters(h#=25; % height of characters, in pt
686 slant:=-1/9; % leftward bias
687 xx#=1.5; % extra length of certain features, in pt
688 u#=3/9; % unit width, in pt
689 s#=1/3; % extra sidebar, in pt
690 o#=2/9; % overshoot of curves, in pt
691 px#=1; % horizontal thickness of pen, in pt
692 code.M="B"; code.E="C"; code.T="D"; code.A="G";
693 code.F="H"; code.O="I"; code.N="J")
694 do_it;
695 currenttransform:=currenttransform slanted(+1/9/aspect_ratio);
696
697 % ultrawide light: KLUVWvwU = METAFONT!
698 message " weird light extended";
699 setparameters(h#=6; % height of characters, in pt
700 slant:=0;
701 xx#=2; % extra length of certain features, in pt
702 u#=4/3; % unit width, in pt
703 s#=-2/3; % extra sidebar, in pt
704 o#=1/9; % overshoot of curves, in pt
705 px#=1/3; % horizontal thickness of pen, in pt
706 code.M="K"; code.E="L"; code.T="U"; code.A="V";
707 code.F="W"; code.O="v"; code.N="w")
708 do_it;
709
710 message "Pixel symbols";
711
712 beginchar("P",722.7/722.909pt#,722.7/722.909pt#,0); % 1pt pixel
713 pickup pencircle scaled .2pt;
714 top lft z1=(0,.8h); top rt z2=(.8w,.8h);
715 bot lft z3=(0,0); bot rt z4=(.8w,0);
716 draw z1--z4; draw z2--z3; endchar;
717
718 beginchar("Q",722.7/722.909pt#,722.7/722.909pt#,0); % 1pt nonpixel
719 pickup pencircle scaled .2pt;
720 drawdot(.4w,.4h); endchar;
721
722 beginchar("R",3*722.7/722.909pt#,3*722.7/722.909pt#,0); % 3pt pixel
723 pickup pencircle scaled .3pt;
724 interim autorounding:=0;
725 top lft z1=(0,.9h); top z2=(.45w,.9h); top rt z3=(.9w,.9h);
726 lft z4=(0,.45h); rt z5=(.9w,.45h);
727 bot lft z6=(0,0); bot z7=(.45w,0); bot rt z8=(.9w,0);
728 draw z1+(-50epsilon,50epsilon)--z8+(50epsilon,-50epsilon);
729 draw z2+(0,50epsilon)--z7-(0,50epsilon);
730 draw z3+(50epsilon,50epsilon)--z6-(50epsilon,50epsilon);
731 draw z4-(50epsilon,0)--z5+(50epsilon,0); endchar;
732
733 beginchar("S",3*722.7/722.909pt#,3*722.7/722.909pt#,0); % 3pt nonpixel
734 pickup pencircle scaled .3pt;
735 drawdot(.45w,.45h); endchar;
736
737 message "Gothic d";
738
739 beginchar("?",4pt#,8pt#,0);
740 % taken from NB, but my changes may have spoiled it
741 stem_length#:=10/6.7pt#; define_blacker_pixels(stem_length);
742 xheight:=6pt;
743 penpos1 (2*stem_length,30); % normal points
744 penpos2 (2*stem_length,30); % normal points
745 penpos3 (2*stem_length,30); % normal points
746 penpos4 (2*stem_length,30); % normal points
747
748 x1l=x2=0; y1r=xheight; y2l=0;
749 penpos40(stem_length,30); z40r=round z1;
750 penpos41(stem_length,40); x40r=x41r=x42r; y41=.5[y40,y42];
751 penpos42(stem_length,30); y42l=y2;
752 fill z40r--(x40r,y42l)--z42l...z41l{up}...z40l--cycle; % left stem
753
754 x3=x4r=w; y3=y1; y4=y2;
755 penpos50(stem_length,30); z50l=round z3l;
756 penpos51(stem_length,40); x50l=x51l=x52l; y51=.5[y50,y52];
757 penpos52(stem_length,30); y52l=y4;
758 fill z52l--(x52l,y50r)--z50r...z51r{down}...z52r--cycle; % right stem
759
760 penpos10(stem_length,30); z10=z42;
761 penpos11(stem_length,25); x11=.5[x10,x12]; y10l=y11=y12r;
762 penpos12(stem_length,30); x12r=x4; % redundant: y12l=0;
763 penpos14(stem_length*(1+cosd30),30); z14l=z12l;
764 penpos15(.07stem_length,120); z15l=z14r;
765 fill z10l...z11l{z12-z10}...z12l--z14r
766 --z15r{z14l-z14r}...z11r{z10-z12}...z10r--cycle; % lower join
767
768 numeric ch; ch=10; % Neenie's version was more like ch=7.5 (steeper)
769 numeric s_length[];
770 s_length0*cosd(30-ch)=stem_length*cosd 30;
771 s_length1*cosd(40-ch)=stem_length*cosd 40;
772 pair corner; corner=z50r;
773 vardef f(expr theta)=
774 save x,y; penpos60(s_length0,theta); y60r=h; x60l=0;
775 angle(z60r-corner)<theta+60+ch enddef;
776 numeric theta; theta=solve f(90,0);
777 penpos60(s_length0,theta); y60r=h; x60l=0;
778 penpos61(s_length1,theta+10); z61l=.5[z60l,z62l];
779 penpos62(s_length0,theta); z62r=corner;
780 fill z60l--((z60l--z62l)intersectionpoint((x4,0)--(x4,h)))
781 --z62r...z61r{z60-z62}...z60r--cycle; % diagonal
782
783 charwd:=charwd+1.03277pt#; w:= w + round(1.03277pt);
784 penlabels(1,2,3,4,10,11,12,13,14,15,40,41,42,50,51,52,60,61,62);
785 interim xoffset:=.46687pt; interim yoffset:=-.3pt;
786 endchar;
787
788 bye