summaryrefslogtreecommitdiff
path: root/macros/text1/fonts/dt.mf
blob: 54722d595da70c775ba65a0b2ab472f6b2e7c86d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
% halftone font with 65 levels of gray, characters "0" (white) to "p" (black)
 
pair p[]; % the pixels in order (first p0 becomes black, then p1, etc.)
pair d[]; d[0]=(0,0); d[1]=(1,1); d[2]=(0,1); d[3]=(1,0); % dither control
def wrap(expr z)=(xpart z mod 8,ypart z mod 8) enddef;
for i=0 upto 3: for j=0 upto 3: for k=0 upto 3:
  p[16i+4j+k]=wrap(4d[k]+2d[j]+d[i]+(2,2)); endfor endfor endfor
 
w#:=8/pt; % that's 8 pixels
font_quad:=w#; designsize:=8w#;
 
picture prevchar; prevchar=nullpicture; % pixels blackened so far
for i=0 upto 64:
  beginchar(i+ASCII"0",w#,w#,0); currentpicture:=prevchar;
  if i>0: addto currentpicture also unitpixel shifted p[i-1]; fi
  prevchar:=currentpicture; endchar;
endfor