summaryrefslogtreecommitdiff
path: root/macros/text1/fonts/dt.mf
diff options
context:
space:
mode:
Diffstat (limited to 'macros/text1/fonts/dt.mf')
-rw-r--r--macros/text1/fonts/dt.mf17
1 files changed, 17 insertions, 0 deletions
diff --git a/macros/text1/fonts/dt.mf b/macros/text1/fonts/dt.mf
new file mode 100644
index 0000000000..54722d595d
--- /dev/null
+++ b/macros/text1/fonts/dt.mf
@@ -0,0 +1,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