mode_setup; u#=3pt#; define_blacker_pixels(u); vo=ho=0; % Overshoot not used % grayit removes 75% of all pixels in the currentpicture, leaving a % gray-looking letter. ppi (pixels per inch) stands for the number of % cells per inch, each cell will contain a black circle that occupies % about 75% of the area. Typical values for ppi are 32, 42 and 50, % depending on the capabilities of the printer. vardef mask(expr blackness) = % Create cell with one dot save diam, weight, pic; numeric diam, weight; picture pic; pic=nullpicture; if blackness <= pi/4: % Does black circle fit? diam=2graywd*sqrt(blackness/pi); weight=1 else: % Draw a white circle instead diam=2graywd*sqrt((1-blackness)/pi); weight=-1; addto pic also contour (unitsquare scaled graywd) fi; addto pic contour (fullcircle shifted (.5,.5) scaled diam) withweight weight; pic enddef; %ppi=min(in/8,50); % Assures at least 8 pixels/cell ppi=min(in/7,65); % Assures at least 7 pixels/cell blackness=0.25; % Mask will be 25% black pi=3.1415; % Approximates pi vardef grayit = save x,y, graywd; picture graycell; % Square containing one dot graywd=ceiling(in/ppi); % Should be whole number of pixels graycell=mask(blackness); cullit; for y=floor(-d-vo) step 2graywd until h+vo: for x=floor(-ho) step graywd until w+ho: addto currentpicture also (graycell shifted (x,y)); endfor endfor; for y=floor(-d-vo)+graywd step 2graywd until h+vo: for x=floor(graywd/2-ho) step graywd until w+ho: addto currentpicture also (graycell shifted (x,y)); endfor endfor; cull currentpicture keeping (2,infinity); enddef; beginchar("A", 10u#, 10u#, 0); "The exit sign (letter A)"; % % 10 % ## % 9 #### 7 % ##8 % 1 ### ## ### 4 % #### ## #### % ## 0 ## 5 ## % ## ## ## % ## ## ## % ## 6 ## % ## ## % ############ % 2 ########## 3 % pickup pencircle scaled u; top rt z0=(w/2-1.5u,6.5u); top lft z1=(1.5u,6.5u); bot lft z2=(1.5u,u); bot rt z3=(w-1.5u,u); top rt z4=(w-1.5u,6.5u); top lft z5=(w/2+1.5u,6.5u); draw z0--z1--z2--z3--z4--z5; bot z6=(w/2,4u); z8=(w/2,7.2u); draw z6..z8; z7=(w/2+1.5u,7.2u); z9=(w/2-1.5u,7.2u); z10=(w/2,h-0.8u); fill z7--z10--z9--cycle; lft z20=(0,h-u); lft z21=(0,u); bot z22=(u,0); bot z23=(w-u,0); rt z24=(w,u); rt z25=(w,h-u); top z26=(w-u,h); top z27=(u,h); pickup pencircle scaled (u/4); draw z20---z21..z22---z23..z24---z25..z26--z27..cycle; endchar; beginchar("B", 10u#, 10u#, 0); "The entrance sign (letter B)"; % % 2 ########## 3 % ############ % ## 10 ## % ## ## ## % ## 9##8#7 ## % ## 0 ## 5 ## % #### ## #### % 1 ### ## ### 4 % ## % ## % ## % 6 % pickup pencircle scaled u; bot rt z0=(w/2-1.5u,3u); bot lft z1=(1.5u,3u); top lft z2=(1.5u,9u); top rt z3=(w-1.5u,9u); bot rt z4=(w-1.5u,3u); bot lft z5=(w/2+1.5u,3u); draw z0--z1--z2--z3--z4--z5; bot z6=(w/2,u); top top z8=(w/2,7u); draw z6..z8; z7=(w/2+1.5u,5u); z9=(w/2-1.5u,5u); z10=(w/2,7u); fill z7--z10--z9--cycle; lft z20=(0,h-u); lft z21=(0,u); bot z22=(u,0); bot z23=(w-u,0); rt z24=(w,u); rt z25=(w,h-u); top z26=(w-u,h); top z27=(u,h); pickup pencircle scaled (u/4); draw z20---z21..z22---z23..z24---z25..z26--z27..cycle; endchar; beginchar("C", 9u#, 9u#, 0); "The Men's Toilet sign (letter C)"; % % ## % ##9# % ## % 2 ###### 3 % ######## % ## #### ## % ## #### ## % 1 5## ##8 4 % ## ## % ## ## % 6 7 % penpos1(u,0); z1l=(1u,3.5u); penpos2(u,0); z2l=(3u,8u); penstroke z1e..z2e; penpos4(u,0); z4r=(8u,3.5u); penpos3(u,0); z3r=(6u,8u); penstroke z3e..z4e; penpos6(u,0); z6l=(3u,0); penpos5(u,0); z5l=(3u,3.5u); penstroke z6e..z5e; penpos7(u,0); z7r=(6u,0); penpos8(u,0); z8r=(6u,3.5u); penstroke z7e..z8e; fill z2l--z5l--z8r--z3r--cycle; pickup pencircle scaled 2u; bot z9=(4.5u,y2); drawdot z9; endchar; beginchar("D", 9u#, 9u#, 0); "The Women's Toilet sign (letter D)"; % % ## % ##9# % ## % 2 ##10## 3 % ######## % ## 11 ## % ## #### ## % 1 5##12##8 4 % ## ## % # # % 6 7 % penpos1(u,0); z1l=(1u,4u); penpos2(u,0); z2l=(3u,8u); penstroke z1e..z2e; penpos4(u,0); z4r=(8u,4u); penpos3(u,0); z3r=(6u,8u); penstroke z3e..z4e; penpos6(u/2,0); z6=(3.9u,0); penpos5(u,0); z5=(3.9u,3u); penstroke z6e..z5e; penpos7(u/2,0); z7=(5.1u,0); penpos8(u,0); z8=(5.1u,3u); penstroke z7e..z8e; penpos10(x3r-x2l,0); z10l=z2l; penpos11(2u,0); z11=(w/2,5.5u); penpos12(3.5u,0); z12=(w/2,y5); penstroke z10e--z11e--z12e; pickup pencircle scaled 2u; bot z9=(4.5u,y2); drawdot z9; endchar; beginchar("E", 9u#, 178/195*9u#, 0); "The heart (letter E)"; % % ## ## % #### #### % ######### % ####### % ##### % ### % # % fill (100,162)..(140,178){right}..(195,125){down} ..(100,0){curl 0}..{up}(5,125)..{right}(60,178)..(100,162) & cycle scaled (w/200); blackness:=0.45; grayit; endchar; beginchar("F", 10u#, 11u#, 0); "The arrowed heart (letter F)"; % % / % ## ##/ % #### #### % ######### % ####### % /#### % / ### % / # % save heart; path heart; heart=(100,162)..(140,178){right}..(195,125){down} ..(100,0){curl 0}..{up}(5,125)..{right}(60,178)..(100,162) & cycle; heart:= heart scaled (9u/200) shifted (u/2,u); fill heart; blackness:=0.45; grayit; pickup pencircle scaled (u/2); bot lft z0=(0,0); % Lower left tip of arrow z2=(w/2,h/2); % Center of heart z1=(z0..z2) intersectionpoint heart; top rt z3=(w,h); penpos4(3/2u,angle(z3-z0)+90); z4=point 0.8 of (z2..z3); draw z0..z1; draw z2..z4; fill z4l--z4r--top rt z3--cycle; endchar; beginchar("G", 12u#, 5u#, 5u#); % % -- A pair of scissors % z1r=(w,1/3h); % Tip z2r=(4/5w,1/6h); % Widest part of blade z3r=whatever[z1r,z2r]; x3r=1/6w; % Join of blade and thumb ring penpos1(1/2u,angle(z1r-z2r)-90); penpos2(u,angle(z1r-z2r)-90); penpos3(2/3u,angle(z1r-z2r)-90); z4l=(0,-2/3d); penpos4(2/3u,0); % Left edge of ring z5l=(1/5w,-d); penpos5(2/3u,90); % Bottom edge of ring z6l=(2x5l,y4); penpos6(2/3u,180); % Right edge of ring; penstroke z1e..z2e---z3e..{down}z4e..{right}z5e..{up}z6e..{z3r-z2r}z3e; addto currentpicture also (currentpicture yscaled -1); endchar; beginchar("H", 15u#, 15u#, 0); % % 1 2 % ################# % # # % 8 # 9 10 # 3 % # ########### # % # ######### #16# % # #######15## # % # 11 ######### 13 # % # 12 ####### 14 # % # 17 20 # % # ############### # % # ############# # % 7 # 18 19 # 4 % # # % ################# % 6 5 % pickup pencircle scaled 1/30w; % Frame top z1=(1/8w,h); top z2=(7/8w,h); rt z3=(w,7/8h); rt z4=(w,1/8w); bot z5=(7/8w,0); bot z6=(1/8w,0); lft z7=(0,1/8w); lft z8=(0,7/8w); draw z1---z2..z3---z4..z5---z6..z7---z8..cycle; z9=(2/7w,5/7h); z10=(w-x9,y9); % Cup z11=(x9,5/14h+1/10h+1/2u); z12=(x9+1/10w,y11-1/10h); z13=(x10,y11); z14=(w-x12,y12); fill z9--z10---z13..z14---z12..z11---cycle; pickup pencircle scaled 1/15w; % Cup's ear z15=1/4[z13,z10]; z16=(1/3[x10,w],1/2[bot y15,y10]); draw bot z10{right}..z16..{left}z15; z17=(1/7w,5/14h); % Saucer z18=(x17+1/10w,2/7h); z19=(w-x18,y18); z20=(w-x17,y17); fill z17{down}..z18---z19..{up}z20--cycle; endchar; beginchar("I", 5u#, 5u#, 2.5u#); % % ### % # # % # # % # # % # # % ### % # % ### % # % pickup pencircle scaled 2/3u; draw fullcircle scaled 11/3u shifted (w/2,h/2); draw top (w/2,0)..top (w/2,-d); draw (1/4w,-d/2)..(3/4w,-d/2); endchar; beginchar("J", 6.5u#, 6.5u#, 0); % % ### % ## % ### # # % # # % # # % # # % # # % ### % pickup pencircle scaled 2/3u; draw fullcircle scaled 11/3u shifted (2.5u,2.5u); draw bot lft ((2.5u,2.5u)+2.5u*dir 45)..bot lft (w,h); draw bot (3/4w,h)--bot lft (w,h)--lft (w,3/4h); endchar; beginchar("K", 17u#, 13u#, 0); % % # % % ######## # % ########## % ########### % # ########### % ########### % ######### % ##### # % % # % z0=(w/2,h/2); fill fullcircle scaled (h/3) shifted z0; pickup pencircle scaled (h/22); for i=180 step -36 until 0: drawdot z0+h/3*dir i; endfor; z1=z0+0.28h*dir(180-36); z2=z0+h/8*dir(180-36+90); z3=z0+h/8*dir(180-36-90); fill z1--z2--z3--cycle; pickup pencircle scaled (h/100); draw (0,0)--(w,0)--(w,h)--(0,h)--cycle; z4=(w/2-h/28,h/6); z5=(w/2+h/28,h/6+h/10); z6=(w/2-h/28,h/6+h/10); z7=(w/2+h/28,h/6); for i=-2 step 1 until 2: draw z4+i*(h/10,0)--z5+i*(h/10,0); draw z6+i*(h/10,0)--z7+i*(h/10,0); endfor; endchar; beginchar("L", 12u#, 12u#, 0) % % 1 2 3 4 5 6 7 % ######################### % # ##### # ##### # % # ##### # ##### # % # ##### # ##### # % 24 ######################### 8 % # # # # # # # % # P # U # Z # Z # L # E # % # # # # # # # % 23 ######################### 9 % ##### # # # ##### % ##### # # # ##### % ##### # # # ##### % 22 ######################### 10 % ##### # # # ##### % ##### # # # ##### % ##### # # # ##### % 21 ######################### 11 % # # # # # # # % # # # # # # # % # # # # # # # % 20 ######################### 12 % # ##### # ##### # % # ##### # ##### # % # ##### # ##### # % ######################### % 19 18 17 16 15 14 13 % save i, j, ww, hh; numeric i, j, hh, ww; pickup pensquare scaled (u/6); ww=w/6; hh=h/6; % Horizontal lines for i=0 upto 6: draw (0,i*hh)..(w,i*hh); endfor % Vertical lines for i=0 upto 6: draw (i*ww,0)..(i*ww,h); endfor % Black squares fill (1ww,6hh)--(1ww,5hh)--(2ww,5hh)--(2ww,6hh)--cycle; fill (4ww,6hh)--(4ww,5hh)--(5ww,5hh)--(5ww,6hh)--cycle; fill (0ww,4hh)--(0ww,3hh)--(1ww,3hh)--(1ww,4hh)--cycle; fill (0ww,3hh)--(0ww,2hh)--(1ww,2hh)--(1ww,3hh)--cycle; fill (5ww,4hh)--(5ww,3hh)--(6ww,3hh)--(6ww,4hh)--cycle; fill (5ww,3hh)--(5ww,2hh)--(6ww,2hh)--(6ww,3hh)--cycle; fill (1ww,1hh)--(1ww,0hh)--(2ww,0hh)--(2ww,1hh)--cycle; fill (4ww,1hh)--(4ww,0hh)--(5ww,0hh)--(5ww,1hh)--cycle; % Now the letters pickup pencircle scaled (u/6); z11=(-1/3,-1/3); z21=(-1/6,-1/3); z31=(0,-1/3); z41=(1/6,-1/3); z51=(1/3,-1/3); z12=(-1/3,-1/6); z22=(-1/6,-1/6); z32=(0,-1/6); z42=(1/6,-1/6); z52=(1/3,-1/6); z13=(-1/3,0); z23=(-1/6,0); z33=(0,0); z43=(1/6,0); z53=(1/3,0); z14=(-1/3,1/6); z24=(-1/6,1/6); z34=(0,1/6); z44=(1/6,1/6); z54=(1/3,1/6); z15=(-1/3,1/3); z25=(-1/6,1/3); z35=(0,1/3); z45=(1/6,1/3); z55=(1/3,1/3); % `P' z10=(.5ww,4.5hh); % Center of `P' draw (z11--z15{right}...z54...{left}z13) xscaled ww yscaled hh shifted z10; % `U' z20=(1.5ww,4.5hh); draw (z15---z12...z31...z52---z55) xscaled ww yscaled hh shifted z20; % `Z' z30=(2.5ww,4.5hh); draw (z15--z55--z11--z51) xscaled ww yscaled hh shifted z30; % `Z' z40=(3.5ww,4.5hh); draw (z15--z55--z11--z51) xscaled ww yscaled hh shifted z40; % `L' z50=(4.5ww,4.5hh); draw (z15--z11--z51) xscaled ww yscaled hh shifted z50; % `E' z60=(5.5ww,4.5hh); draw (z55--z15--z11--z51) xscaled ww yscaled hh shifted z60; draw (z13--z43) xscaled ww yscaled hh shifted z60; endchar; bye