home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / bbs / programs / amiga / metafont.lha / MF / INPUTS / MANUAL / KNUTH.MF < prev    next >
Text File  |  1993-11-28  |  7KB  |  200 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %% 09.12.1991: Andreas Scherer                                              %%
  3. %% Einige der Uebungen aus dem Metafontbook von D.E.K.                      %%
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. font_identifier "KNUTH";
  6.  
  7. font_size 10pt#;
  8.  
  9. mode_setup;
  10.  
  11. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  12. %% Metafontbook Seite 18.                                                   %%
  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  14. beginchar("a",3cm#,3cm#,0pt#);
  15.   pickup pencircle scaled .1pt;
  16.  
  17.   for d = 0 step 10 until 120:
  18.     draw (0,0){dir 60}..{dir -d}(w,0); endfor;
  19. endchar;
  20.  
  21. beginchar("b",3cm#,3cm#,0pt#);
  22.   pickup pencircle scaled .1pt;
  23.  
  24.   for d = 0 step -10 until -90:
  25.     draw (0,0){dir 60}..{dir -d}(w,0); endfor;
  26. endchar;
  27.  
  28. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29. %% Metafontbook Seite 134.                                                  %%
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  31. beginchar("c",2cm#,2cm#,0pt#);
  32.   path heart,p;
  33.  
  34.   pickup pencircle scaled .1pt;
  35.  
  36.   heart = (100,162)..(140,178){right}..(195,125){down}..(100,0){curl0}
  37.     ..{up}(5,125)..{right}(60,178)..(100,162);
  38.  
  39.   p = (100,0)--(300,0)--(200,0)--(100,0)--(0,0)--(-100,0)--(100,0);
  40.  
  41.   for n = 0 upto 10: draw interpath(n/10,p,heart) scaled (w/200); endfor;
  42. endchar;
  43.  
  44. beginchar("d",2cm#,2cm#,0pt#);
  45.   path heart,p;
  46.  
  47.   pickup pencircle scaled .1pt;
  48.  
  49.   heart = (100,162)..(140,178){right}..(195,125){down}..(100,0){curl0}
  50.     ..{curl0}(100,0)..{up}(5,125)..{right}(60,178)..(100,162);
  51.  
  52.   p = (100,200)--(200,200)--(200,100)--(200,0)--(0,0)--(0,100)
  53.     --(0,200)--(100,200);
  54.  
  55.   for n = 0 upto 10: draw interpath(n/10,p,heart) scaled (w/200); endfor;
  56. endchar;
  57.  
  58. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  59. %% Metafontbook Seite 138.                                                  %%
  60. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  61. beginchar("A",29mm#,25mm#,0);
  62.   thick# := 2mm#; thin# := 5/4mm#;
  63.   define_whole_blacker_pixels(thick,thin);
  64.  
  65.   forsuffixes $ = a,b,c:
  66.     transform $;
  67.     forsuffixes e = l,r:
  68.       path $e, $'e;
  69.       numeric t$[]e; endfor; endfor;
  70.  
  71.   penpos1(thick,0);   penpos2(thick,90);  penpos3(thick,180);
  72.   penpos4(thick,270); penpos5(thick,0);   penpos6(thick,90);
  73.   penpos7(thick,180); penpos8(thick,270);
  74.  
  75.   x2 = x4 = x6 = x8 = .5[x5,x7] = .5w; x1r = w; x3r = 0; x5-x7 = y6-y8;
  76.   y1 = y3 = y5 = y7 = .5[y6,y8] = .5h; y2r = h; y4r = 0; y6r   = .75h;
  77.  
  78.   forsuffixes e = l,r:
  79.     a.e = b'e = c'e = superellipse(z1e,z2e,z3e,z4e,.75);
  80.     a'e = b.e = c.e = superellipse(z5e,z6e,z7e,z8e,.72); endfor;
  81.  
  82.   penpos a1(thin,0); penpos a5(whatever,-90); penpos a9(thin,180);
  83.  
  84.   x.a1l-x.a9l = 1/3(x5l-x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
  85.   x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r,x1l]; x0 = .5w; y0 = .52h;
  86.   x.a6l+x.a4l = x.a6r+x a4r = x.a7l+x.a3l = x.a7r+x.a3r = x.a9+x.a1 = w;
  87.   y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l,y0]; y.a3l = y.a4l = y.a6l = y.a7l = 
  88.     y.a3r-thin;
  89.   z.a4l = z.a4r+(thin,0) rotated (angle(z.a4r-z.a5r) + 90)
  90.     + whatever*(z.a4r-z.a5r);
  91.   z.a4l-z.a5l = whatever*(z.a4r-z.a5r);
  92.   z = a.r intersectionpoint (z0--(w,0)); y.a1-y.a5 = length(z-z0);
  93.   b = identity shifted (0,y0-y.a1) rotatedaround (z0,90-angle(z0-(w,0)));
  94.   c = b reflectedabout (z2,z4);
  95.  
  96.   for n = 1,3,4,5,6,7,9:
  97.     forsuffixes e = l,r:
  98.       forsuffixes $ = b,c:
  99.         z.$[n]e = z.a[n]e transformed $; endfor; endfor; endfor;
  100.  
  101.   forsuffixes e = l,r:
  102.     forsuffixes $ = a,b,c:
  103.       z.$2e = $r intersectionpoint (z.$1e--z.$3e);
  104.       z.$8e = $r intersectionpoint (z.$9e--z.$7e);
  105.       t.$1e = xpart($e  intersectiontimes (z.$1l--z.$3l));
  106.       t.$9e = xpart($e  intersectiontimes (z.$9l--z.$7l));
  107.       t.$4e = xpart($'e intersectiontimes (z.$5r--z.$4l));
  108.       t.$6e = xpart($'e intersectiontimes (z.$5r--z.$6l)); endfor; endfor;
  109.  
  110.   penstroke subpath(t.a9e,t.b6e)   of a.e;
  111.   penstroke subpath(t.b4e,t.c4e)   of b'e;
  112.   penstroke subpath(t.c6e,t.a1e+8) of c'e;
  113.   penstroke subpath(t.a6e,t.b9e)   of a'e;
  114.   penstroke subpath(t.b1e,t.c1e)   of b.e;
  115.   penstroke subpath(t.c9e,t.a4e+8) of c.e;
  116.  
  117.   forsuffixes $ = a,b,c:
  118.     penlabels($1,$2,$3,$4,$5,$6,$7,$8,$9);
  119.     penstroke z.$2e--z.$3e--z.$4e--z.$5e--z.$6e--z.$7e--z.$8e; endfor;
  120.  
  121.   penlabels(range 0 thru 8);
  122. endchar;
  123.  
  124. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  125. %% Metafontbook Seite 126.                                                  %%
  126. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  127. beginchar("T",.5in#,1.25in#,0);
  128.   path branch[],trunk;
  129.  
  130.   branch1 = flex((0,660),(-9,633),(-22,610))
  131.     & flex((-22,610),(-3,622),(17,617))
  132.     & flex((17,617),(7,637),(0,660)) & cycle;
  133.  
  134.   branch2 = flex((30,570),(10,590),(-1,616))
  135.     & flex((-1,616),(-11,592),(-29,576),(-32,562))
  136.     & flex((-32,562),(-10,577),(30,570)) & cycle;
  137.  
  138.   branch3 = flex((-1,570),(-17,550),(-40,535))
  139.     & flex((-40,535),(-45,510),(-60,477))
  140.     & flex((-60,477),(-20,510),(40,512))
  141.     & flex((40,512),(31,532),(8,550),(-1,570)) & cycle;
  142.  
  143.   branch4 = flex((0,509),(-14,492),(-32,481))
  144.     & flex((-32,481),(-42,455),(-62,430))
  145.     & flex((-62,430),(-20,450),(42,448))
  146.     & flex((42,448),(38,465),(4,493),(0,509)) & cycle;
  147.  
  148.   branch5 = flex((-22,470),(-23,435),(-44,410))
  149.     & flex((-44,410),(-10,421),(35,420))
  150.     & flex((35,420),(15,455),(-22,470)) & cycle;
  151.  
  152.   branch6 = flex((18,375),(9,396),(5,420))
  153.     & flex((5,420),(-5,410),(-50,375),(-50,350))
  154.     & flex((-50,350),(-25,375),(18,375)) & cycle;
  155.  
  156.   branch7 = flex((0,400),(-13,373),(-30,350))
  157.     & flex((-30,350),(0,358),(30,350))
  158.     & flex((30,350),(13,373),(0,400)) & cycle;
  159.  
  160.   branch8 = flex((50,275),(45,310),(3,360))
  161.     & flex((3,360),(-20,330),(-70,300),(-100,266))
  162.     & flex((-100,266),(-75,278),(-60,266))
  163.     & flex((-60,266),(0,310),(50,275)) & cycle;
  164.  
  165.   branch9 = flex((10,333),(-15,290),(-43,256))
  166.     & flex((-43,256),(8,262),(58,245))
  167.     & flex((58,245),(34,276),(10,333)) & cycle;
  168.  
  169.   branch10 = flex((8,262),(-21,249),(-55,240))
  170.     & flex((-55,240),(-51,232),(-53,220))
  171.     & flex((-53,220),(-28,229),(27,235))
  172.     & flex((27,235),(16,246),(8,262)) & cycle;
  173.  
  174.   branch11 = flex((0,250),(-25,220),(-70,195))
  175.     & flex((-70,195),(-78,180),(-90,170))
  176.     & flex((-90,170),(-5,188),(74,183))
  177.     & flex((74,183),(34,214),(0,250)) & cycle;
  178.  
  179.   branch12 = flex((8,215),(-35,175),(-72,155))
  180.     & flex((-72,155),(-75,130),(-92,110),(-95,88))
  181.     & flex((-95,88),(-65,117),(-54,104))
  182.     & flex((-54,104),(10,151),(35,142)) .. flex((42,130),(60,123),(76,124))
  183.     & flex((76,124),(62,146),(26,180),(8,215)) & cycle;
  184.  
  185.   trunk = (0,660)---(-12,70)..{curl5}(-28,-8)
  186.     & flex((-28,-8),(-16,-4),(-10,-11))
  187.     & flex((-10,-11),(0,-5),(14,-10))
  188.     & flex((14,-10),(20,-6),(29,-11))
  189.     & (29,-11){curl4}..(10,100)---cycle;
  190.  
  191.   fill superellipse((w,.5h),(.5w,h),(0,.5h),(.5w,0),.8);
  192.  
  193.   branch0 = trunk;
  194.  
  195.   for n = 0 upto 12:
  196.     unfill branch[n] shifted (150,50) scaled (w/300); endfor;
  197. endchar;
  198.  
  199. end.
  200.