home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-bin5.lha / lib / texmf / fonts / public / manual / src / mfman.mf < prev   
Text File  |  1996-10-12  |  73KB  |  2,475 lines

  1. % This file generates most of the figures for The METAFONTbook
  2.  
  3. def clear_all = clearit; clearxy; pickup standardpen;
  4. proofrulethickness 0;
  5. enddef;
  6.  
  7. def heavy_dot expr z =
  8.  makelabel.top("",z-(1,0));
  9.  makelabel.top("",z+(1,0));
  10.  makelabel.top("",z-(0,1));
  11.  makelabel.top("",z+(0,1));
  12.  makelabel.top("",z+(1,1)/sqrt2);
  13.  makelabel.top("",z+(1,-1)/sqrt2);
  14.  makelabel.top("",z-(1,1)/sqrt2);
  15.  makelabel.top("",z-(1,-1)/sqrt2);
  16.  enddef;
  17.  
  18. def font_setup=
  19. define_pixels(u,tiny,axis,hheight,border);
  20. define_blacker_pixels(hair,thin,thick,rulethickness);
  21. pickup if tiny<.5: nullpen else: pencircle scaled tiny fi;
  22. tinypen:=savepen;
  23. currenttransform:=identity slanted slant yscaled aspect_ratio;
  24. enddef;
  25.  
  26. mode=proof; mode_setup;
  27. standardpen=savepen;
  28.  
  29. "Figure 2a"; % 6 points and a grid
  30. clear_all;
  31. pair offset; offset=(.5,.5);
  32. z1=(0,100)+offset;
  33. z2=(100,100)+offset;
  34. z3=(200,100)+offset;
  35. z4=(0,0)+offset;
  36. z5=(100,0)+offset;
  37. z6=(200,0)+offset;
  38. proofrulethickness .8;
  39. proofrule (z1+(0,5),z4-(0,5)); proofrule (z4-(5,0),z6+(5,0));
  40. makelabel.top("1 ",z1);
  41. makelabel.top("2 ",z2);
  42. makelabel.top("3 ",z3);
  43. makelabel.bot("4 ",z4);
  44. makelabel.bot("5 ",z5);
  45. makelabel.bot("6 ",z6);
  46. for k=1 upto 6: heavy_dot z[k]; endfor;
  47. pickup pencircle;
  48. for x=10 step 10 until 200: draw (x,-5)+offset..(x,105)+offset; endfor
  49. for y=10 step 10 until 100: draw (-5,y)+offset..(205,y)+offset; endfor
  50. showit;
  51. shipit;
  52.  
  53. "Figure A2a"; % 6 points and a grid and two more points
  54. clear_all;
  55. proofoffset(30,0);
  56. pair offset; offset=(.5,.5);
  57. z1=(0,100)+offset;
  58. z2=(100,100)+offset;
  59. z3=(200,100)+offset;
  60. z4=(0,0)+offset;
  61. z5=(100,0)+offset;
  62. z6=(200,0)+offset;
  63. proofrulethickness .8;
  64. proofrule (z1+(0,5),z4-(0,5)); proofrule (z4-(5,0),z6+(5,0));
  65. makelabel.top("1 ",z1);
  66. makelabel.top("2 ",z2);
  67. makelabel.top("3 ",z3);
  68. makelabel.bot("4 ",z4);
  69. makelabel.bot("5 ",z5);
  70. makelabel.bot("6 ",z6);
  71. for k=1 upto 6: heavy_dot z[k]; endfor;
  72. makelabel.lft("(-5,15)",(-5,15)+offset);
  73. makelabel.top("(60,30) ",(60,30)+offset);
  74. %makelabel.top("   ,30) ",(60,30)+offset);
  75. %makelabel.top("(60    ",(60,30)+offset);
  76. heavy_dot (-5,15)+offset;
  77. heavy_dot (60,30)+offset;
  78. pickup pencircle;
  79. for x=10 step 10 until 200: draw (x,-5)+offset..(x,105)+offset; endfor
  80. for y=10 step 10 until 100: draw (-5,y)+offset..(205,y)+offset; endfor
  81. showit;
  82. shipit;
  83.  
  84. "Figure 2b"; % 6 points and a line
  85. clear_all;
  86. z1=(0,100);
  87. z2=(100,100);
  88. z3=(200,100);
  89. z4=(0,0);
  90. z5=(100,0);
  91. z6=(200,0);
  92. draw (x1-epsilon,y1)..(x6,y6);
  93. makelabel.lft("1 ",z1);
  94. makelabel.lft("2",z2);
  95. makelabel.rt("3",z3);
  96. makelabel.lft("4",z4);
  97. makelabel.lft("5",z5);
  98. makelabel.rt(" 6",z6);
  99. showit;
  100. shipit;
  101.  
  102. "Figure 2c"; % 6 points and three lines (hex symbol, version 1)
  103. clear_all;
  104. z1=(0,100);
  105. z2=(100,100);
  106. z3=(200,100);
  107. z4=(0,0);
  108. z5=(100,0);
  109. z6=(200,0);
  110. draw z1..z6; draw z2..z5; draw z3..z4;
  111. for k=1 upto 6: drawdot z[k]; endfor
  112. makelabel.lft("1 ",z1);
  113. makelabel.lft("2 ",z2);
  114. makelabel.rt(" 3",z3);
  115. makelabel.lft("4 ",z4);
  116. makelabel.lft("5 ",z5);
  117. makelabel.rt(" 6",z6);
  118. showit;
  119. shipit;
  120.  
  121. "Figure 2d"; % hex symbols with top and bottom adjusted
  122. clear_all;
  123. top z1=(0,100);
  124. top z2=(100,100);
  125. top z3=(200,100);
  126. bot z4=(0,0);
  127. bot z5=(100,0);
  128. bot z6=(200,0);
  129. draw z1..z6; draw z2..z5; draw z3..z4;
  130. for k=1 upto 6: drawdot z[k]; endfor
  131. makelabel.lft("1 ",z1);
  132. makelabel.lft("2 ",z2);
  133. makelabel.rt(" 3",z3);
  134. makelabel.lft("4 ",z4);
  135. makelabel.lft("5 ",z5);
  136. makelabel.rt(" 6",z6);
  137. showit;
  138. clearxy; pair offset; offset=(250,0);
  139. pickup pencircle scaled .6pt;
  140. top z1=(0,100)+offset;
  141. top z2=(100,100)+offset;
  142. top z3=(200,100)+offset;
  143. bot z4=(0,0)+offset;
  144. bot z5=(100,0)+offset;
  145. bot z6=(200,0)+offset;
  146. draw z1..z6; draw z2..z5; draw z3..z4;
  147. for k=1 upto 6: drawdot z[k]; endfor
  148. makelabel.lft("1 ",z1);
  149. makelabel.lft("2 ",z2);
  150. makelabel.rt(" 3",z3);
  151. makelabel.lft("4 ",z4);
  152. makelabel.lft("5 ",z5);
  153. makelabel.rt(" 6",z6);
  154. proofrule ((-5,100),(210,100)+offset);
  155. proofrule ((-5,0),(210,0)+offset);
  156. showit;
  157. shipit;
  158.  
  159. "Figure 2e"; % stick-letter A
  160. b#:=250/36pt#; a#:=150/36pt#; s#:=30/36pt#;
  161. define_pixels(b,a,s);
  162. def A(expr alpha)=
  163. beginchar (incr(charcode),s#+a#+s#,b#,0);
  164. pickup standardpen;
  165. bot z1=(good.x s,0); z5=z1+(a,0);
  166. z3=(1/2[x1,x5],good.y b);
  167. z2=alpha[z1,z3]; z4=alpha[z5,z3];
  168. draw z1..z3; draw z3..z5; draw z2..z4;
  169. drawdot z1; drawdot z5; drawdot z3;
  170. makelabel.lft("1 ",z1);
  171. makelabel.lft("2 ",z2);
  172. makelabel.top("3   ",z3);
  173. makelabel.rt(" 4",z4);
  174. makelabel.rt(" 5",z5);
  175. endchar; enddef;
  176.  
  177. A((3-sqrt5)/2); % (area above bar / area below) = golden ratio
  178.  
  179. "Figure 3a"; % 4 points and 3 midpoints
  180. clear_all;
  181. z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
  182. z12=1/2[z1,z2]; z23=1/2[z2,z3]; z34=1/2[z3,z4];
  183. pickup pencircle;
  184. draw z1--z2--z3--z4;
  185. heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
  186. makelabel.lft("1",z1);
  187. makelabel.lft("2",z2);
  188. makelabel.top(" 3",z3);
  189. makelabel.rt("4",z4);
  190. makelabel.rt("12",z12);
  191. makelabel.bot(" 23",z23);
  192. makelabel.bot("34 ",z34);
  193. showit;
  194. shipit;
  195.  
  196. "Figure 3b"; % 4 points and 6 midpoints
  197. clear_all;
  198. z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
  199. z12=1/2[z1,z2]; z23=1/2[z2,z3]; z34=1/2[z3,z4];
  200. z123=1/2[z12,z23]; z234=1/2[z23,z34]; z1234=1/2[z123,z234];
  201. heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
  202. pickup pencircle;
  203. draw z1--z2--z3--z4; draw z12--z23--z34; draw z123--z234;
  204. makelabel.lft("1",z1);
  205. makelabel.lft("2",z2);
  206. makelabel.top(" 3",z3);
  207. makelabel.rt("4",z4);
  208. makelabel.lft("12",z12);
  209. makelabel.top("23 ",z23);
  210. makelabel.rt("34",z34);
  211. makelabel.bot("  123",z123);
  212. makelabel.bot("234  ",z234);
  213. makelabel.bot("1234",z1234);
  214. showit;
  215. shipit;
  216.  
  217. "Figure 3c"; % 4 points and infinitely many midpoints
  218. clear_all;
  219. z1=(.5,.5); z2=(40.5,80.5); z3=(150.5,100.5); z4=(300.5,.5);
  220. heavy_dot z1; heavy_dot z2; heavy_dot z3; heavy_dot z4;
  221. pickup pencircle;
  222.  
  223. def makedot(expr x)= special " 1";
  224.  numspecial xpart x; numspecial ypart x enddef;
  225.  
  226. def recurse(expr a,b,c,d)=
  227. dist:=abs(a-d);
  228. if dist>4:
  229. begingroup save e,f,g,h,i,j; pair e,f,g,h,i,j;
  230. e=(a+b)/2; makedot(e);
  231. f=(b+c)/2; makedot(f);
  232. g=(c+d)/2; makedot(g);
  233. h=(e+f)/2; makedot(h);
  234. i=(f+g)/2; makedot(i);
  235. j=(h+i)/2; makedot(j);
  236. if dist>20: draw a--b--c--d; draw e--f--g; draw h--i; fi
  237. recurse(a,e,h,j); recurse(j,i,g,d);
  238. endgroup;
  239. fi enddef;
  240.  
  241. makedot(z1); makedot(z2); makedot(z3); makedot(z4); recurse(z1,z2,z3,z4);
  242. shipit;
  243.  
  244. "Figure 3d"; % 4 points and various cubics
  245. clear_all;
  246. z1=(0,0); z2=5/6(40,80); z3=5/6(150,100); z4=5/6(300,0);
  247. draw z1..controls z2 and z3..z4;
  248. drawdot z1; drawdot z4;
  249. makelabel.lft("1 ",z1);
  250. makelabel.lft("2",z2);
  251. makelabel.rt("3",z3);
  252. makelabel.rt(" 4",z4);
  253. pair offset; offset:=(325,0);
  254. draw (z1..controls z3 and z2..z4) shifted offset;
  255. drawdot z1+offset; drawdot z4+offset;
  256. makelabel.lft("1 ",z1+offset);
  257. makelabel.lft("3",z2+offset);
  258. makelabel.rt("2",z3+offset);
  259. makelabel.rt(" 4",z4+offset);
  260. offset:=(0,-100);
  261. draw (z2..controls z1 and z3..z4) shifted offset;
  262. drawdot z2+offset; drawdot z4+offset;
  263. makelabel.lft("2",z1+offset);
  264. makelabel.lft("1 ",z2+offset);
  265. makelabel.rt("3",z3+offset);
  266. makelabel.rt(" 4",z4+offset);
  267. offset:=(325,-100);
  268. draw (z1..controls z4 and z2..z3) shifted offset;
  269. drawdot z1+offset; drawdot z3+offset;
  270. makelabel.lft("1 ",z1+offset);
  271. makelabel.lft("3",z2+offset);
  272. makelabel.rt(" 4",z3+offset);
  273. makelabel.rt("2",z4+offset);
  274. showit;
  275. shipit;
  276.  
  277. "Figure 3e"; % example curves with automatic control points
  278. clear_all;
  279. z1=(0,100); z2=(100,100); z3=(200,100);
  280. z4=(0,0); z5=(100,0); z6=(200,0);
  281. path p; p=z4..z1..z2..z6;
  282. draw p;
  283. drawdot z4; drawdot z6;
  284. makelabel.bot.nodot("    1",z1);
  285. makelabel.top.nodot("    2",z2);
  286. makelabel.rt.nodot("3",z3+(2,0));
  287. makelabel.rt.nodot(" 4",z4);
  288. makelabel.rt.nodot("5",z5+(2,0));
  289. makelabel.rt.nodot(" 6",z6);
  290. for k=1 upto 6: heavy_dot z[k]; endfor;
  291. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  292.  heavy_dot precontrol k of p; endfor
  293. pair offset; offset=(325,0);
  294. p:=(z5..z4..z1..z3..z6..z5) shifted offset; draw p;
  295. drawdot z5+offset;
  296. makelabel.bot.nodot("   1",z1+offset);
  297. makelabel.top.nodot("2",z2+offset+(0,2));
  298. makelabel.bot.nodot("3   ",z3+offset);
  299. makelabel.top.nodot("   4",z4+offset);
  300. makelabel.top.nodot("5",z5+offset+(0,5));
  301. makelabel.top.nodot("6   ",z6+offset);
  302. for k=1 upto 6: heavy_dot z[k]+offset; endfor;
  303. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  304.  heavy_dot precontrol k of p; endfor
  305. showit;
  306. shipit;
  307.  
  308. "Figure 3f"; % bean shape with automatic control points
  309. clear_all;
  310. z1=(0,100); z2=(100,100); z3=(200,100);
  311. z4=(0,0); z5=(100,0); z6=(200,0);
  312. path p; p=z5..z4..z1..z3..z6..cycle;
  313. draw p;
  314. makelabel.bot.nodot("   1",z1);
  315. makelabel.bot.nodot("2",z2-(0,2));
  316. makelabel.bot.nodot("3   ",z3);
  317. makelabel.top.nodot("   4",z4+(-1,1));
  318. makelabel.top.nodot("5",z5+(0,5));
  319. makelabel.top.nodot("6   ",z6+(1,1));
  320. for k=1 upto 6: heavy_dot z[k]; endfor;
  321. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  322.  heavy_dot precontrol k of p; endfor
  323. showit;
  324. shipit;
  325.  
  326. "Figure 3g"; % bean shape with more tension between 1 and 3
  327. clear_all;
  328. z1=(0,100); z2=(100,100); z3=(200,100);
  329. z4=(0,0); z5=(100,0); z6=(200,0);
  330. path p; p=z5..z4..z1..tension1.2..z3..z6..cycle;
  331. draw p;
  332. makelabel.bot.nodot("   1",z1);
  333. makelabel.bot.nodot("2",z2-(0,2));
  334. makelabel.bot.nodot("3   ",z3);
  335. makelabel.top.nodot("   4",z4+(-1,1));
  336. makelabel.top.nodot("5",z5+(0,5));
  337. makelabel.top.nodot("6   ",z6+(1,1));
  338. for k=1 upto 6: heavy_dot z[k]; endfor;
  339. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  340.  heavy_dot precontrol k of p; endfor
  341. showit;
  342. shipit;
  343.  
  344. "Figure 3h"; % bean shape with more tension before and after 1
  345. clear_all;
  346. z1=(0,100); z2=(100,100); z3=(200,100);
  347. z4=(0,0); z5=(100,0); z6=(200,0);
  348. path p; p=z5..z4..tension 1 and 1.5..z1..tension 1.5 and 1..z3..z6..cycle;
  349. draw p;
  350. makelabel.bot.nodot("   1",z1);
  351. makelabel.bot.nodot("2",z2-(0,2));
  352. makelabel.bot.nodot("3   ",z3);
  353. makelabel.top.nodot("   4",z4+(-1,1));
  354. makelabel.top.nodot("5",z5+(0,5));
  355. makelabel.top.nodot("6   ",z6+(1,1));
  356. for k=1 upto 6: heavy_dot z[k]; endfor;
  357. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  358.  heavy_dot precontrol k of p; endfor
  359. showit;
  360. shipit;
  361.  
  362. "Figure 3i"; % bean shape with straight bottom
  363. clear_all;
  364. z1=(0,100); z2=(100,100); z3=(200,100);
  365. z4=(0,0); z5=(100,0); z6=(200,0);
  366. path p; p=z5..z4{left}..z1..z3..z6{left}..cycle;
  367. draw p;
  368. makelabel.bot.nodot("   1",z1-(1,1));
  369. makelabel.bot.nodot("2",z2-(0,2));
  370. makelabel.bot.nodot("3   ",z3+(1,-1));
  371. makelabel.top.nodot(" 4",z4+(0,5));
  372. makelabel.top.nodot("5",z5+(0,5));
  373. makelabel.top.nodot("6 ",z6+(0,5));
  374. for k=1 upto 6: heavy_dot z[k]; endfor;
  375. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  376.  heavy_dot precontrol k of p; endfor
  377. showit;
  378. shipit;
  379.  
  380. "Figure 3j"; % example with direction specified
  381. clear_all;
  382. z1=(0,100); z2=(100,100); z3=(200,100);
  383. z4=(0,0); z5=(100,0); z6=(200,0);
  384. path p; p=z4..z2{z3-z4}..z3;
  385. draw p;
  386. makelabel.rt.nodot("1",z1+(0,-9));
  387. makelabel.rt.nodot("2",z2+(1,-11));
  388. makelabel.rt.nodot("3",z3+(1,-11));
  389. makelabel.rt.nodot("4",z4+(1,-11));
  390. makelabel.rt.nodot("5",z5+(0,-9));
  391. makelabel.rt.nodot("6",z6+(0,-9));
  392. for k=1 upto 6: heavy_dot z[k]; endfor;
  393. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  394.  heavy_dot precontrol k of p; endfor
  395. showit;
  396. shipit;
  397.  
  398. "Figure 3k"; % wiggly shape for exercise
  399. clear_all;
  400. z1=(0,100); z2=(100,100); z3=(200,100);
  401. z4=(0,0); z5=(100,0); z6=(200,0);
  402. path p; p=z5..z4{z4-z2}..z1..z3..z6{z2-z6}..cycle;
  403. draw p;
  404. makelabel.bot.nodot("   1",z1-(2,2));
  405. makelabel.bot.nodot("2",z2-(0,2));
  406. makelabel.bot.nodot("3   ",z3+(2,-2));
  407. makelabel.bot.nodot("   4",z4);
  408. makelabel.top.nodot("5",z5+(0,5));
  409. makelabel.bot.nodot("6   ",z6);
  410. for k=1 upto 6: heavy_dot z[k]; endfor;
  411. showit;
  412. shipit;
  413.  
  414. "Figure 3l"; % examples of varying curl
  415. clear_all;
  416. z1=(0,100); z2=(100,100); z3=(200,100);
  417. z4=(0,0); z5=(100,0); z6=(200,0);
  418. path p; p=z4{curl0}..z2{z3-z4}..{curl0}z3;
  419. draw p;
  420. drawdot z4; drawdot z3;
  421. makelabel.rt.nodot("1",z1+(0,-9));
  422. makelabel.rt.nodot("2",z2+(1,-11));
  423. makelabel.rt.nodot("3",z3+(1,-11));
  424. makelabel.rt.nodot("4",z4+(1,-11));
  425. makelabel.rt.nodot("5",z5+(0,-9));
  426. makelabel.rt.nodot("6",z6+(0,-9));
  427. for k=1 upto 6: heavy_dot z[k]; endfor;
  428. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  429.  heavy_dot precontrol k of p; endfor
  430. pair offset; offset=(325,0);
  431. p:=(z4{curl2}..z2{z3-z4}..{curl2}z3) shifted offset; draw p;
  432. drawdot z4+offset; drawdot z3+offset;
  433. makelabel.rt.nodot("1",z1+(0,-9)+offset);
  434. makelabel.rt.nodot("2",z2+(1,-11)+offset);
  435. makelabel.rt.nodot("3",z3+(1,-11)+offset);
  436. makelabel.rt.nodot("4",z4+(1,-11)+offset);
  437. makelabel.rt.nodot("5",z5+(0,-9)+offset);
  438. makelabel.rt.nodot("6",z6+(0,-9)+offset);
  439. for k=1 upto 6: heavy_dot z[k]+offset; endfor;
  440. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  441.  heavy_dot precontrol k of p; endfor
  442. showit;
  443. shipit;
  444.  
  445. "Figure 3m"; % two directions specified
  446. clear_all;
  447. z1=(0,100); z2=(100,100); z3=(200,100);
  448. z4=(0,0); z5=(100,0); z6=(200,0);
  449. path p; p=z4{z2-z4}..z6{down};
  450. draw p;
  451. drawdot z4; drawdot z6;
  452. makelabel.rt.nodot("1",z1+(2,0));
  453. makelabel.rt.nodot("2",z2+(2,0));
  454. makelabel.rt.nodot("3",z3+(2,0));
  455. makelabel.bot.nodot("   4",z4);
  456. makelabel.rt.nodot("5",z5+(2,0));
  457. makelabel.rt.nodot(" 6",z6);
  458. for k=1 upto 6: heavy_dot z[k]; endfor;
  459. for k=1 upto length p: heavy_dot postcontrol k-1 of p;
  460.  heavy_dot precontrol k of p; endfor
  461. showit;
  462. shipit;
  463.  
  464. "Figure 3n"; % two control points specified
  465. clear_all;
  466. z1=(0,100); z2=(100,100); z3=(200,100);
  467. z4=(0,0); z5=(100,0); z6=(200,0);
  468. path p; p=z4..controls z1 and z2..z6;
  469. draw p;
  470. drawdot z4; drawdot z6;
  471. makelabel.rt.nodot("1",z1+(2,0));
  472. makelabel.rt.nodot("2",z2+(2,0));
  473. makelabel.rt.nodot("3",z3+(2,0));
  474. makelabel.rt.nodot(" 4",z4);
  475. makelabel.rt.nodot("5",z5+(2,0));
  476. makelabel.rt.nodot(" 6",z6);
  477. for k=1 upto 6: heavy_dot z[k]; endfor;
  478. showit;
  479. shipit;
  480.  
  481. "Figure 4a"; % bean shape with elliptical pens
  482. clear_all;
  483. z1=(0,100); z2=(100,100); z3=(200,100);
  484. z4=(0,0); z5=(100,0); z6=(200,0);
  485. path p; p=z5..z4..z1..z3..z6..cycle;
  486. pickup pencircle xscaled .8pt yscaled .2pt rotated 30;
  487. draw p;
  488. makelabel.bot("   1",z1);
  489. makelabel.bot("2",z2);
  490. makelabel.bot(" 3",z3);
  491. makelabel.top("4 ",z4);
  492. makelabel.top("",z5); makelabel.top.nodot("5",z5+(0,5));
  493. makelabel.top("",z6); makelabel.top.nodot("6   ",z6+(1,1));
  494. pair offset; offset=(325,0);
  495. pickup pencircle xscaled .8pt rotated 30;
  496. draw p shifted offset;
  497. makelabel.bot("   1",z1+offset);
  498. makelabel.bot("2",z2+offset);
  499. makelabel.bot(" 3",z3+offset);
  500. makelabel.top("4 ",z4+offset);
  501. makelabel.top("",z5+offset); makelabel.top.nodot("5",z5+(0,5)+offset);
  502. makelabel.top("",z6+offset); makelabel.top.nodot("6   ",z6+(1,1)+offset);
  503. showit;
  504. shipit;
  505.  
  506. "Figure 4b"; % T of METAFONT logo
  507. alpha:=.45;  % controls bar location and similar things
  508. beta:=.2;  % controls squareness of bowls
  509. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  510. numeric leftstemloc, barheight;
  511.   h#=6;  % height of characters, in pt
  512.   xx#=0.6;  % extra length of certain features, in pt
  513.   u#=4/9;  % unit width, in pt
  514.   s#=0;  % extra sidebar, in pt
  515.   o#=1/9;  % overshoot of curves, in pt
  516.   ph#=2/3;  % horizontal thickness of pen, in pt
  517. yy#=xx#; define_whole_pixels(xx,yy);
  518. define_pixels(s,u);
  519. define_corrected_pixels(o);
  520. pv#=.9ph#; define_blacker_pixels(ph,pv);
  521. pickup pencircle xscaled ph yscaled pv;
  522. logo_pen:=savepen;
  523. leftstemloc:=good.x((2.5u#+s#)*pt);
  524. barheight:=good.y(alpha*h#*pt);
  525. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  526.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  527.  
  528. beginlogochar(T,13);
  529. if odd(w-ph): w:=w+1; fi  % allows a symmetric stem
  530. x1+x2=2x3=2x4=w; lft.x1=-epsilon; % I tried s-o instead; was not as good
  531. y1=y2=y3; top.y1=h; bot.y4=-o;
  532. draw z1..z2; draw z3..z4;
  533. labels.rt(2,3);
  534. makelabel.top("1",z1);
  535. makelabel.top("4",z4);
  536. endchar;
  537.  
  538. "Figure 4c"; % M of METAFONT logo
  539. alpha:=.45;  % controls bar location and similar things
  540. beta:=.2;  % controls squareness of bowls
  541. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  542. numeric leftstemloc, barheight;
  543.   h#=6;  % height of characters, in pt
  544.   xx#=0.6;  % extra length of certain features, in pt
  545.   u#=4/9;  % unit width, in pt
  546.   s#=0;  % extra sidebar, in pt
  547.   o#=1/9;  % overshoot of curves, in pt
  548.   ph#=2/3;  % horizontal thickness of pen, in pt
  549. yy#=xx#; define_whole_pixels(xx,yy);
  550. define_pixels(s,u);
  551. define_corrected_pixels(o);
  552. pv#=.9ph#; define_blacker_pixels(ph,pv);
  553. pickup pencircle xscaled ph yscaled pv;
  554. logo_pen:=savepen;
  555. leftstemloc:=good.x((2.5u#+s#)*pt);
  556. barheight:=good.y(alpha*h#*pt);
  557. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  558.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  559.  
  560. beginlogochar(M,18);
  561. x1+x5=x2+x4=2x3=w; x1=x2=leftstemloc;
  562. y1=y5; y2=y4; bot.y1=-o; top y2=h+o; y3=y1+yy;
  563. draw z1--z2--z3--z4--z5;
  564. labels.rt(3,5);
  565. makelabel.lft("1",z1);
  566. makelabel.bot("2",z2);
  567. makelabel.bot("4",z4);
  568. endchar;
  569.  
  570. "Figure 4d"; % solid kidney bean
  571. clear_all;
  572. z1=(0,100); z2=(100,100); z3=(200,100);
  573. z4=(0,0); z5=(100,0); z6=(200,0);
  574. path p; p=z5..z4..z1..z3..z6..cycle;
  575. fill p;
  576. makelabel.bot(" 1",z1);
  577. makelabel.bot("2",z2);
  578. makelabel.bot("3 ",z3);
  579. makelabel.top(" 4",z4);
  580. makelabel.top("5",z5);
  581. makelabel.top("6 ",z6);
  582. showit;
  583. shipit;
  584.  
  585. "Figure 4e"; % black triangle character for exercises
  586. beginchar(oct"170", 5pt#, 6.25pt#, 0);
  587. t:=(2-sqrt3)/2;
  588. x1=x2=w-x3+.5-t=round .43pt; y3=.5+floor.5h; % MANUAL font has it different!
  589. %x1=x2=w-x3=round .43pt; y3=.5+floor.5h;
  590. z1-z2=(z3-z2) rotated 60;
  591. y2:=t+round(y2-t); y1:=h-y2;
  592. fill z1--z2--z3--cycle;
  593. labels.lft(1,2); labels.rt(3); endchar;
  594.  
  595. "Figure 4f"; % black bean with white holes
  596. clear_all;
  597. z1=(0,100); z2=(100,100); z3=(200,100);
  598. z4=(0,0); z5=(100,0); z6=(200,0);
  599. path p; p=z5..z4..z1..z3..z6..cycle;
  600. fill p;
  601. unfill 1/4[z4,z2]..3/4[z4,z2]..cycle;
  602. unfill 1/4[z6,z2]..3/4[z6,z2]..cycle;
  603. makelabel.bot(" 1",z1);
  604. makelabel.bot("2",z2);
  605. makelabel.bot("3 ",z3);
  606. makelabel.top(" 4",z4);
  607. makelabel.top("5",z5);
  608. makelabel.top("6 ",z6);
  609. showit;
  610. shipit;
  611.  
  612. "Figure 4g"; % black bean with skewed interior cutout
  613. clear_all;
  614. z1=(0,100); z2=(100,100); z3=(200,100);
  615. z4=(0,0); z5=(100,0); z6=(200,0);
  616. path p; p=z5..z4..z1..z3..z6..cycle;
  617. fill p;
  618. z0=(.8[x1,x2],.5[y1,y4]);
  619. for k=1 upto 6: z[k]'=.2[z[k],z0]; endfor
  620. unfill z5'..z4'..z1'..z3'..z6'..cycle;
  621. makelabel.bot("0",z0);
  622. makelabel.top("1 ",z1);
  623. makelabel.top("2",z2);
  624. makelabel.top(" 3",z3);
  625. makelabel.bot("4 ",z4);
  626. makelabel.bot("5",z5);
  627. makelabel.bot(" 6",z6);
  628. makelabel.bot("  1'",z1');
  629. makelabel.bot(" 2'",z2');
  630. makelabel.bot("3'  ",z3');
  631. makelabel.top("  4'",z4');
  632. makelabel.top("5'",z5');
  633. makelabel.top("6'  ",z6');
  634. showit;
  635. shipit;
  636.  
  637. "Figure 4h"; % sample penstroke
  638. clear_all;
  639. penpos1(1.2pt,30); penpos2(1.0pt,45); penpos3(0.8pt,90);
  640. z1=(0,2pt); z2=(4pt,0); x3=9pt; y3l=y2r;
  641. penstroke z1e..z2e{right}..z3e{right};
  642. labels.top(2r,3r);
  643. labels.bot(2l,3l);
  644. labels.rt(3,1r);
  645. labels.lft(1l,2);
  646. makelabel.top("1 ",z1);
  647. showit;
  648. shipit;
  649.  
  650. "Figure 4i"; % cyclic penstroke example
  651. clear_all;
  652. d:=25;
  653. penpos1(d,30);
  654. penpos2(d,60);
  655. penpos3(d,210);
  656. penpos4(d,240);
  657. y1=.51y2r; y2r=175; y3=.49y2r; y4r=0;
  658. x1r=175; x2=x4=.5x1r; x3r=0;
  659. penstroke z1e{up}..z2e{left}..z3e{down}..z4e{right}..cycle;
  660. labels.lft(1l,2,3r,4);
  661. labels.rt(1r,3l);
  662. labels.top(2r,3,4l);
  663. labels.bot(1,2l,4r);
  664. showit;
  665. shipit;
  666.  
  667. "Figure 4j"; % I from IOnian font
  668. clear_all;
  669. em#:=10pt#; cap#:=7pt#;
  670. bar#:=.8pt#;
  671. stem#:=.9pt#;
  672. thin#:=.8pt#;
  673. thick#:=1pt#;
  674. define_pixels(em,cap);
  675. define_blacker_pixels(thin,thick,bar,stem);
  676. beginchar(27,.35em#,cap#,0); % "The letter I"; \IOI=27
  677.  penpos1(stem,15); penpos2(.9stem,12); penpos3(stem,10);
  678.  x1=x2=x3=.5w; y1=h; y2=.55h; y3=0;
  679.  x2l:=1/6[x2l,x2];
  680.  penstroke z1e..z2e{down}..z3e;
  681. labels.top(1,2,1r);
  682. labels.lft(2l);
  683. labels.rt(2r);
  684. labels.bot(3,3l);
  685. makelabel("",z1l); makelabel("",z3r);
  686. makelabel.lft.nodot("1l",z1l-(0,2));
  687. makelabel.rt.nodot("3r",z3r+(0,2));
  688. endchar;
  689.  
  690. "Figure 4k"; % fixed pens versus penstrokes
  691. clear_all;
  692. z1=(0,0); z2=(150,0);
  693. pickup pencircle xscaled 0.8pt rotated 25;
  694. draw z1..z2..cycle;
  695. labels.lft(1,2);
  696. clearxy;
  697. pair offset; offset=(250,0);
  698. penpos1(0.8pt,25); penpos2(0.8pt,25);
  699. z1=(0,0)+offset; z2=(150,0)+offset;
  700. penstroke z1e..z2e..cycle;
  701. labels.lft(1l,2l);
  702. labels.rt(1r,2r);
  703. labels.bot(1,2);
  704. showit;
  705. shipit;
  706.  
  707. "Figure 4l"; % hex symbol with pen-pressure adjustments
  708. %b#:=1.0pt#; define_blacker_pixels(b); % FOR INITIAL TESTS ONLY
  709. %beginchar(0,500/36pt#,250/36pt#,0); % that's magnified 2.5 as in the type
  710. b#:=0.4pt#; define_blacker_pixels(b);
  711. beginchar(0,200/36pt#,100/36pt#,0);
  712. pickup pencircle scaled b;
  713. w:=2good.x .5w;
  714. top z1=(0,h); top z2=(.5w,h); top z3=(w,h);
  715. bot z4=(0,0); bot z5=(.5w,0); bot z6=(w,0);
  716. draw z2..z5;
  717. for k=1 upto 6: drawdot z[k]; endfor
  718. z1'=.25[z1,z6]; z6'=.75[z1,z6];
  719. z3'=.25[z3,z4]; z4'=.75[z3,z4];
  720.  theta1:=angle(z6-z1)+90;
  721.  theta3:=angle(z4-z3)+90;
  722. penpos1'(b,theta1); penpos6'(b,theta1); penpos7(.6b,theta1);
  723. penpos3'(b,theta3); penpos4'(b,theta3); penpos8(.6b,theta3);
  724. z7=z8=.5[z1,z6];
  725. draw z1..z1'; draw z6'..z6;
  726.  penstroke z1'e{z6'-z1'}..z7e..{z6'-z1'}z6'e;
  727. draw z3..z3'; draw z4'..z4;
  728.  penstroke z3'e{z4'-z3'}..z8e..{z4'-z3'}z4'e;
  729. labels.top(1'r,3'l,4'l,6'r);
  730. labels.bot(1'l,3'r,4'r,6'l);
  731. forsuffixes $=1',3',4',6': makelabel("",z$); endfor
  732. makelabel.lft("1 ",z1);
  733. makelabel.lft("2 ",z2);
  734. makelabel.rt(" 3",z3);
  735. makelabel.lft("4 ",z4);
  736. makelabel.lft("5 ",z5);
  737. makelabel.rt(" 6",z6);
  738. makelabel.top("8l  ",z8l);
  739. makelabel.top("  7r",z7r);
  740. makelabel.bot("7l  ",z7l);
  741. makelabel.bot("  8r",z8r);
  742. endchar;
  743.  
  744. "Figure 4m"; % same, cut sharp at the terminals, and inside the box
  745. %b#:=1.0pt#; define_blacker_pixels(b); % FOR INITIAL TESTS ONLY
  746. %beginchar(0,500/36pt#,250/36pt#,0); % that's magnified 2.5 as in the type
  747. b#:=0.4pt#; define_blacker_pixels(b);
  748. beginchar(0,200/36pt#,100/36pt#,0);
  749. pickup pencircle scaled b;
  750. w:=2good.x .5w;
  751. x1l=x4l=0;x2=x5=.5w;x3r=x6r=w;
  752. y1r=y2=y3l=h; y4r=y5=y6l=0;
  753. z1'=.25[z1,z6]; z6'=.75[z1,z6]; theta1:=angle(w,-h)+90;
  754. z3'=.25[z3,z4]; z4'=.75[z3,z4]; theta3:=angle(-w,-h)+90;
  755. z7=z8=.5[z1,z6];
  756. penpos1(b,theta1); penpos6(b,theta1);
  757. penpos1'(b,theta1); penpos6'(b,theta1); penpos7(.6b,theta1);
  758. penpos3(b,theta3); penpos4(b,theta3);
  759. penpos3'(b,theta3); penpos4'(b,theta3); penpos8(.6b,theta3);
  760. penstroke z1e..z1'e{z6'-z1'}..z7e..{z6'-z1'}z6'e..z6e;
  761. penpos2(b,0); penpos5(b,0); penstroke z2e..z5e;
  762. penstroke z3e..z3'e{z4'-z3'}..z8e..{z4'-z3'}z4'e..z4e;
  763. penlabels(1,1',2,3,3',4,4',5,6,6');
  764. labels.top(1r,1'r,2,3l,3'l,4l,4'l,6r,6'r);
  765. labels.bot(1l,1'l,3r,3'r,4r,4'r,5,6l,6'l);
  766. labels.lft(2l,5l);
  767. labels.rt(2r,5r);
  768. forsuffixes $=1,1',3,3',4,4',6,6': makelabel("",z$); endfor
  769. makelabel.top("8l  ",z8l);
  770. makelabel.top("  7r",z7r);
  771. makelabel.bot("7l  ",z7l);
  772. makelabel.bot("  8r",z8r);
  773. endchar;
  774.  
  775. "Figure A5a"; % S from IOnian font
  776. clear_all;
  777. em#:=10pt#; cap#:=7pt#;
  778. slab#:=.8pt#;
  779. stem#:=.9pt#;
  780. thin#:=.8pt#;
  781. thick#:=5/6pt#;
  782.  o#:=1/5pt#;
  783. define_corrected_pixels(o);
  784. define_pixels(em,cap);
  785. define_blacker_pixels(thin,thick,slab,stem);
  786. beginchar(25,5/9em#,cap#,0); % "The letter S"; /IOS=25
  787. penpos1(slab,70);
  788. penpos2(.5slab,80);
  789. penpos3(.5[slab,thick],200);
  790. penpos5(.5[slab,thick],210);
  791. penpos6(.7slab,80);
  792. penpos7(.25[slab,thick],72);
  793. x1=x5; y1r=.94h+o;
  794. x2=x4=x6=.5w; y2r=h+o; y4=.54h; y6l=-o;
  795. x3r=.04em; y3=.5[y4,y2];
  796. x5l=w-.03em; y5=.5[y4,y6];
  797. .5[x7l,x7]=.04em; y7l=.12h-o;
  798. path trial; trial=z3{down}..z4..{down}z5;
  799. pair dz; dz=direction 1 of trial;
  800. penpos4(thick,angle dz-90);
  801. penstroke z1e..z2e{left}..z3e{down}..z4e{dz}..z5e{down}..z6e{left}..z7e;
  802. labels.lft(2,3r,5r,6,7);
  803. labels.rt(1,3l,4,5l);
  804. labels.top(1r,2r,3,4l,5,6r,7r);
  805. labels.bot(1l,2l,4r,6l,7l);
  806. endchar;
  807.  
  808. "Figure 8a"; % twenty points on p2
  809. clear_all;
  810. path p[]; p1=(0,0)..(3,3); p2=(0,0)..(3,3)..cycle;
  811. transform t; t=identity scaled 60 shifted (50,0);
  812. pair zz;
  813. z=(1.5,1.5) transformed t;
  814. pickup pencircle;
  815. draw p2 transformed t;
  816. for n=0 upto 19: zz:=point n/10 of p2 transformed t;
  817.  heavy_dot zz;
  818.  makelabel.top.nodot(decimal(n/10) if n mod 10=0:&".0" fi,
  819. .09[zz,z] shifted(.05xpart(z-zz),-6.5)); endfor
  820. %.1[zz,z] shifted(.1xpart(z-zz),-8)); endfor
  821. shipit;
  822. showit;
  823.  
  824. "Figure 11a"; % E of METAFONT logo
  825. alpha:=.45;  % controls bar location and similar things
  826. beta:=.2;  % controls squareness of bowls
  827. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  828. numeric leftstemloc, barheight;
  829.   h#=6;  % height of characters, in pt
  830.   xx#=0.6;  % extra length of certain features, in pt
  831.   u#=4/9;  % unit width, in pt
  832.   s#=0;  % extra sidebar, in pt
  833.   o#=1/9;  % overshoot of curves, in pt
  834.   ph#=2/3;  % horizontal thickness of pen, in pt
  835. yy#=xx#; define_whole_pixels(xx,yy);
  836. define_pixels(s,u);
  837. define_corrected_pixels(o);
  838. pv#=.9ph#; define_blacker_pixels(ph,pv);
  839. pickup pencircle xscaled ph yscaled pv;
  840. logo_pen:=savepen;
  841. leftstemloc:=good.x((2.5u#+s#)*pt);
  842. barheight:=good.y(alpha*h#*pt);
  843. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  844.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  845.  
  846. beginlogochar(E,14);
  847. x1=x2=x3=leftstemloc; x4=x6=w-x1+o; x5=x4-xx;
  848. y1=y6; y2=y5; y3=y4; bot.y1=0; top.y3=h; y2=barheight;
  849. draw z6--z1--z3--z4; draw z2..z5;
  850. labels.rt(1,2,3);
  851. labels.lft(4,5,6);
  852. endchar;
  853.  
  854. "Figure 12a"; % cmr10 left parenthesis
  855. u#:=20/36pt#;
  856. tiny#:=0;
  857. axis#:=90/36pt#;
  858. hheight#:=250/36pt#;
  859. border#:=20/36pt#;
  860. hair#:=8/36pt#;
  861. thin#:=9/36pt#;
  862. thick#:=25/36pt#;
  863. slant:=0;
  864. rulethickness:=.4pt#;
  865.  
  866. font_setup;
  867. beginchar("(",7u#, hheight#+border#, hheight#+border#-2axis#);
  868. italcorr (hheight#+border#)*slant-.5u#;
  869. pickup tinypen;
  870. penpos1(hair-tiny,0); penpos3(hair-tiny,0);
  871. penpos2(.75[thin,thick]-tiny,0);
  872. rt x1r = rt x3r = w-u; lft x2l = x1-4u;
  873. top y1=h; y2=.5[y1,y3]=axis;
  874. filldraw z1l{curl 4}..z2l..{curl 4}z3l--
  875.     z3r{curl 4}..z2r..{curl 4}z1r--cycle;
  876. labels.top(3,2);
  877. labels.bot(1);
  878. labels.lft(1l,2l,3l);
  879. labels.rt(1r,2r,3r);
  880. endchar;
  881.  
  882. "Figure 12b"; % cmbx10 left parenthesis
  883. u#:=23/36pt#;
  884. tiny#:=0;
  885. axis#:=90/36pt#;
  886. hheight#:=250/36pt#;
  887. border#:=20/36pt#;
  888. hair#:=13/36pt#;
  889. thin#:=17/36pt#;
  890. thick#:=41/36pt#;
  891. slant:=0;
  892.  
  893. font_setup;
  894. beginchar("(",7u#, hheight#+border#, hheight#+border#-2axis#);
  895. italcorr (hheight#+border#)*slant-.5u#;
  896. pickup tinypen;
  897. penpos1(hair-tiny,0); penpos3(hair-tiny,0);
  898. penpos2(.75[thin,thick]-tiny,0);
  899. rt x1r = rt x3r = w-u; lft x2l = x1-4u;
  900. top y1=h; y2=.5[y1,y3]=axis;
  901. filldraw z1l{curl 4}..z2l..{curl 4}z3l--
  902.     z3r{curl 4}..z2r..{curl 4}z1r--cycle;
  903. labels.top(3,2);
  904. labels.bot(1);
  905. labels.lft(1l,2l,3l);
  906. labels.rt(1r,2r,3r);
  907. endchar;
  908.  
  909. "Figure 12c"; % cmvtt10 left parenthesis
  910. u#:=21/36pt#;
  911. tiny#:=22/36pt#;
  912. axis#:=110/36pt#;
  913. hheight#:=220/36pt#;
  914. border#:=30/36pt#;
  915. hair#:=22/36pt#;
  916. thin#:=25/36pt#;
  917. thick#:=25/36pt#;
  918. slant:=0;
  919.  
  920. font_setup;
  921. beginchar("(",7u#, hheight#+border#, hheight#+border#-2axis#);
  922. italcorr (hheight#+border#)*slant-.5u#;
  923. pickup tinypen;
  924. penpos1(hair-tiny,0); penpos3(hair-tiny,0);
  925. penpos2(.75[thin,thick]-tiny,0);
  926. rt x1r = rt x3r = w-u; lft x2l = x1-4u;
  927. top y1=h; y2=.5[y1,y3]=axis;
  928. filldraw z1l{curl 4}..z2l..{curl 4}z3l--
  929.     z3r{curl 4}..z2r..{curl 4}z1r--cycle;
  930. labels.top(3,2);
  931. labels.bot(1);
  932. labels.lft(1l,2l,3l);
  933. labels.rt(1r,2r,3r);
  934. endchar;
  935.  
  936. "Figure 12d"; % cmssdc10 left parenthesis
  937. u#:=19/36pt#;
  938. tiny#:=8/36pt#;
  939. axis#:=95/36pt#;
  940. hheight#:=250/36pt#;
  941. border#:=20/36pt#;
  942. hair#:=23/36pt#;
  943. thin#:=40/36pt#;
  944. thick#:=40/36pt#;
  945. slant:=0;
  946.  
  947. font_setup;
  948. beginchar("(",7u#, hheight#+border#, hheight#+border#-2axis#);
  949. italcorr (hheight#+border#)*slant-.5u#;
  950. pickup tinypen;
  951. penpos1(hair-tiny,0); penpos3(hair-tiny,0);
  952. penpos2(.75[thin,thick]-tiny,0);
  953. rt x1r = rt x3r = w-u; lft x2l = x1-4u;
  954. top y1=h; y2=.5[y1,y3]=axis;
  955. filldraw z1l{curl 4}..z2l..{curl 4}z3l--
  956.     z3r{curl 4}..z2r..{curl 4}z1r--cycle;
  957. labels.top(3,2);
  958. labels.bot(1);
  959. labels.lft(1l,2l,3l);
  960. labels.rt(1r,2r,3r);
  961. endchar;
  962.  
  963. "Figure 12e"; % cmti10 left parenthesis
  964. u#:=18.4/36pt#;
  965. tiny#:=7/36;
  966. axis#:=90/36pt#;
  967. hheight#:=250/36pt#;
  968. border#:=20/36pt#;
  969. hair#:=8/36pt#;
  970. thin#:=11/36pt#;
  971. thick#:=23/36pt#;
  972. slant:=.25;
  973.  
  974. font_setup;
  975. beginchar("(",7u#, hheight#+border#, hheight#+border#-2axis#);
  976. italcorr (hheight#+border#)*slant-.5u#;
  977. pickup tinypen;
  978. penpos1(hair-tiny,0); penpos3(hair-tiny,0);
  979. penpos2(.75[thin,thick]-tiny,0);
  980. rt x1r = rt x3r = w-u; lft x2l = x1-4u;
  981. top y1=h; y2=.5[y1,y3]=axis;
  982. filldraw z1l{curl 4}..z2l..{curl 4}z3l--
  983.     z3r{curl 4}..z2r..{curl 4}z1r--cycle;
  984. labels.top(3,2);
  985. labels.bot(1);
  986. labels.lft(1l,2l,3l);
  987. labels.rt(1r,2r,3r);
  988. endchar;
  989. currenttransform:=identity yscaled aspect_ratio;
  990.  
  991. "Figure 12f"; % Dangerous bend symbol
  992. def font_setup=
  993. define_pixels(u,tiny,axis,hheight,border);
  994. define_blacker_pixels(hair,thin,thick,rulethickness);
  995. pickup if tiny<.5: nullpen else: pencircle scaled tiny fi;
  996. tinypen:=savepen;
  997. currenttransform:=identity slanted slant;
  998. enddef;
  999.  
  1000. % typical cmr10 parameters
  1001. u#:=20/36pt#;
  1002. tiny#:=0;
  1003. axis#:=90/36pt#;
  1004. hheight#:=250/36pt#;
  1005. border#:=20/36pt#;
  1006. hair#:=8/36pt#;
  1007. thin#:=9/36pt#;
  1008. thick#:=25/36pt#;
  1009. fixwidth:=0;
  1010. slant:=0;
  1011. rulethickness#:=.4pt#;
  1012.  
  1013. baselinedistance#:=11pt#;
  1014. heavyline#:=50/36pt#;
  1015. font_setup;
  1016. define_whole_pixels(baselinedistance);
  1017. define_blacker_pixels(heavyline);
  1018.  
  1019. beginchar(127,25u#,hheight#+border#,0);
  1020. pickup pencircle scaled rulethickness;
  1021. top y1=25/27h; lft x4=0;
  1022. x1+x1=x1a+x1b=x4b+x2a=x4+x2=x4a+x2b=x3b+x3a=x3+x3=w;
  1023. x4a=x4b=x4+u; x3b=x1a=x1-2u;
  1024. y4+y4=y4a+y4b=y3b+y1a=y3+y1=y3a+y1b=y2b+y2a=y2+y2=0;
  1025. y1a=y1b=y1-2/27h; y4b=y2a=y4+4/27h;
  1026. draw z1a..z1..z1b---z2a..z2..z2b---
  1027.   z3a..z3..z3b---z4a..z4..z4b---cycle;  % signboard
  1028. x10=x11=x12=x13=good.x(.5w-u); x14=x15=x16=x17=w-x10;
  1029. y10=y14=28/27h+epsilon; bot y13=-baselinedistance;
  1030. z11=(z10..z13) intersectionpoint (z1a{z1a-z4b}..z1{right});
  1031. y15=y11; y16=y12=-y11; y17=y20=y21=y13;
  1032. draw z11--z10--z14--z15; draw z12--z13; draw z16--z17;  % signpost
  1033. x20=w-x21; x21-x20=16u; draw z20--z21;  % ground level
  1034. x36=w-x31; x36-x31=8u; x32=x33=x36; x31=x34=x35;
  1035. y31=-y36=12/27h; y32=-y35=9/27h; y33=-y34=3/27h;
  1036. pickup pencircle scaled heavyline;
  1037. draw z32{z32-z31}..z33---z34..z35{z36-z35};  % the dangerous bend
  1038. pickup penrazor xscaled heavyline rotated (angle(z32-z31)+90);
  1039. draw z31--z32; draw z35--z36;    % upper and lower bars
  1040. labels.top(11,15,2a,4b,4,2,32,34);
  1041. labels.bot(10,14,2b,4a,33,35);
  1042. labels.lft(1a,3b,12,13,21,36);
  1043. labels.rt(1,1b,3a,3,16,20,17,31);
  1044. endchar;
  1045.  
  1046. "Figure 13a"; % Possible cube
  1047. clear_all;
  1048. fudge_factor:=1/2;
  1049. s#:=5pt#*fudge_factor; define_pixels(s); % side of the square
  1050. z1=(-epsilon,-epsilon);  z2=(s+epsilon,-epsilon);
  1051.   z3=(-epsilon,s+epsilon); z4=(s+epsilon,s+epsilon);
  1052. for k=1 upto 4: z[k+4]=z[k]+(2/3s,1/3s); endfor
  1053. pickup pencircle scaled (.4pt*fudge_factor);
  1054. draw z5--z6--z8--z7--cycle;
  1055. pickup pencircle scaled (1.6pt*fudge_factor);
  1056. erase draw z2--z4--z3;
  1057. pickup pencircle scaled (.4pt*fudge_factor);
  1058. draw z1--z2--z4--z3--cycle;
  1059. for k=1 upto 4:  draw z[k]--z[k+4]; endfor
  1060. labels.top(1,2,5,6);
  1061. labels.bot(3,4,7,8);
  1062. showit;
  1063. shipit;
  1064.  
  1065. "Figure 14a"; % El Palo Alto
  1066. begingroup save flex; clear_all;
  1067. def flex(text t) = % puts dots into normal flex
  1068.    hide(n_:=0;
  1069.    for z=t: z_[incr n_]:=z; makelabel("",z); endfor
  1070.    dz_:=z_[n_]-z_1)
  1071.    z_1 for k=2 upto n_-1: ...z_[k]{dz_} endfor ...z_[n_] enddef;
  1072.  
  1073. def grid= proofoffset (30,0);
  1074.   for y:=0 step 50 until 650: proofrule((-110,y),(110,y));
  1075.     makelabel.lft.nodot(str[y],(100,y+5));
  1076.     endfor;
  1077.   for x:=-100 step 50 until 100: proofrule((x,-10),(x,660));endfor enddef;
  1078.  
  1079. path branch[],trunk;
  1080.  
  1081. branch1=
  1082.  flex((0,660),(-9,633),(-22,610))
  1083.  &flex((-22,610),(-3,622),(17,617))
  1084.  &flex((17,617),(7,637),(0,660))
  1085.   &cycle;
  1086.  
  1087. branch2=
  1088.  flex((30,570),(10,590),(-1,616))
  1089.  &flex((-1,616),(-11,592),(-29,576),(-32,562))
  1090.  &flex((-32,562),(-10,577),(30,570))
  1091.  &cycle;
  1092.  
  1093. branch3=
  1094.  flex((-1,570),(-17,550),(-40,535))
  1095.  &flex((-40,535),(-45,510),(-60,477))
  1096.  &flex((-60,477),(-20,505),(40,512))
  1097.  &flex((40,512),(31,532),(8,550),(-1,570))
  1098.  &cycle;
  1099.  
  1100. branch4=
  1101.  flex((0,509),(-14,492),(-32,481))
  1102.  &flex((-32,481),(-42,455),(-62,430))
  1103.  &flex((-62,430),(-20,450),(42,448))
  1104.  &flex((42,448),(38,465),(4,493),(0,509))
  1105.  &cycle;
  1106.  
  1107. branch5=
  1108.  flex((-22,470),(-23,435),(-44,410))
  1109.  &flex((-44,410),(-10,421),(35,420))
  1110.  &flex((35,420),(15,455),(-22,470))
  1111.  &cycle;
  1112.  
  1113. branch6=
  1114.  flex((18,375),(9,396),(5,420))
  1115.  &flex((5,420),(-5,410),(-50,375),(-50,350))
  1116.  &flex((-50,350),(-25,375),(18,375))
  1117.  &cycle;
  1118.  
  1119. branch7=
  1120.  flex((0,400),(-13,373),(-30,350))
  1121.  &flex((-30,350),(0,358),(30,350))
  1122.  &flex((30,350),(13,373),(0,400))
  1123.  &cycle;
  1124.  
  1125. branch8=
  1126.  flex((50,275),(45,310),(3,360))
  1127.  &flex((3,360),(-20,330),(-70,300),(-100,266))
  1128.  &flex((-100,266),(-75,278),(-60,266))
  1129.  &flex((-60,266),(0,310),(50,275))
  1130.  &cycle;
  1131.  
  1132. branch9=
  1133.  flex((10,333),(-15,290),(-43,256))
  1134.  &flex((-43,256),(8,262),(58,245))
  1135.  &flex((58,245),(34,275),(10,333))
  1136.  &cycle;
  1137.  
  1138. branch10=
  1139.  flex((8,262),(-21,249),(-55,240))
  1140.  &flex((-55,240),(-51,232),(-53,220))
  1141.  &flex((-53,220),(-28,229),(27,235))
  1142.  &flex((27,235),(16,246),(8,262))
  1143.  &cycle;
  1144.  
  1145. branch11=
  1146.  flex((0,250),(-25,220),(-70,195))
  1147.  &flex((-70,195),(-78,180),(-90,170))
  1148.  &flex((-90,170),(-5,188),(74,183))
  1149.  &flex((74,183),(34,214),(0,250))
  1150.  &cycle;
  1151.  
  1152. branch12=
  1153.  flex((8,215),(-35,175),(-72,155))
  1154.  &flex((-72,155),(-75,130),(-92,110),(-95,88))
  1155.  &flex((-95,88),(-65,117),(-54,104))
  1156.  &flex((-54,104),(10,151),(35,142))..flex((42,130),(60,123),(76,124))
  1157.  &flex((76,124),(62,146),(26,180),(8,215))&cycle;
  1158.  
  1159. trunk=(0,660)---(-12,70)..{curl 5}(-28,-8)
  1160.  &flex((-28,-8),(-16,-4),(-10,-11))
  1161.  &flex((-10,-11),(0,-5),(14,-10))
  1162.  &flex((14,-10),(20,-6),(29,-11))
  1163.  &(29,-11){curl 4}..(10,100)---cycle;
  1164.  
  1165. makelabel("",(-12,70));
  1166. makelabel("",(10,100));
  1167.  
  1168. pickup pencircle scaled 2;
  1169. draw trunk;
  1170. for n=1 upto 12: draw branch[n]; endfor
  1171. grid;
  1172. showit;shipit;
  1173. endgroup;
  1174.  
  1175. "Figure 14b"; % Detail of one branch
  1176. clear_all;
  1177. pair zz[];
  1178. zz1=(0,509);
  1179. zz2=(-14,492);
  1180. zz3=(-32,481);
  1181. zz4=(-42,455);
  1182. zz5=(-62,430);
  1183. zz6=(-20,450);
  1184. zz7=(42,448);
  1185. zz8=(38,465);
  1186. zz9=(4,493);
  1187. for n=1 upto 9: z[n]=(zz[n]+(62,-430)) scaled 2.5; endfor
  1188. pickup pencircle;
  1189. filldraw flex(z1,z2,z3)&flex(z3,z4,z5)
  1190.  &flex(z5,z6,z7)&flex(z7,z8,z9,z1)&cycle;
  1191. labels.lft(2,3,4,5);
  1192. labels.rt(1,7,8,9);
  1193. labels.bot(6);
  1194. showit; shipit;
  1195.  
  1196. "Figure 14c"; % superellipses
  1197. clear_all;
  1198. w:=100; h:=150;
  1199. pickup pencircle xscaled 0.7pt yscaled 0.2pt rotated 30;
  1200. forsuffixes ss=65,70,75,80: s:=ss/100;
  1201. draw superellipse((w,.5h),(.5w,h),(0,.5h),(.5w,0),s) shifted (150/.05(s-.65),0);
  1202. makelabel.top.nodot("."&str ss,(.5w,.45h) shifted (150/.05(s-.65),0));
  1203. endfor
  1204. showit;
  1205. shipit;
  1206.  
  1207. "Figure 14d"; % demo of joinery
  1208. clear_all;
  1209. pickup standardpen;
  1210. z0=(0,100); z1=(50,0); z2=(180,0);
  1211. for n=3 upto 9: z[n]=z[n-3]+(200,0); endfor
  1212. draw z0..z1---z2...{up}z3
  1213.  & z3..z4--z5...{up}z6
  1214.  & z6...z7---z8..{up}z9;
  1215. makelabel.bot("0 ",z0);
  1216. makelabel.bot("6 ",z6);
  1217. labels.bot(3,9);
  1218. labels.rt(1,4,7);
  1219. labels.lft(2,5,8);
  1220. showit;
  1221. shipit;
  1222.  
  1223. "Figure 14e"; % JofA logo
  1224. beginchar("A",29mm#*.22,25mm#*.22,0);
  1225. interim autorounding:=0; interim smoothing:=0;
  1226. if odd(w-h): h:=h-1; fi
  1227. thick#:=2mm#*.22; thin#:=5/4mm#*.22;
  1228. define_whole_blacker_pixels(thick,thin);
  1229. forsuffixes @=a,b,c: transform @;
  1230.  forsuffixes e=l,r: path @e,@'e; numeric t@[]e; endfor endfor
  1231. penpos1(thick,0); penpos2(thick,90); penpos3(thick,180); penpos4(thick,270);
  1232. penpos5(thick,0); penpos6(thick,90); penpos7(thick,180); penpos8(thick,270);
  1233. x2=x4=x6=x8=.5[x5,x7]=.5w; x1r=w; x3r=0; x5-x7=y6-y8;
  1234. y1=y3=y5=y7=.5[y6,y8]=.5h; y2r=h; y4r=0; y6r=round.75h;
  1235. forsuffixes e=l,r: a.e=b'e=c'e=superellipse(z1e,z2e,z3e,z4e,.75);
  1236.  a'e=b.e=c.e=superellipse(z5e,z6e,z7e,z8e,.72); endfor
  1237. penpos.a1(thin,0); penpos.a5(whatever,-90); penpos.a9(thin,180);
  1238. x.a1l-x.a9l=1/3(x5l-x7l); x.a5=.5w; y.a1=y.a9; y.a5r=4/7h;
  1239. x.a3l=x.a1l; x.a3r=x.a1r; x.a4r=1/6[x.a3r,x1l]; x0=.5w; y0=.52h;
  1240. x.a6l+x.a4l=x.a6r+x.a4r=x.a7l+x.a3l=x.a7r+x.a3r=x.a9+x.a1=w;
  1241. y.a3r=y.a4r=y.a6r=y.a7r=.2[y2l,y0]; y.a3l=y.a4l=y.a6l=y.a7l=y.a3r-thin;
  1242. z.a4l=z.a4r+(thin,0)rotated(angle(z.a4r-z.a5r)+90)
  1243.  +whatever*(z.a4r-z.a5r); z.a4l-z.a5l=whatever*(z.a4r-z.a5r);
  1244. z=a.r intersectionpoint (z0--(w,0)); y.a1-y.a5=length(z-z0);
  1245. b=identity shifted(0,y0-y.a1)rotatedaround(z0,90-angle(z0-(w,0)));
  1246. c=b reflectedabout (z2,z4);
  1247. for n=1,3,4,5,6,7,9: forsuffixes e=l,,r: forsuffixes @=b,c:
  1248.  z@[n]e=z.a[n]e transformed @; endfor endfor endfor
  1249. forsuffixes e=l,r: forsuffixes @=a,b,c:
  1250.  z@2e=@r intersectionpoint (z@1e--z@3e);
  1251.  z@8e=@r intersectionpoint (z@9e--z@7e);
  1252.  t@1e=xpart(@e intersectiontimes (z@1l--z@3l));
  1253.  t@9e=xpart(@e intersectiontimes (z@9l--z@7l));
  1254.  t@4e=xpart(@'e intersectiontimes (z@5r--z@4l));
  1255.  t@6e=xpart(@'e intersectiontimes (z@5r--z@6l)); endfor endfor
  1256. penstroke subpath(t.a9e,t.b6e) of a.e;
  1257. penstroke subpath(t.b4e,t.c4e) of b'e;
  1258. penstroke subpath(t.c6e,t.a1e+8) of c'e;
  1259. penstroke subpath(t.a6e,t.b9e) of a'e;
  1260. penstroke subpath(t.b1e,t.c1e) of b.e;
  1261. penstroke subpath(t.c9e,t.a4e+8) of c.e;
  1262. forsuffixes @=a,b,c:
  1263.  penstroke z@2e--z@3e--z@4e--z@5e--z@6e--z@7e--z@8e; endfor
  1264. labels.lft(0,1l,3r,3,5l,7r,7,a1l,a2l,a3l,a6l,
  1265.   a6r,a8r,a9r,b2l,b5,b5r,b9,c1,c2r,c5l);
  1266. labels.rt(1,1r,3l,5,5r,7l,a1r,a2r,a4l,a4r,a7l,
  1267.   a9l,b1,b2r,b5l,c2l,c5,c5r,c9);
  1268. labels.top(2r,2,2l,4l,6r,6,6l,8l,a3r,a7r,a8l,
  1269.   b1l,b3l,b3r,b6r,b6l,b8r,b9r,c1l,c3l,c3r,c6r,c6l,c8r,c9r);
  1270. labels.bot(2r,2,2l,4,4r,8,8r,a1,a5l,a5,a5r,a9,
  1271.   b1r,b4l,b4r,b7l,b7r,b8l,c1r,c4l,c4r,c7l,c7r,c8l);
  1272. makelabel("",z.b9l);
  1273. makelabel("",z.c9l);
  1274. makelabel.lft.nodot("b9l",z.b9l-(0,3));
  1275. makelabel.rt.nodot("c9l",z.c9l-(0,3));
  1276. endchar;
  1277.  
  1278. "Figure 15a"; % four u's
  1279. beginchar("4",11pt#,11pt#,0);
  1280. pickup pencircle scaled 3/4pt yscaled 1/3 rotated 30;
  1281. save t; transform t;
  1282. t=identity rotatedaround((.5w,.5h),-90);
  1283. x2=.35w; x3=good.x .6w;
  1284. y2=good.y .1h; top y3=round .4h+eps;
  1285. save p; path p; p=z2{right}...{up}z3;
  1286. top z1=point .5 of p transformed t;
  1287. draw z1...z2{right}...{up}z3;
  1288. addto currentpicture also currentpicture transformed t;
  1289. addto currentpicture also currentpicture transformed(t transformed t);
  1290. labels.bot(1,3); labels.rt(2); endchar;
  1291.  
  1292. "Figure 16a"; % circular pen polygon
  1293. clear_all;
  1294. path p;
  1295. p=makepath(pencircle scaled 20) scaled 10 shifted (110,110);
  1296. if length p<>32: error; fi
  1297. fill p;
  1298. for k=1 upto length p: heavy_dot point k of p; endfor
  1299. for x=0 step 10 until 220: proofrule((x,0),(x,220)); endfor
  1300. for y=0 step 10 until 220: proofrule((0,y),(220,y)); endfor
  1301. proofrulethickness .8;
  1302. proofrule ((0,110),(220,110)); proofrule ((110,0),(110,220));
  1303. showit;
  1304. shipit;
  1305.  
  1306. "Figure 16b"; % elliptical pen polygon
  1307. clear_all;
  1308. path p;
  1309. p=makepath(pencircle xscaled 30 yscaled 20) scaled 10 shifted (160,110);
  1310. if length p<>40: error; fi
  1311. fill p;
  1312. for k=1 upto length p: heavy_dot point k of p; endfor
  1313. for x=0 step 10 until 320: proofrule((x,0),(x,220)); endfor
  1314. for y=0 step 10 until 220: proofrule((0,y),(320,y)); endfor
  1315. proofrulethickness .8;
  1316. proofrule ((0,110),(320,110)); proofrule ((160,0),(160,220));
  1317. showit;
  1318. shipit;
  1319.  
  1320. "Figure 16c"; % elliptical pen hexagon
  1321. clear_all;
  1322. path p;
  1323. p=makepath((pencircle xscaled 30) yscaled 20) scaled 10 shifted (160,110);
  1324. if length p<>6: error; fi
  1325. fill p;
  1326. for k=1 upto length p: heavy_dot point k of p; endfor
  1327. for x=0 step 10 until 320: proofrule((x,0),(x,220)); endfor
  1328. for y=0 step 10 until 220: proofrule((0,y),(320,y)); endfor
  1329. proofrulethickness .8;
  1330. proofrule ((0,110),(320,110)); proofrule ((160,0),(160,220));
  1331. showit;
  1332. shipit;
  1333.  
  1334. "Figure 16d"; % cutoff version of Figure 3n
  1335. clear_all;
  1336. z1=(0,100); z2=(100,100); z3=(200,100);
  1337. z4=(0,0); z5=(100,0); z6=(200,0);
  1338. path p; p=z4..controls z1 and z2..z6;
  1339. cutdraw p;
  1340. makelabel.rt.nodot("1",z1+(2,0));
  1341. makelabel.rt.nodot("2",z2+(2,0));
  1342. makelabel.rt.nodot("3",z3+(2,0));
  1343. makelabel.rt.nodot(" 4",z4);
  1344. makelabel.rt.nodot("5",z5+(2,0));
  1345. makelabel.rt.nodot(" 6",z6);
  1346. for k=1 upto 6: heavy_dot z[k]; endfor;
  1347. showit;
  1348. shipit;
  1349.  
  1350. "Figure 16e"; % cutoff version of Figure 4b
  1351. alpha:=.45;  % controls bar location and similar things
  1352. beta:=.2;  % controls squareness of bowls
  1353. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  1354. numeric leftstemloc, barheight;
  1355.   h#=6;  % height of characters, in pt
  1356.   xx#=0.6;  % extra length of certain features, in pt
  1357.   u#=4/9;  % unit width, in pt
  1358.   s#=0;  % extra sidebar, in pt
  1359.   o#=1/9;  % overshoot of curves, in pt
  1360.   ph#=2/3;  % horizontal thickness of pen, in pt
  1361. yy#=xx#; define_whole_pixels(xx,yy);
  1362. define_pixels(s,u);
  1363. define_corrected_pixels(o);
  1364. pv#=.9ph#; define_blacker_pixels(ph,pv);
  1365. pickup pencircle xscaled ph yscaled pv;
  1366. logo_pen:=savepen;
  1367. leftstemloc:=good.x((2.5u#+s#)*pt);
  1368. barheight:=good.y(alpha*h#*pt);
  1369. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  1370.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  1371.  
  1372. beginlogochar(T,13);
  1373. if odd(w-ph): w:=w+1; fi  % allows a symmetric stem
  1374. x1+x2=2x3=2x4=w; lft.x1=0;
  1375. y1=y2=y3; top.y1=h; y4=0;
  1376. draw z1--z2;
  1377. cutoff(z1,170);
  1378. cutoff(z2,-10);
  1379. draw z3--z4;
  1380. cutoff(z4,-80);
  1381. labels.rt(1);
  1382. labels.lft(2);
  1383. labels.bot(3);
  1384. makelabel.top("4",z4);
  1385. endchar;
  1386.  
  1387. "Figure 16f"; % tilde with pencircle
  1388. clear_all;
  1389. pickup pencircle xscaled .8pt yscaled .2pt rotated 50;
  1390. z1=(0,0); z4=(200,30);
  1391. z2-z1=z4-z3=whatever*dir 50;
  1392. y2-y1=3(y4-y1);
  1393. draw z1..controls z2 and z3..z4;
  1394. makelabel.lft("1 ",z1);
  1395. makelabel.rt(" 4",z4);
  1396. showit;
  1397. shipit;
  1398.  
  1399. "Figure 16g"; % tilde with pensquare
  1400. clear_all;
  1401. pickup pensquare xscaled .8pt yscaled .2pt rotated 50;
  1402. z1=(0,0); z4=(200,30);
  1403. z2-z1=z4-z3=whatever*dir 50;
  1404. y2-y1=3(y4-y1);
  1405. draw z1..controls z2 and z3..z4;
  1406. makelabel.lft("1 ",z1);
  1407. makelabel.rt(" 4",z4);
  1408. showit;
  1409. shipit;
  1410.  
  1411. "Figure 16h"; % fancy serif with pencircle
  1412. clear_all;
  1413. pickup pencircle xscaled .8pt yscaled .2pt rotated 20;
  1414. z1=(20,175); bot z3=(0,0);
  1415. z4=(50,0); z6=(25,175);
  1416. x2=x1; z2=z3+whatever*dir 20;
  1417. x5=x6; z5=z4+whatever*dir -20;
  1418. pair dishing; dishing=(8,0) rotated 20;
  1419. filldraw z1..controls z2..z3
  1420. --(flex(z3,.5[z3,z4]+dishing,z4))shifted(0,-epsilon)
  1421. -- z4..controls z5..z6--cycle;
  1422. showit;
  1423. labels.lft(1,2,3);
  1424. labels.rt(4,5,6);
  1425. shipit;
  1426.  
  1427. "Figure 16i"; % fancy serif with pensquare
  1428. clear_all;
  1429. pickup pensquare xscaled .8pt yscaled .2pt rotated 20;
  1430. z1=(20,175); bot z3=(0,0);
  1431. z4=(50,0); z6=(25,175);
  1432. x2=x1; z2=z3+whatever*dir 20;
  1433. x5=x6; z5=z4+whatever*dir -20;
  1434. pair dishing; dishing=(8,0) rotated 20;
  1435. filldraw z1..controls z2..z3
  1436. --(flex(z3,.5[z3,z4]+dishing,z4))shifted(0,-epsilon)
  1437. -- z4..controls z5..z6--cycle;
  1438. showit;
  1439. labels.lft(1,2,3);
  1440. labels.rt(4,5,6);
  1441. shipit;
  1442.  
  1443. "Figure 18a"; % O of METAFONT logo
  1444. alpha:=.45;  % controls bar location and similar things
  1445. beta:=.2;  % controls squareness of bowls
  1446. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  1447. numeric leftstemloc, barheight;
  1448.   h#=6;  % height of characters, in pt
  1449.   xx#=0.6;  % extra length of certain features, in pt
  1450.   u#=4/9;  % unit width, in pt
  1451.   s#=0;  % extra sidebar, in pt
  1452.   o#=1/9;  % overshoot of curves, in pt
  1453.   ph#=2/3;  % horizontal thickness of pen, in pt
  1454. yy#=xx#; define_whole_pixels(xx,yy);
  1455. define_pixels(s,u);
  1456. define_corrected_pixels(o);
  1457. pv#=.9ph#; define_blacker_pixels(ph,pv);
  1458. pickup pencircle xscaled ph yscaled pv;
  1459. logo_pen:=savepen;
  1460. leftstemloc:=good.x((2.5u#+s#)*pt);
  1461. barheight:=good.y(alpha*h#*pt);
  1462. def beginlogochar(expr c)(expr n) = % code c; width is n units plus sidebars
  1463.   beginchar(c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  1464.  
  1465. def super_half(suffix i,j,k) =
  1466.  draw z.i{0,y.j-y.i}
  1467.   ... (.8[x.j,x.i],.8[y.i,y.j]){z.j-z.i}
  1468.   ... z.j{x.k-x.i,0}
  1469.   ... (.8[x.j,x.k],.8[y.k,y.j]){z.k-z.j}
  1470.   ... z.k{0,y.k-y.j} enddef;
  1471.  
  1472. beginlogochar("O",15);
  1473. x1=x4=.5w; top y1=h+o; bot y4=-o;
  1474. x2=w-x3=good.x(1.5u+s);
  1475. y2=y3=barheight;
  1476. super_half(2,1,3); super_half(3,4,2);
  1477. labels.lft(2); labels.rt(1,3,4); endchar;
  1478.  
  1479. "Figure A18a"; % A of METAFONT logo
  1480. alpha:=.45;  % controls bar location and similar things
  1481. beta:=.2;  % controls squareness of bowls
  1482. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  1483. numeric leftstemloc, barheight;
  1484.   h#=6;  % height of characters, in pt
  1485.   xx#=0.6;  % extra length of certain features, in pt
  1486.   u#=4/9;  % unit width, in pt
  1487.   s#=0;  % extra sidebar, in pt
  1488.   o#=1/9;  % overshoot of curves, in pt
  1489.   ph#=2/3;  % horizontal thickness of pen, in pt
  1490. yy#=xx#; define_whole_pixels(xx,yy);
  1491. define_pixels(s,u);
  1492. define_corrected_pixels(o);
  1493. pv#=.9ph#; define_blacker_pixels(ph,pv);
  1494. pickup pencircle xscaled ph yscaled pv;
  1495. logo_pen:=savepen;
  1496. leftstemloc:=good.x((2.5u#+s#)*pt);
  1497. barheight:=good.y(alpha*h#*pt);
  1498. def beginlogochar(expr c)(expr n) = % code c; width is n units plus sidebars
  1499.   beginchar(c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  1500.  
  1501. def super_half(suffix i,j,k) =
  1502.  draw z.i{0,y.j-y.i}
  1503.   ... (.8[x.j,x.i],.8[y.i,y.j]){z.j-z.i}
  1504.   ... z.j{x.k-x.i,0}
  1505.   ... (.8[x.j,x.k],.8[y.k,y.j]){z.k-z.j}
  1506.   ... z.k{0,y.k-y.j} enddef;
  1507.  
  1508. beginlogochar("A",15);
  1509. x1=.5w;
  1510. x2=x4=leftstemloc;
  1511. x3=x5=w-x2;
  1512. top y1=h+o;
  1513. y2=y3=barheight;
  1514. bot y4=bot y5=-o;
  1515. draw z4--z2--z3--z5;
  1516. super_half(2,1,3);
  1517. labels.top(2,3,4,5);
  1518. labels.rt(1);
  1519. endchar;
  1520.  
  1521. "Figure 18b"; % serif points
  1522. clear_all;
  1523. def serif(suffix $)(expr breadth,theta,left_jut,right_jut)=
  1524.  penpos$(breadth/abs sind theta,0);
  1525. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1526. y$c=y$d; y$b=y$e=y$; y$b-y$c=if theta<0:-fi slab;
  1527. x$b=x$c=x$l-left_jut; x$d=x$e=x$r+right_jut;
  1528. enddef;
  1529.  
  1530. def serif_edge suffix $ =
  1531.  (serif_bracket($a,$l,$b)--z$c
  1532.   --z$d--reverse serif_bracket($f,$r,$e)) enddef;
  1533.  
  1534. def serif_bracket(suffix i,j,k) =
  1535.  (z.i{z.j-z.i}...serif_darkness[z.j,.5[z.i,z.k] ]{z.k-z.i}
  1536.   ...z.k{z.k-z.j}) enddef;
  1537.  
  1538. serif_darkness:=1/4; slab:=50; bracket:=175;
  1539. z$=(150,slab);
  1540. serif($,100,75,80,90);
  1541. pickup pencircle scaled 2; draw serif_edge $;
  1542. labels.lft($l,$a);
  1543. labels.rt($,$r,$f);
  1544. labels.top($b,$e);
  1545. labels.bot($c,$d);
  1546. showit;
  1547. shipit;
  1548.  
  1549. "Figure 18c"; % AI by outlines
  1550. clear_all;
  1551. def serif(suffix $)(expr breadth,theta,left_jut,right_jut)=
  1552.  penpos$(breadth/abs sind theta,0);
  1553. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1554. y$c=y$d; y$b=y$e=y$; y$b-y$c=if theta<0:-fi slab;
  1555. x$b=x$c=x$l-left_jut; x$d=x$e=x$r+right_jut;
  1556. enddef;
  1557.  
  1558. def serif_edge suffix $ =
  1559.  (serif_bracket($a,$l,$b)--z$c
  1560.   --z$d--reverse serif_bracket($f,$r,$e)) enddef;
  1561.  
  1562. def serif_bracket(suffix i,j,k) =
  1563.  (z.i{z.j-z.i}...serif_darkness[z.j,.5[z.i,z.k] ]{z.k-z.i}
  1564.   ...z.k{z.k-z.j}) enddef;
  1565.  
  1566. serif_darkness:=1/3;
  1567. slab#:=1/4pt#;
  1568. bracket#:=1pt#;
  1569. jut#:=.9pt#;
  1570. u#:=3/5pt#;
  1571. ht#:=7pt#;
  1572. thin#:=.5pt#;
  1573. thick#:=1.1pt#;
  1574. define_pixels(slab,bracket,jut,u,ht,thin,thick);
  1575.  
  1576. beginchar("A",13u#,ht#,0);
  1577. z1=(.5w,round 1.05h); x4l=w-x5r=u; y4l=y5r=slab;
  1578. numeric theta[]; theta4=angle(z1-z4l); theta5=angle(z1-z5r);
  1579. serif(4,thin,theta4,.6jut,jut); serif(5,thick,theta5,jut,.6jut);
  1580. z0=z4r+whatever*dir theta4=z5l+whatever*dir theta5;
  1581. fill z1--serif_edge4--z0 & z0--serif_edge5--z1 & cycle;
  1582. penpos2(whatever,theta4); penpos3(whatever,theta5);
  1583. y2r=y3r=.5[y4,y0]; y2l=y3l=y2r-thin;
  1584. z2=whatever[z1,z4r]; z3=whatever[z1,z5l];
  1585. penstroke z2e--z3e;
  1586. labels.lft(3,5l,5,4a,5a);
  1587. labels.rt(2,4r,4f,5f);
  1588. labels.top(1,2r,3r,4l,5r,4b,4e,5b,5e);
  1589. labels.bot(0,2l,3l,4,4c,4d,5c,5d);
  1590.  
  1591. ww:=w; % special hacks to get two on one
  1592. picture tmp; tmp:=currentpicture;
  1593. proofrule((w,-d.o_),(w,h.o_));
  1594. endgroup;
  1595.  
  1596. beginchar("I",6u#,ht#,0);
  1597. currentpicture:=tmp;
  1598. currenttransform:=currenttransform shifted(ww,0);
  1599. x1=x2=.5w; y1=h-y2; y2=slab;
  1600. serif(1,thick,-90,1.1jut,1.1jut); serif(2,thick,90,1.1jut,1.1jut);
  1601. fill serif_edge 2 -- reverse serif_edge 1 -- cycle;
  1602. w:=w+ww;
  1603. labels.lft(1a,2a,1l);
  1604. labels.rt(1f,2f,1,1r);
  1605. labels.top(2l,2,2r,2e,1c,1d);
  1606. labels.bot(2d,1b,1e);
  1607. makelabel("",z2b); makelabel("",z2c);
  1608. makelabel.rt.nodot("2b",z2b+(0,3));
  1609. makelabel.rt.nodot("2c",z2c-(0,3));
  1610. endchar;
  1611.  
  1612. currenttransform:=identity yscaled aspect_ratio;
  1613.  
  1614. "Figure A18b"; % H by outlines
  1615. clear_all;
  1616. def serif(suffix $)(expr breadth,theta,left_jut,right_jut)=
  1617.  penpos$(breadth/abs sind theta,0);
  1618. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1619. y$c=y$d; y$b=y$e=y$; y$b-y$c=if theta<0:-fi slab;
  1620. x$b=x$c=x$l-left_jut; x$d=x$e=x$r+right_jut;
  1621. enddef;
  1622.  
  1623. def serif_edge suffix $ =
  1624.  (serif_bracket($a,$l,$b)--z$c
  1625.   --z$d--reverse serif_bracket($f,$r,$e)) enddef;
  1626.  
  1627. def serif_bracket(suffix i,j,k) =
  1628.  (z.i{z.j-z.i}...serif_darkness[z.j,.5[z.i,z.k] ]{z.k-z.i}
  1629.   ...z.k{z.k-z.j}) enddef;
  1630.  
  1631. serif_darkness:=1/3;
  1632. slab#:=1/4pt#;
  1633. bracket#:=1pt#;
  1634. jut#:=.9pt#;
  1635. u#:=3/5pt#;
  1636. ht#:=7pt#;
  1637. thin#:=.5pt#;
  1638. thick#:=1.1pt#;
  1639. define_pixels(slab,bracket,jut,u,ht,thin,thick);
  1640.  
  1641. beginchar("H",13u#,ht#,0);
  1642. x1=x2=x5=3u; x3=x4=x6=w-x1; y1c=y3c=h; y2c=y4c=0;
  1643. serif(1,thick,-90,jut,jut);
  1644. serif(2,thick,90,jut,jut);
  1645. serif(3,thick,-90,jut,jut);
  1646. serif(4,thick,90,jut,jut);
  1647. fill serif_edge 2 -- reverse serif_edge 1 -- cycle;
  1648. fill serif_edge 4 -- reverse serif_edge 3 -- cycle;
  1649. penpos5(thin,90); penpos6(thin,90);
  1650. y5=y6=.52h; penstroke z5e--z6e;
  1651. labels.lft(1a,2a,3a,4a,5,1,2,1l,2l,3l,4l);
  1652. labels.rt(1f,2f,3f,4f,6,3,4,1r,2r,3r,4r);
  1653. labels.top(1c,1d,2b,2e,4b,4e,3c,3d,5r,6r);
  1654. labels.bot(1b,1e,2c,2d,4c,4d,3b,3e,5l,6l);
  1655. endchar;
  1656.  
  1657. "Figure 18d"; % AI by broadpen
  1658. clear_all;
  1659. def bot_serif(suffix $)(expr xx,theta,left_jut,right_jut)=
  1660.  penpos$(xx,0);
  1661. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1662. y$c=top y$l; y$d=y$r; x$c=x$l-left_jut; x$d=x$r+right_jut;
  1663. z$b=z$l+whatever*dir theta=z$c+whatever*dir phi;
  1664. z$e=z$r+whatever*dir theta=z$d+whatever*dir -phi;
  1665. enddef;
  1666.  
  1667. def top_serif(suffix $)(expr xx,theta,left_jut,right_jut)=
  1668.  penpos$(xx,0);
  1669. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1670. %y$c=top y$l; y$d=y$r; x$c=x$l-left_jut; x$d=x$r+right_jut;
  1671. y$c=y$d=y$; x$c=x$l-left_jut; x$d=x$r+right_jut;
  1672. z$b=z$l+whatever*dir theta=z$c+whatever*dir -phi;
  1673. z$e=z$r+whatever*dir theta=z$d+whatever*dir phi;
  1674. enddef;
  1675.  
  1676. def bot_serif_edge suffix $ =
  1677.  (z$a..controls z$b..z$c
  1678.  --(flex(z$c,.5[z$c,z$d]+dishing,z$d)) shifted (0,-epsilon)
  1679.  -- z$d..controls z$e..z$f) enddef;
  1680.  
  1681. def top_serif_edge suffix $ =
  1682.  (z$a..controls z$b..z$c
  1683.  --(flex(z$c,.5[z$c,z$d]-dishing,z$d)) shifted (0,+epsilon)
  1684.  -- z$d..controls z$e..z$f) enddef;
  1685.  
  1686. phi:=20;
  1687. pair dishing; dishing:=(1/4pt,0) rotated phi;
  1688. bracket#:=1pt#;
  1689. jut#:=.9pt#;
  1690. u#:=3/5pt#;
  1691. ht#:=7pt#;
  1692. px#:=.8pt#;
  1693. py#:=.2pt#;
  1694. xx#:=.3pt#;
  1695. define_pixels(bracket,jut,u,ht,px,py,xx);
  1696.  
  1697. pickup pensquare xscaled px yscaled py rotated phi; broad_pen:=savepen;
  1698.  
  1699. beginchar("A",13u#,ht#,0); pickup broad_pen;
  1700. z1=(.5w,top h); lft x4l=w-rt x5r=1.2u; y4l=y5r=0;
  1701. numeric theta[]; theta4=angle(z1-z4l); theta5=angle(z1-z5r);
  1702. numeric xxx;
  1703. px*sind(theta5-phi)+xxx*sind theta5 = px*cosd phi+xx;
  1704. bot_serif(4,0,theta4,.8jut,.8jut);
  1705. bot_serif(5,xxx,theta5,.6jut,.8jut);
  1706. z0=z4r+whatever*dir theta4=z5l+whatever*dir theta5;
  1707. filldraw z1--bot_serif_edge4--z0 & z0--bot_serif_edge5--z1 & cycle;
  1708. top y2=top y3=.45 bot y0; z2=whatever[z1,z4r]; z3=whatever[z1,z5l];
  1709. draw z2--z3;
  1710. labels.lft(4a,4b,4c,4,5l,5a,5c);
  1711. labels.rt(4f,4e,5r,5d,5e,5f);
  1712. labels.top(1,2,3,5b);
  1713. labels.bot(0,4d,5);
  1714.  
  1715. ww:=w; % special hacks to get two on one
  1716. picture tmp; tmp:=currentpicture;
  1717. proofrule((w,-d.o_),(w,h.o_));
  1718. endgroup;
  1719.  
  1720. beginchar("I",6u#,ht#,0); pickup broad_pen;
  1721. currentpicture:=tmp;
  1722. currenttransform:=currenttransform shifted(ww,0);
  1723. x1=x2=.5w; y1=h; y2=0;
  1724. top_serif(1,xx,-90,1.1jut,1.1jut);
  1725. bot_serif(2,xx,90,1.1jut,1.1jut);
  1726. filldraw bot_serif_edge 2 -- reverse top_serif_edge 1 -- cycle;
  1727. labels.lft(1l,2l,1a,1b,1c,2a,2b);
  1728. labels.rt(1r,2r,1d,1e,1f,2d,2e,2f);
  1729. labels.top(1);
  1730. labels.bot(2,2c);
  1731. w:=w+ww;
  1732. endchar;
  1733.  
  1734. currenttransform:=identity yscaled aspect_ratio;
  1735.  
  1736. "Figure A18c"; % H by broadpen
  1737. clear_all;
  1738. def bot_serif(suffix $)(expr xx,theta,left_jut,right_jut)=
  1739.  penpos$(xx,0);
  1740. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1741. y$c=top y$l; y$d=y$r; x$c=x$l-left_jut; x$d=x$r+right_jut;
  1742. z$b=z$l+whatever*dir theta=z$c+whatever*dir phi;
  1743. z$e=z$r+whatever*dir theta=z$d+whatever*dir -phi;
  1744. enddef;
  1745.  
  1746. def top_serif(suffix $)(expr xx,theta,left_jut,right_jut)=
  1747.  penpos$(xx,0);
  1748. z$a-z$l=z$f-z$r=(bracket/abs sind theta)*dir theta;
  1749. y$c=y$d=y$; x$c=x$l-left_jut; x$d=x$r+right_jut;
  1750. z$b=z$l+whatever*dir theta=z$c+whatever*dir -phi;
  1751. z$e=z$r+whatever*dir theta=z$d+whatever*dir phi;
  1752. enddef;
  1753.  
  1754. def bot_serif_edge suffix $ =
  1755.  (z$a..controls z$b..z$c
  1756.  --(flex(z$c,.5[z$c,z$d]+dishing,z$d))shifted (0,-epsilon)
  1757.  -- z$d..controls z$e..z$f) enddef;
  1758.  
  1759. def top_serif_edge suffix $ =
  1760.  (z$a..controls z$b..z$c
  1761.  --(flex(z$c,.5[z$c,z$d]-dishing,z$d))shifted (0,+epsilon)
  1762.  -- z$d..controls z$e..z$f) enddef;
  1763.  
  1764. phi:=20;
  1765. pair dishing; dishing:=(1/4pt,0) rotated phi;
  1766. bracket#:=1pt#;
  1767. jut#:=.9pt#;
  1768. u#:=3/5pt#;
  1769. ht#:=7pt#;
  1770. px#:=.8pt#;
  1771. py#:=.2pt#;
  1772. xx#:=.3pt#;
  1773. define_pixels(bracket,jut,u,ht,px,py,xx);
  1774.  
  1775. pickup pensquare xscaled px yscaled py rotated phi; broad_pen:=savepen;
  1776.  
  1777. beginchar("H",13u#,ht#,0); pickup broad_pen;
  1778. x1=x2=x5=3u; x3=x4=x6=w-x1; y1=y3=h; y2=y4=0;
  1779. top_serif(1,xx,-90,jut,jut);
  1780. bot_serif(2,xx,90,jut,jut);
  1781. top_serif(3,xx,-90,jut,jut);
  1782. bot_serif(4,xx,90,jut,jut);
  1783. filldraw bot_serif_edge 2 -- reverse top_serif_edge 1 -- cycle;
  1784. filldraw bot_serif_edge 4 -- reverse top_serif_edge 3 -- cycle;
  1785. y5=y6=.52h; draw z5--z6;
  1786. labels.lft(l1,2l,3l,4l,1a,1b,1c,2a,2b,2c,3a,3b,3c,4a,4b,4c);
  1787. labels.rt(1r,2r,3r,4r,1d,1e,1f,2d,2e,2f,3d,3e,3f,4d,4e,4f);
  1788. labels.top(1,3);
  1789. labels.bot(2,4,5,6);
  1790. endchar;
  1791.  
  1792. currenttransform:=identity yscaled aspect_ratio;
  1793.  
  1794. "Figure 20a"; % example of `solve'
  1795. clear_all;
  1796. z1=(0,25); z2=(100,100); z3=(300,100); z4=(320,0);
  1797. vardef upward(expr x)=
  1798.  ypart direction 1 of (z1{z2-z1}..(x,y2)..{z4-z3}z4)>0 enddef;
  1799. z=(solve upward(x2,x3),y2);
  1800. pickup pencircle scaled 4;
  1801. draw z1{z2-z1}..z..{z4-z3}z4;
  1802. pickup pencircle scaled 2;
  1803. draw z1--z2; draw z3--z4;
  1804. makelabel.lft("z1 ",z1);
  1805. makelabel.lft("z2 ",z2);
  1806. makelabel.rt(" z3",z3);
  1807. makelabel.rt(" z4",z4);
  1808. makelabel.top.nodot("z",z+(0,2));
  1809. forsuffixes $=1,2,3,4,: heavy_dot z$; endfor
  1810. showit;
  1811. shipit;
  1812.  
  1813. "Figure 21a"; % N of METAFONT logo
  1814. alpha:=.45;  % controls bar location and similar things
  1815. beta:=.2;  % controls squareness of bowls
  1816. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  1817. numeric leftstemloc, barheight;
  1818.   h#=6;  % height of characters, in pt
  1819.   xx#=0.6;  % extra length of certain features, in pt
  1820.   u#=4/9;  % unit width, in pt
  1821.   s#=0;  % extra sidebar, in pt
  1822.   o#=1/9;  % overshoot of curves, in pt
  1823.   ph#=2/3;  % horizontal thickness of pen, in pt
  1824. yy#=xx#; define_whole_pixels(xx,yy);
  1825. define_pixels(s,u);
  1826. define_corrected_pixels(o);
  1827. pv#=.9ph#; define_blacker_pixels(ph,pv);
  1828. pickup pencircle xscaled ph yscaled pv;
  1829. logo_pen:=savepen;
  1830. leftstemloc:=good.x((2.5u#+s#)*pt);
  1831. barheight:=good.y(alpha*h#*pt);
  1832. def beginlogochar(expr c)(expr n) = % code c; width is n units plus sidebars
  1833.   beginchar(c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  1834.  
  1835. beginlogochar("N",15);
  1836. x1+x4=x1+x3=x2+x5=w; x1=x2=leftstemloc;
  1837. y1=y4=y3-yy; bot.y1=-o; y2=y5; top.y5=h+o;
  1838. draw z1--z2--z3; draw z4..z5;
  1839. labels.top(1,3,4);
  1840. labels.bot(2,5);
  1841. endchar;
  1842.  
  1843. "Figure 21b"; % random N of METAFONT logo, nine-point size
  1844. randomseed:=1;
  1845.  
  1846. vardef noise=normaldeviate*.1pt enddef;
  1847.  
  1848. ht#:=.9*6pt#;
  1849. xgap#:=.9*0.6pt#;
  1850. u#:=.91*4/9pt#;
  1851. s#:=.08pt#;
  1852. o#:=1/10pt#;
  1853. px#:=.9*2/3pt#;
  1854. ygap#:=(ht#/13.5u#)*xgap#;
  1855. leftstemloc#:=2.5u#+s#;
  1856. barheight#:=.45ht#;
  1857. define_pixels(s,u,xgap,ygap,leftstemloc,barheight);
  1858. py#:=.9px#; define_blacker_pixels(px,py);
  1859. pickup pencircle xscaled px yscaled py; logo_pen:=savepen;
  1860. define_corrected_pixels(o);
  1861.  
  1862. def beginlogochar(expr c,n) =
  1863.  beginchar(c,n*u#+2s#,ht#,0); pickup logo_pen enddef;
  1864.  
  1865. beginlogochar("N",15);
  1866. x1=leftstemloc+noise;
  1867. x2=leftstemloc+noise;
  1868. x4=w-leftstemloc+noise;
  1869. x5=w-leftstemloc+noise;
  1870. bot y1=noise-o;
  1871. top y2=h+o+noise;
  1872. y3=y4+ygap+noise;
  1873. bot y4=noise-o;
  1874. top y5=h+o+noise;
  1875. z3=whatever[z4,z5];
  1876. draw z1--z2--z3; draw z4--z5;
  1877. labels.top(1,3,4);
  1878. labels.bot(2,5);
  1879. endchar;
  1880.  
  1881. "Figure 21c"; % random N of METAFONT logo, nine-point size
  1882. randomseed:=2;
  1883.  
  1884. vardef noise=normaldeviate*.1pt enddef;
  1885.  
  1886. ht#:=.9*6pt#;
  1887. xgap#:=.9*0.6pt#;
  1888. u#:=.91*4/9pt#;
  1889. s#:=.08pt#;
  1890. o#:=1/10pt#;
  1891. px#:=.9*2/3pt#;
  1892. ygap#:=(ht#/13.5u#)*xgap#;
  1893. leftstemloc#:=2.5u#+s#;
  1894. barheight#:=.45ht#;
  1895. define_pixels(s,u,xgap,ygap,leftstemloc,barheight);
  1896. py#:=.9px#; define_blacker_pixels(px,py);
  1897. pickup pencircle xscaled px yscaled py; logo_pen:=savepen;
  1898. define_corrected_pixels(o);
  1899.  
  1900. def beginlogochar(expr c,n) =
  1901.  beginchar(c,n*u#+2s#,ht#,0); pickup logo_pen enddef;
  1902.  
  1903. beginlogochar("N",15);
  1904. x1=leftstemloc+noise;
  1905. x2=leftstemloc+noise;
  1906. x4=w-leftstemloc+noise;
  1907. x5=w-leftstemloc+noise;
  1908. bot y1=noise-o;
  1909. top y2=h+o+noise;
  1910. y3=y4+ygap+noise;
  1911. bot y4=noise-o;
  1912. top y5=h+o+noise;
  1913. z3=whatever[z4,z5];
  1914. draw z1--z2--z3; draw z4--z5;
  1915. labels.top(1,3,4);
  1916. labels.bot(2,5);
  1917. endchar;
  1918.  
  1919. "Figure 21d"; % random N of METAFONT logo, nine-point size
  1920. randomseed:=3;
  1921.  
  1922. vardef noise=normaldeviate*.1pt enddef;
  1923.  
  1924. ht#:=.9*6pt#;
  1925. xgap#:=.9*0.6pt#;
  1926. u#:=.91*4/9pt#;
  1927. s#:=.08pt#;
  1928. o#:=1/10pt#;
  1929. px#:=.9*2/3pt#;
  1930. ygap#:=(ht#/13.5u#)*xgap#;
  1931. leftstemloc#:=2.5u#+s#;
  1932. barheight#:=.45ht#;
  1933. define_pixels(s,u,xgap,ygap,leftstemloc,barheight);
  1934. py#:=.9px#; define_blacker_pixels(px,py);
  1935. pickup pencircle xscaled px yscaled py; logo_pen:=savepen;
  1936. define_corrected_pixels(o);
  1937.  
  1938. def beginlogochar(expr c,n) =
  1939.  beginchar(c,n*u#+2s#,ht#,0); pickup logo_pen enddef;
  1940.  
  1941. beginlogochar("N",15);
  1942. x1=leftstemloc+noise;
  1943. x2=leftstemloc+noise;
  1944. x4=w-leftstemloc+noise;
  1945. x5=w-leftstemloc+noise;
  1946. bot y1=noise-o;
  1947. top y2=h+o+noise;
  1948. y3=y4+ygap+noise;
  1949. bot y4=noise-o;
  1950. top y5=h+o+noise;
  1951. z3=whatever[z4,z5];
  1952. draw z1--z2--z3; draw z4--z5;
  1953. labels.top(1,3,4);
  1954. labels.bot(2,5);
  1955. endchar;
  1956.  
  1957. "Figure 24a"; % Ionian O at 200 pixels/inch
  1958. ss:=10;
  1959. begingroup interim hppp:=200/72.27;  % lowres parameters
  1960. interim blacker:=.65;      % make pens a bit blacker
  1961. interim o_correction:=.4;    % but don't overshoot as much
  1962.  em#:=10pt#; cap#:=7pt#;
  1963.  thin#:=1/3pt#; thick#:=5/6pt#;
  1964.  o#:=1/5pt#;
  1965. define_pixels(em,cap);
  1966. define_blacker_pixels(thin,thick);
  1967. define_corrected_pixels(o);
  1968.  curve_sidebar:=round 1/18em;
  1969. pair u,uu,v;
  1970. beginchar("O",0.8em#,cap#,0);
  1971.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  1972.  penpos3(thick,180+10); penpos4(thin,270-10);
  1973.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  1974.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  1975.  penstroke (z1e{down}..z2e{right}
  1976.             ..z3e{up}..z4e{left}..cycle) scaled ss;
  1977. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  1978. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  1979. proofrulethickness 1;
  1980. forsuffixes e=l,r:
  1981.  u:=round((point 0 of path_.e)/ss);
  1982.  for t=0 step 1/64 until 4:
  1983.   v:=round((point t of path_.e)/ss);
  1984.   if u<>v: if abs(u-v)=1: proofrule(u*ss,v*ss);
  1985.   else: del:=1/128; tt:=t-del;
  1986.    forever: uu:=round((point tt of path_.e)/ss);
  1987.     exitif abs(u-uu)=1;
  1988.     if del=epsilon:ddt;fi
  1989.     del:=del/2;
  1990.     tt:=tt if uu=u:+ else:-fi del; endfor
  1991.    proofrule(u*ss,uu*ss); proofrule(uu*ss,v*ss); fi
  1992.    u:=v; fi endfor
  1993.  endfor
  1994. showit;
  1995. shipit;
  1996. endgroup;
  1997. endgroup;
  1998. numeric u,uu,v;
  1999.  
  2000. "Figure 24b"; % Ionian O at 200 pixels/inch, unrounded position
  2001. ss:=10;
  2002. begingroup interim hppp:=200/72.27;  % lowres parameters
  2003. interim blacker:=.65;      % make pens a bit blacker
  2004. interim o_correction:=.4;    % but don't overshoot as much
  2005.  em#:=10pt#; cap#:=7pt#;
  2006.  thin#:=1/3pt#; thick#:=5/6pt#;
  2007.  o#:=1/5pt#;
  2008. define_pixels(em,cap);
  2009. define_blacker_pixels(thin,thick);
  2010. define_corrected_pixels(o);
  2011.  curve_sidebar:= 1/18em;
  2012. pair u,uu,v;
  2013. beginchar("O",0.8em#,cap#,0);
  2014.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2015.  penpos3(thick,180+10); penpos4(thin,270-10);
  2016.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2017.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2018.  penstroke (z1e{down}..z2e{right}
  2019.             ..z3e{up}..z4e{left}..cycle) scaled ss;
  2020. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2021. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2022. proofrulethickness 1;
  2023. forsuffixes e=l,r:
  2024.  u:=round((point 0 of path_.e)/ss);
  2025.  for t=0 step 1/64 until 4:
  2026.   v:=round((point t of path_.e)/ss);
  2027.   if u<>v: if abs(u-v)=1: proofrule(u*ss,v*ss);
  2028.   else: del:=1/128; tt:=t-del;
  2029.    forever: uu:=round((point tt of path_.e)/ss);
  2030.     exitif abs(u-uu)=1;
  2031.     if del=epsilon:ddt;fi
  2032.     del:=del/2;
  2033.     tt:=tt if uu=u:+ else:-fi del; endfor
  2034.    proofrule(u*ss,uu*ss); proofrule(uu*ss,v*ss); fi
  2035.    u:=v; fi endfor
  2036.  endfor
  2037. showit;
  2038. shipit;
  2039. endgroup;
  2040. endgroup;
  2041. numeric u,uu,v;
  2042.  
  2043. "Figure 24c"; % Fig 24b shifted right .05 pixel
  2044. ss:=10;
  2045. begingroup interim hppp:=200/72.27;  % lowres parameters
  2046. interim blacker:=.65;      % make pens a bit blacker
  2047. interim o_correction:=.4;    % but don't overshoot as much
  2048.  em#:=10pt#; cap#:=7pt#;
  2049.  thin#:=1/3pt#; thick#:=5/6pt#;
  2050.  o#:=1/5pt#;
  2051. define_pixels(em,cap);
  2052. define_blacker_pixels(thin,thick);
  2053. define_corrected_pixels(o);
  2054.  curve_sidebar:= 1/18em;
  2055. pair u,uu,v;
  2056. beginchar("O",0.8em#,cap#,0);
  2057.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2058.  penpos3(thick,180+10); penpos4(thin,270-10);
  2059.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2060.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2061.  penstroke (z1e{down}..z2e{right}
  2062.             ..z3e{up}..z4e{left}..cycle) shifted (.05,0) scaled ss;
  2063. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2064. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2065. proofrulethickness 1;
  2066. forsuffixes e=l,r:
  2067.  u:=round((point 0 of path_.e)/ss);
  2068.  for t=0 step 1/64 until 4:
  2069.   v:=round((point t of path_.e)/ss);
  2070.   if u<>v: if abs(u-v)=1: proofrule(u*ss,v*ss);
  2071.   else: del:=1/128; tt:=t-del;
  2072.    forever: uu:=round((point tt of path_.e)/ss);
  2073.     exitif abs(u-uu)=1;
  2074.     if del=epsilon:ddt;fi
  2075.     del:=del/2;
  2076.     tt:=tt if uu=u:+ else:-fi del; endfor
  2077.    proofrule(u*ss,uu*ss); proofrule(uu*ss,v*ss); fi
  2078.    u:=v; fi endfor
  2079.  endfor
  2080. showit;
  2081. shipit;
  2082. endgroup;
  2083. endgroup;
  2084. numeric u,uu,v;
  2085.  
  2086. "Figure 24d"; % Fig 24c shifted right .05 pixel
  2087. ss:=10;
  2088. begingroup interim hppp:=200/72.27;  % lowres parameters
  2089. interim blacker:=.65;      % make pens a bit blacker
  2090. interim o_correction:=.4;    % but don't overshoot as much
  2091.  em#:=10pt#; cap#:=7pt#;
  2092.  thin#:=1/3pt#; thick#:=5/6pt#;
  2093.  o#:=1/5pt#;
  2094. define_pixels(em,cap);
  2095. define_blacker_pixels(thin,thick);
  2096. define_corrected_pixels(o);
  2097.  curve_sidebar:= 1/18em;
  2098. pair u,uu,v;
  2099. beginchar("O",0.8em#,cap#,0);
  2100.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2101.  penpos3(thick,180+10); penpos4(thin,270-10);
  2102.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2103.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2104.  penstroke (z1e{down}..z2e{right}
  2105.             ..z3e{up}..z4e{left}..cycle) shifted (.1,0) scaled ss;
  2106. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2107. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2108. proofrulethickness 1;
  2109. forsuffixes e=l,r:
  2110.  u:=round((point 0 of path_.e)/ss);
  2111.  for t=0 step 1/64 until 4:
  2112.   v:=round((point t of path_.e)/ss);
  2113.   if u<>v: if abs(u-v)=1: proofrule(u*ss,v*ss);
  2114.   else: del:=1/128; tt:=t-del;
  2115.    forever: uu:=round((point tt of path_.e)/ss);
  2116.     exitif abs(u-uu)=1;
  2117.     if del=epsilon:ddt;fi
  2118.     del:=del/2;
  2119.     tt:=tt if uu=u:+ else:-fi del; endfor
  2120.    proofrule(u*ss,uu*ss); proofrule(uu*ss,v*ss); fi
  2121.    u:=v; fi endfor
  2122.  endfor
  2123. showit;
  2124. shipit;
  2125. endgroup;
  2126. endgroup;
  2127. numeric u,uu,v;
  2128.  
  2129. "Figure 24e"; % hash mark
  2130. numeric u;
  2131. u#:=10/18pt#; define_pixels(u);
  2132. beginchar(0,15u#,250/36pt#,70/36pt#);
  2133. pickup pencircle scaled (.4pt+blacker);
  2134. lft x1=round u-eps; x3=x1; x2=x4=w-x1;
  2135. y1=y2=good.y(.5[-d,h]+1.1pt); y3=y4=h-d-y1;
  2136. draw z1--z2; draw z3--z4;
  2137. lft x6=round 3u; x7=w-x6;
  2138. x8=good.x .5w; x5-x6=x7-x8;
  2139. top y5=top y7=h+eps; bot y6=bot y8=-d-eps;
  2140. draw z5--z6; draw z7--z8;
  2141. labels.top(6,8);
  2142. labels.bot(5,7);
  2143. labels.lft(2,4);
  2144. labels.rt(1,3);
  2145. endchar;
  2146.  
  2147. "Figure 24f"; % Ionian O at 200 pixels/inch, autorounding=1
  2148. ss:=10;
  2149. begingroup interim hppp:=200/72.27;  % lowres parameters
  2150. interim blacker:=.65;      % make pens a bit blacker
  2151. interim o_correction:=.4;    % but don't overshoot as much
  2152.  em#:=10pt#; cap#:=7pt#;
  2153.  thin#:=1/3pt#; thick#:=5/6pt#;
  2154.  o#:=1/5pt#;
  2155. define_pixels(em,cap);
  2156. define_blacker_pixels(thin,thick);
  2157. define_corrected_pixels(o);
  2158.  curve_sidebar:= 1/18em;
  2159. interim autorounding:=1;
  2160. interim granularity:=10;
  2161. beginchar("O",0.8em#,cap#,0);
  2162.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2163.  penpos3(thick,180+10); penpos4(thin,270-10);
  2164.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2165.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2166.  penstroke (z1e{down}..z2e{right}
  2167.             ..z3e{up}..z4e{left}..cycle) scaled ss;
  2168. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2169. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2170. proofrulethickness 1;
  2171. pair u;
  2172. for v= % pairs gotten from tracingedges on a separate run!
  2173. (2,9), (2,6), (3,6), (3,4), (4,4), (4,3), (5,3), (5,2), (6,2),
  2174. (6,1), (8,1), (8,0), (14,0), (14,1), (16,1), (16,2), (17,2), (17,3),
  2175. (18,3), (18,4), (19,4), (19,7), (20,7), (20,13), (19,13), (19,15),
  2176. (18,15), (18,16), (17,16), (17,17), (16,17), (16,18), (14,18), (14,19),
  2177. (8,19), (8,18), (6,18), (6,17), (5,17), (5,16), (4,16), (4,15), (3,15),
  2178. (3,12), (2,12), (2,9)
  2179. :if known u: proofrule(u*ss,v*ss) ; fi
  2180. u:=v; endfor
  2181.  
  2182. pair u;
  2183. for v=
  2184. (4,9), (4,7), (5,7), (5,5), (6,5),
  2185. (6,4), (7,4), (7,3), (9,3), (9,2), (14,2), (14,3), (15,3), (15,4), (16,4),
  2186. (16,5), (17,5), (17,7), (18,7), (18,12), (17,12), (17,14), (16,14),
  2187. (16,15), (15,15), (15,16), (13,16), (13,17), (8,17), (8,16), (7,16),
  2188. (7,15), (6,15), (6,14), (5,14), (5,12), (4,12), (4,9)
  2189. :if known u: proofrule(u*ss,v*ss) ; fi
  2190. u:=v; endfor
  2191. showit;
  2192. shipit;
  2193. endgroup;
  2194. endgroup;
  2195. numeric u;
  2196.  
  2197. "Figure 24g"; % Ionian O at 200 pixels/inch, autorounding=2
  2198. ss:=10;
  2199. begingroup interim hppp:=200/72.27;  % lowres parameters
  2200. interim blacker:=.65;      % make pens a bit blacker
  2201. interim o_correction:=.4;    % but don't overshoot as much
  2202.  em#:=10pt#; cap#:=7pt#;
  2203.  thin#:=1/3pt#; thick#:=5/6pt#;
  2204.  o#:=1/5pt#;
  2205. define_pixels(em,cap);
  2206. define_blacker_pixels(thin,thick);
  2207. define_corrected_pixels(o);
  2208.  curve_sidebar:= 1/18em;
  2209. interim autorounding:=2;
  2210. interim granularity:=10;
  2211. beginchar("O",0.8em#,cap#,0);
  2212.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2213.  penpos3(thick,180+10); penpos4(thin,270-10);
  2214.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2215.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2216.  penstroke (z1e{down}..z2e{right}
  2217.             ..z3e{up}..z4e{left}..cycle) scaled ss;
  2218. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2219. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2220. proofrulethickness 1;
  2221. pair u;
  2222. for v=
  2223. (2,9), (2,6), (3,6),
  2224. (3,4), (4,4), (4,3), (5,3), (5,2), (6,2), (6,1), (8,1), (8,0), (14,0),
  2225. (14,1), (16,1), (16,2), (17,2), (17,3), (18,3), (18,4), (19,4), (19,7),
  2226. (20,7), (20,13), (19,13), (19,15), (18,15), (18,16), (17,16), (17,17),
  2227. (16,17), (16,18), (14,18), (14,19), (8,19), (8,18), (6,18), (6,17),
  2228. (5,17), (5,16), (4,16), (4,15), (3,15), (3,12), (2,12), (2,9)
  2229. :if known u: proofrule(u*ss,v*ss) ; fi
  2230. u:=v; endfor
  2231.  
  2232. pair u;
  2233. for v=
  2234. (4,9), (4,7), (5,7), (5,5), (6,5),
  2235. (6,4), (7,4), (7,3), (9,3), (9,2), (13,2), (13,3), (15,3), (15,4), (16,4),
  2236. (16,5), (17,5), (17,7), (18,7), (18,12), (17,12), (17,14), (16,14),
  2237. (16,15), (15,15), (15,16), (13,16), (13,17), (9,17), (9,16), (7,16),
  2238. (7,15), (6,15), (6,14), (5,14), (5,12), (4,12), (4,9)
  2239. :if known u: proofrule(u*ss,v*ss) ; fi
  2240. u:=v; endfor
  2241. showit;
  2242. shipit;
  2243. endgroup;
  2244. endgroup;
  2245. numeric u;
  2246.  
  2247. "Figure 24h"; % Ionian O at 200 pixels/inch, autorounding=0, smoothing=1
  2248. ss:=10;
  2249. begingroup interim hppp:=200/72.27;  % lowres parameters
  2250. interim blacker:=.65;      % make pens a bit blacker
  2251. interim o_correction:=.4;    % but don't overshoot as much
  2252.  em#:=10pt#; cap#:=7pt#;
  2253.  thin#:=1/3pt#; thick#:=5/6pt#;
  2254.  o#:=1/5pt#;
  2255. define_pixels(em,cap);
  2256. define_blacker_pixels(thin,thick);
  2257. define_corrected_pixels(o);
  2258.  curve_sidebar:= 1/18em;
  2259. beginchar("O",0.8em#,cap#,0);
  2260.  penpos1(thick,10); penpos2(.1[thin,thick],90-10);
  2261.  penpos3(thick,180+10); penpos4(thin,270-10);
  2262.  x1l=w-x3l=curve_sidebar; x2=x4=.5w;
  2263.  y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
  2264.  penstroke (z1e{down}..z2e{right}
  2265.             ..z3e{up}..z4e{left}..cycle) scaled ss;
  2266. for m=0 upto w: proofrule((m*ss,0),(m*ss,h*ss)); endfor
  2267. for n=0 upto h: proofrule((0,n*ss),(w*ss,n*ss)); endfor
  2268. proofrulethickness 1;
  2269. pair u;
  2270. for v=
  2271. (2,9), (2,5), (3,5),
  2272. (3,3), (4,3), (4,2), (6,2), (6,1), (8,1), (8,0), (14,0), (14,1), (16,1),
  2273. (16,2), (17,2), (17,3), (18,3), (18,4), (19,4), (19,6), (20,6), (20,14),
  2274. (19,14), (19,16), (18,16), (18,17), (16,17), (16,18), (14,18), (14,19),
  2275. (8,19), (8,18), (6,18), (6,17), (5,17), (5,16), (4,16), (4,15), (3,15),
  2276. (3,13), (2,13), (2,9)
  2277. :if known u: proofrule(u*ss,v*ss) ; fi
  2278. u:=v; endfor
  2279.  
  2280. pair u;
  2281. for v=
  2282. (4,10), (4,9), (5,9), (5,5), (6,5),
  2283. (6,4), (7,4), (7,3), (8,3), (8,2), (14,2), (14,3), (15,3), (15,4), (16,4),
  2284. (16,6), (17,6), (17,8), (18,8), (18,10), (17,10), (17,13), (16,13),
  2285. (16,15), (15,15), (15,16), (14,16), (14,17), (8,17), (8,16), (7,16),
  2286. (7,15), (6,15), (6,13), (5,13), (5,11), (4,11), (4,10)
  2287. :if known u: proofrule(u*ss,v*ss) ; fi
  2288. u:=v; endfor
  2289. showit;
  2290. shipit;
  2291. endgroup;
  2292. endgroup;
  2293. numeric u;
  2294.  
  2295. "Figure 27a"; % Modification of Fig. 14b
  2296. clear_all;
  2297. pair zz[];
  2298. zz1=(0,509);
  2299. zz2=(-14,492);
  2300. zz3=(-32,481);
  2301. zz4=(-42,455);
  2302. zz5=(-62,430);
  2303. zz6=(-20,452);
  2304. zz7=(42,448);
  2305. zz8=(38,465);
  2306. zz9=(4,493);
  2307. for n=1 upto 9: z[n-1]=(zz[n]+(62,-430)) scaled 2.5; heavy_dot z[n-1]; endfor
  2308. pickup pencircle scaled 3;
  2309. draw flex(z0,z1,z2)&flex(z2,z3,z4)
  2310.  &flex(z4,z5,z6)&flex(z6,z7,z8,z0)&cycle;
  2311. labels.lft(1,2,3,4);
  2312. labels.rt(0,6,7,8);
  2313. labels.bot(5);
  2314. showit; shipit;
  2315.  
  2316. "Figure Da"; % Neenie's problem
  2317. clear_all;
  2318. z1l=(0,240-y); z1r=(15,288-y);
  2319. z0l-z0r=z1l-z1r; z0r=(144,189-y); y0l=0;
  2320. pickup pencircle scaled 2;
  2321. numeric a,b,c,d;
  2322. a=x1l; b=y1r; (c,d)=z0r;
  2323. draw z0l--z0r--z1r--z1l--cycle;
  2324. proofrule((a,d),(a,b)); proofrule((a,b),(a-d+b,b));
  2325. for z=z0l,z0r,z1l,z1r,(a,b): heavy_dot z; endfor
  2326. makelabel.bot.nodot("<=",z1r+(3,-8));
  2327. makelabel.lft("(a,b)",(a,b));
  2328. makelabel.top("z1r",z1r);
  2329. makelabel.lft("z1l",z1l);
  2330. makelabel.rt("(c,d)",z0r);
  2331. makelabel.lft("z0r ",z0r);
  2332. makelabel.lft("z0l ",z0l);
  2333. showit; shipit;
  2334.  
  2335. "Figure Ea"; % T of METAFONT logo, with italic correction
  2336. alpha:=.45;  % controls bar location and similar things
  2337. beta:=.2;  % controls squareness of bowls
  2338. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  2339. numeric leftstemloc, barheight;
  2340.   h#=6;  % height of characters, in pt
  2341.   xx#=0.6;  % extra length of certain features, in pt
  2342.   u#=4/9;  % unit width, in pt
  2343.   s#=0;  % extra sidebar, in pt
  2344.   o#=1/9;  % overshoot of curves, in pt
  2345.   ph#=2/3;  % horizontal thickness of pen, in pt
  2346. yy#=xx#; define_whole_pixels(xx,yy);
  2347. define_pixels(s,u);
  2348. define_corrected_pixels(o);
  2349. pv#=.9ph#; define_blacker_pixels(ph,pv);
  2350. pickup pencircle xscaled ph yscaled pv;
  2351. logo_pen:=savepen;
  2352. leftstemloc:=good.x((2.5u#+s#)*pt);
  2353. barheight:=good.y(alpha*h#*pt);
  2354. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  2355.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  2356. slant:=0;
  2357.  
  2358. beginlogochar(T,13);
  2359. italcorr h#*slant+.5u#;
  2360. if odd(w-ph): w:=w+1; fi  % allows a symmetric stem
  2361. x1+x2=2x3=2x4=w; lft.x1=-epsilon; % I tried s-o instead; was not as good
  2362. y1=y2=y3; top.y1=h; bot.y4=-o;
  2363. draw z1..z2; draw z3..z4;
  2364. labels.rt(2,3);
  2365. makelabel.top("1",z1);
  2366. makelabel.top("4",z4);
  2367. endchar;
  2368.  
  2369. "Figure Eb"; % F of METAFONT logo
  2370. alpha:=.45;  % controls bar location and similar things
  2371. beta:=.2;  % controls squareness of bowls
  2372. numeric h#, xx#, yy#, o#, s#, u#, ph#, pv#;
  2373. numeric leftstemloc, barheight;
  2374.   h#=6;  % height of characters, in pt
  2375.   xx#=0.6;  % extra length of certain features, in pt
  2376.   u#=4/9;  % unit width, in pt
  2377.   s#=0;  % extra sidebar, in pt
  2378.   o#=1/9;  % overshoot of curves, in pt
  2379.   ph#=2/3;  % horizontal thickness of pen, in pt
  2380. yy#=xx#; define_whole_pixels(xx,yy);
  2381. define_pixels(s,u);
  2382. define_corrected_pixels(o);
  2383. pv#=.9ph#; define_blacker_pixels(ph,pv);
  2384. pickup pencircle xscaled ph yscaled pv;
  2385. logo_pen:=savepen;
  2386. leftstemloc:=good.x((2.5u#+s#)*pt);
  2387. barheight:=good.y(alpha*h#*pt);
  2388. def beginlogochar(suffix c)(expr n) = % code c; width is n units plus sidebars
  2389.   beginchar(str c,n*u#+2s#,h#,0); pickup logo_pen enddef;
  2390.  
  2391. beginlogochar(F,14);
  2392. x1=x2=x3=leftstemloc; x4=w-x1+o; x5=x4-xx;
  2393. y2=y5; y3=y4; bot.y1=-o; top.y3=h; y2=barheight;
  2394. draw z1--z3--z4; draw z2--z5;
  2395. labels.rt(2,3);
  2396. labels.lft(4,5);
  2397. labels.top(1);
  2398. endchar;
  2399.  
  2400. "Figure Ec"; % cmr10 period
  2401. u#:=20/36pt#;
  2402. dot_diam#:=38/36pt#;
  2403. body_height#:=270/36pt#;  % height of tallest characters
  2404. asc_height#:=250/36pt#;    % height of lowercase ascenders
  2405. x_height#:=155/36pt#;    % height of lowercase without ascenders
  2406. bar_height#:=87/36pt#;    % height of crossbar in lowercase e
  2407. desc_depth#:=70/36pt#;    % depth of lowercase descenders
  2408. body_depth#:=90/36pt#;
  2409. fine#:=7/36pt#;
  2410.  
  2411. define_pixels(u);
  2412. define_whole_blacker_pixels(dot_diam,fine);
  2413. define_whole_vertical_pixels(body_height,asc_height,x_height,bar_height,
  2414.  desc_depth,body_depth);
  2415.  
  2416. beginchar(".",5u#,dot_diam#,0);
  2417. def makebox(text rule) =
  2418.  for y=0,asc_height,body_height,x_height,bar_height,-desc_depth,-body_depth:
  2419.   rule((0,y),(w,y)); endfor % horizontals
  2420.  for x=0,w:   rule((x,-body_depth),(x,body_height)); endfor % verticals
  2421.  for x=u step u until w-1:
  2422.   rule((x,-body_depth),(x,body_height)); endfor % more verticals
  2423.  if charic<>0:
  2424.   rule((w+charic*pt,h.o_),(w+charic*pt,.5h.o_)); fi % italic correction
  2425.  enddef;
  2426. pickup pencircle scaled fine;
  2427. penpos1(dot_diam-fine,0); penpos2(dot_diam-fine,90);
  2428. x1l=good.x(x1l+.5w-x1); bot y2l=0; z1=z2;
  2429. filldraw z1l...z2l...z1r...z2r...cycle; % roundish dot
  2430. labels.lft(1,1l);
  2431. labels.rt(2,1r);
  2432. labels.top(2r);
  2433. labels.bot(2l);
  2434. endchar;
  2435.  
  2436. "Figure Ed"; % cmr10 emdash
  2437. u#:=20/36pt#;
  2438. dot_diam#:=38/36pt#;
  2439. body_height#:=270/36pt#;  % height of tallest characters
  2440. asc_height#:=250/36pt#;    % height of lowercase ascenders
  2441. x_height#:=155/36pt#;    % height of lowercase without ascenders
  2442. bar_height#:=87/36pt#;    % height of crossbar in lowercase e
  2443. desc_depth#:=70/36pt#;    % depth of lowercase descenders
  2444. body_depth#:=90/36pt#;
  2445. vair#:=8/36pt#;      % vertical diameter of hairlines
  2446.  
  2447. define_pixels(u);
  2448. define_whole_blacker_pixels(dot_diam,vair);
  2449. define_whole_vertical_pixels(body_height,asc_height,x_height,bar_height,
  2450.  desc_depth,body_depth);
  2451.  
  2452. beginchar(oct"174",18u#,x_height#,0);
  2453. def makebox(text rule) =
  2454.  for y=0,asc_height,body_height,x_height,bar_height,-desc_depth,-body_depth:
  2455.   rule((0,y),(w,y)); endfor % horizontals
  2456.  for x=0,w:   rule((x,-body_depth),(x,body_height)); endfor % verticals
  2457.  for x=u step u until w-1:
  2458.   rule((x,-body_depth),(x,body_height)); endfor % more verticals
  2459.  if charic<>0:
  2460.   rule((w+charic*pt,h.o_),(w+charic*pt,.5h.o_)); fi % italic correction
  2461.  enddef;
  2462. italcorr .61803x_height#*0 + .5u#;
  2463. pickup nullpen;
  2464. penpos1(vair,90); penpos2(vair,90);
  2465. y1r=y2r=good.y(y1r+.61803h-y1);
  2466. lft x1=-eps; rt x2=w+eps;
  2467. penstroke z1e--z2e;                                   % crossbar
  2468. labels.lft(1);
  2469. labels.rt(2);
  2470. labels.top(1r,2r);
  2471. labels.bot(1l,2l);
  2472. endchar;
  2473.  
  2474. bye
  2475.