]> git.donarmstrong.com Git - lilypond.git/blob - mf/round-pixel-gray.mf
patch::: 0.1.38.jcn2: heen en weer
[lilypond.git] / mf / round-pixel-gray.mf
1 % Black font for Imagen with proofsheet resolution 75 pixels per inch
2
3 % if mode<>imagen: errmessage "This file is for imagen only"; fi
4
5 font_identifier "BLACKIMAGEN";
6 picture pix_picture; pix_wd := pix_ht := 8;
7 pix_picture := nullpicture;
8 addto pix_picture contour (fullcircle scaled  (8*1.6) shifted (4,4));
9
10 %pix_picture := unitpixel scaled 4;
11 % More-or-less general gray font generator
12 % See Appendix H of The METAFONTbook for how to use it
13
14 forsuffixes m = mag,rep:
15  if unknown m: m := 1;
16  elseif (m<1) or (m<>floor m):
17   errmessage "Sorry, " & str m & " must be a positive integer";
18   m := 1; fi endfor
19
20 mg := mag; mag := 1; mode_setup;
21 if mg>1: hppp := hppp*mg; vppp := vppp*mg;
22  extra_endchar:=
23   "if charcode>0:currentpicture:=currentpicture scaled mg;fi"
24   & extra_endchar; fi;
25
26 if picture pix_picture: rep := 1;
27  cull pix_picture keeping (1,infinity);
28 else: for z=(0,2),(1,0),(2,3),(3,1):
29   fill unitsquare shifted z; endfor
30  if not boolean lightweight: addto currentpicture also
31   currentpicture rotated 90 xscaled -1; fi
32  if unknown scale: scale := max(1,round(pixels_per_inch/300)); fi
33  pix_wd := pix_ht := 4scale;
34  if rep>1: picture pix;
35    currentpicture := currentpicture shifted-(1,1); pix := currentpicture;
36    for r=1 upto rep-1: addto currentpicture also pix shifted(4r,0); endfor
37    cullit; pix := currentpicture;
38    for r=1 upto rep-1: addto currentpicture also pix shifted(0,4r); endfor
39    unfill unitsquare xscaled 4rep yscaled 2 shifted-(1,1);
40    unfill unitsquare yscaled 4rep xscaled 2 shifted-(1,1); cullit; fi
41  picture pix_picture; pix_picture := currentpicture scaled scale;
42  pix_wd := pix_ht := 4scale*rep; fi
43
44 def # = *72.27/pixels_per_inch enddef;
45 if unknown dotsize: dotsize := 2.5pix_wd/rep; fi
46
47 beginchar(0,1.2dotsize#,1.2dotsize#,0);
48 fill fullcircle scaled dotsize scaled mg; endchar;
49
50 numeric a[]; newinternal b,k;
51 def next_binary =
52  k := 0; forever: if k>b: a[incr b] := 0; fi
53   exitif a[k]=0; a[k] := 0; k := k+1; endfor
54  a[k] := 1 enddef;
55 def next_special_binary =
56  if a[0]=1: for k=0 upto b: a[k] := 0; endfor a[incr b]
57  else: k := 0; forever: exitif a[incr k]=1; endfor
58   a[k-1] fi := 1 enddef;
59
60 def make_char =
61  clearit; next_binary;
62  for k=0 upto b: if a[k]=1:
63   addto currentpicture also pix_picture shifted(0,-k*pix_ht); fi endfor
64  charcode := charcode+1; chardp := b*charht;
65  scantokens extra_endchar; shipout currentpicture enddef;
66
67 charwd := pix_wd#; charht := pix_ht#; chardx := pix_wd*mg;
68 b := -1;
69
70 if boolean large_pixels:
71  for k=1 upto 7: make_char; charlist k:k+120; endfor
72  charcode := 120; b := -1;
73  addto pix_picture also pix_picture shifted (chardx,0);
74  charwd := 2charwd; chardx := 2chardx;
75  for k=1 upto 7: make_char; endfor
76 else: for k=1 upto 63: make_char; endfor
77  let next_binary = next_special_binary;
78  for k=64 upto 120: make_char; endfor
79  for k=121,122: charcode := k;
80   addto currentpicture also currentpicture shifted (chardx,0);
81   charwd := 2charwd; chardx := 2chardx;
82   scantokens extra_endchar; shipout currentpicture; endfor
83  charlist 120:121:122; fi
84
85 font_coding_scheme "GFGRAY";
86 font_size 8(pix_wd#);
87 font_normal_space pix_wd#;
88 font_x_height pix_ht#;
89 font_quad pix_wd#;
90 fontdimen 8: if known rulethickness: rulethickness
91  else: pix_wd#/(2rep) fi;
92 bye.