delimiters (); smoothing:=1; autorounding:=2; % this adjusts curves to the raster turningcheck:=2; % this will warn about a "strange path" vardef z@# = (x@#,y@#) enddef; vardef dz@# = (dx@#,dy@#) enddef; picture currentpicture; currentpicture=nullpicture; % this initializes an empty set of pixels def fill expr c = addto currentpicture contour c enddef; def shipit = shipout currentpicture enddef; def showit = display currentpicture inwindow window enddef; def unknown = not known enddef; vardef pos@#(expr length,theta) = z@#=.5[z@#l,z@#r]; z@#r-z@#l=(length,0) rotated theta enddef; def stroke(suffix $,$$)(expr t,lt,rt) = fill z$l if known dz$: {dz$} fi if t<>0: ..lt[ t[z$l,z$$l],t[z$,z$$] ]{z$$l-z$l} fi .. z$$l if known dz$$: {dz$$} fi & z$$l..z$$r & z$$r if known dz$$: {-dz$$} fi if t<>0: ..rt[ t[z$r,z$$r],t[z$,z$$] ]{z$r-z$$r} fi .. z$r if known dz$: {-dz$} fi & z$r..z$l & cycle; showit; enddef; def curve(suffix $,$$,$$$) = fill z$l if known dz$: {dz$} fi .. z$$l{if known dz$$: dz$$ else: z$$$l-z$l fi} .. z$$$l if known dz$$$: {dz$$$} fi & z$$$l..z$$$r & z$$$r if known dz$$$: {-dz$$$} fi .. z$$r{if known dz$$: -dz$$ else: z$r-z$$$r fi} .. z$r if known dz$: {-dz$} fi & z$r..z$l & cycle; showit; enddef; def proofrule(expr a,b) = special "rule"; numspecial xpart a; numspecial ypart a; numspecial xpart b; numspecial ypart b enddef; string lcode_; lcode_=" 0"; % change to " /" to avoid listing in overflow column def makelabel(expr s,z) = % puts string s at point z if known z: special lcode_ & s; numspecial xpart z; numspecial ypart z fi enddef; def labelpos(text t) = if proofing>.5: forsuffixes $$=l,,r: forsuffixes $=t: makelabel(str $.$$, z$.$$); endfor endfor fi enddef; def clear = numeric x[],y[],x[]l,y[]l,x[]r,y[]r,dx[],dy[]; currentpicture:=nullpicture; enddef; def setwidth expr x = chardx:=x; numeric w; w=chardx; if proofing>.5: for n:=0 step .1em until chardx-1: proofrule((n,-ydepth),(n,hheight)); endfor proofrule((chardx,-ydepth),(chardx,hheight)); proofrule((0,-ydepth),(chardx,-ydepth)); proofrule((0,0),(chardx,0)); proofrule((0,xheight),(chardx,xheight)); proofrule((0,capheight),(chardx,capheight)); proofrule((0,hheight),(chardx,hheight)); fi enddef; vardef init.normal(expr f) = begingroup numeric thinwidth,thickwidth,capheight,xheight,hheight,ydepth,em; thinwidth = 11f; thickwidth = 15f; em = 200f; capheight = 130f; xheight = 90f; hheight = 140f; ydepth = 40f; endgroup enddef; vardef init.bold(expr f) = init.normal(f); thinwidth:= 14f; thickwidth:= 24f; enddef; vardef init.boldx(expr f) = init.bold(f); xheight:=95f; em:= 220f; enddef; vardef test@#(text #)= begingroup if str @# = "": % test all three openwindow 1 from (0,0) to (420,167) at (-20,310); openwindow 2 from (0,167) to (420,333) at (-20,310); openwindow 3 from (0,333) to (420,500) at (-20,310); window:=1; init.normal(1); clear; #; "normal"; shipit; window:=2; init.bold(1); clear; #; "bold"; shipit; window:=3; init.boldx(1); clear; #; "boldx"; shipit; else: openwindow 0 from (0,0) to (420,500) at (-40,310); window:=0; init@#(2); clear; #; str @#; shipit; fi; endgroup enddef;