eps=.000314159; % a very small random positive number proof=0; lowres=1; crs=2; dover=3; canon=5; smoke=6; % symbolic names of modes designsize ptsize; % ignore error messages you get with old MF! if mode<0: mmode=-mode; new mode; mode=mmode; % negative modes assume \\{mag} is set else: mag=1; fi; stephalf=sqrt(1.2); stepi=1.2; stepii=1.44; stepiii=1.728; stepiv=2.0736; stepv=2.48832; magnification mag; if mode=proof: proofmode; drawdisplay; titletrace; pixels=18*mag; blacker=0; overcorr=1; % for initial design of characters else: if mode=lowres: fntmode; tfxmode; no modtrace; pixels=(200/72.27)mag; blacker=.65; overcorr=.4; % XGP, etc. else: if mode=crs: crsmode; tfxmode; titletrace; no modtrace; pixels=(16000/(3*72.27))mag; blacker=4; overcorr=1; % Alphatype else: if mode=dover: ocmode; tfmmode; dotwdmode; no modtrace; overcorr=.6; pixels=(384/72.27)mag; blacker=1.2; % Dover else: if mode=canon: rstmode; tfxmode; no modtrace; pixels=(240/72.27)mag; % mode=+-5 blacker=.2; overcorr=.4; % Canon else: if mode=smoke: proofmode; titletrace; no points; no modtrace; pixels=72; blacker=0; overcorr=1; else: input mode; fi; fi; fi; fi; fi; fi; fontfacebyte 254-2*ptsize; hresolution pixels; vresolution pixels. subroutine fontbegin: % Initialize before making a font: no eqtrace; % Turn off tracing within this subroutine new typesize; % the vertical size of the font new cf; % conversion factor, approximately equal to \\{pixels} new h,hh,hhh,d,dd,m,e,o,oo,b,s,ssd,ssdoo,as,a; % raster-oriented vertical dimensions new del; del=round pixels.pdel; % raster-oriented displacement at corners new w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11; % raster-oriented pen sizes new deltaw,bold; % unrounded raster-oriented pen size values new armic,lcic; % italic corrections commonly used new prt; % rule thickness in points w0=round(pixels.pw+blacker); % hairline width w1=round(pixels.pwi+blacker); % stem width w2=round(pixels.pwii+blacker); % curve width w3=round(pixels.pwiii+blacker); % dot diameter w4=round(pixels.pwiv+blacker); % uppercase stem width w5=round(pixels.pwv+blacker); % uppercase curve width w6=round(pixels.pw.aspect+blacker); % hairline height w7=round(pixels.pwi.aspect+blacker); % stem height w8=round(pixels.pwii.aspect+blacker); % curve height w9=round(pixels.pwiv.aspect+blacker); % uppercase stem height prt=.25[pw,pwii]; % rule thickness in points w10=round(pixels.prt+.4); % raster-oriented rule thickness w11=round(pixels(.25[pw,pwi])+blacker); % hairline plus a little deltaw=pixels.(pwii-pwi); % one step of boldening bold=.5[pwii,pwiii].pixels+blacker; % The following corrections are for low resolution: if w3/w1>5/4(pwiii/pwi): new w2,w3; w2=w3=w1; fi; if w2/w1>1.1(pwii/pwi): new w2; w2=w1; fi; if w5/w4>1.1(pwv/pwiv): new w5; w5=w4; fi; if w8/w7>1.1(pwii/pwi): new w8; w8=w7; fi; if w7/w1<.9aspect: new tmp; tmp=round .5[w7,w1]; new w7; w7=tmp; fi; if w8/w2<.9aspect: new tmp; tmp=round .5[w8,w2]; new w8; w8=tmp; fi; if w9/w4<.9aspect: new tmp; tmp=round .5[w9,w4]; new w9; w9=tmp; fi; if w0<3: new crisp; crisp=0; fi; hpenht w6; vpenwd w0; lpenht w6; rpenht w6; typesize=ph+pd+2pb; cf.typesize=pixels.typesize-1; h=round cf.ph; d=round cf.pd; hh=round cf.phh; hhh=round cf.phhh; dd=round cf.pdd; m=round cf.px; a=.5 round 2cf.pa; o=round cf.po.overcorr; oo=round .5cf.po.overcorr; s=cf.ps; ssd=round cf.pssd; as=cf.pas+eps; if ssd>oo: ssdoo=oo; else: ssdoo=ssd; fi; b=-round(.5(h+d-typesize.pixels)); e=good6 cf.pe; maxht h+b+4; trxy slant; if ucsâ? 0: armic=ph.slant+(sc-1)pu; else: armic=ph.slant+(sc-.5)pu; fi; if pwii>1.5pu: lcic=-.25pu; else: lcic=.5pwii-pu; fi. subroutine charbegin(var charno) % seven-bit character code (var charuw) % character width in units (var lftcorr, var rtcorr) % sidebar corrections in units (var charh, var chard, var chari): % \&{charht}, \&{chardp}, \&{charic} values in points no eqtrace; no calltrace; no drawdisplay; % no tracing in this subroutine new uw,moduw; % the correct character width in units new r; % raster-oriented character width new u; % raster-oriented design unit new tu; % unmodified raster-oriented unit new italcorr; % italic correction new lcorr,rcorr; % left and right corrections if chariâ?¥0: italcorr=chari; else: italcorr=0; fi; if dangerâ? 0: % rounding of character width is necessary lcorr=danger.round((lftcorr-ls)/danger); rcorr=danger.round((rtcorr-ls)/danger); else: lcorr=lftcorr-ls; rcorr=rtcorr-ls; fi; tu=pu.pixels; uw=charuw-(lcorr+rcorr); if fixwidth=0: moduw=uw; else: moduw=9; new italcorr; italcorr=0; fi; r=charuw.u=round((moduw.tu-2).charuw/uw); charcode charno; charic italcorr; if charh>0: charht charh; else: charht 0; fi; if chard>0: chardp chard; else: chardp 0; fi; charwd moduw.pu; chardw moduw.tu; incx round(-lcorr.u); if mode=proof: call box(round lcorr.u); fi. subroutine box(var offset): % Draw guidelines and box around a character: no drawtrace; no proofmode; new topp,bott,left,right,pos; topp=h+b; bott=-d-b; left=offset; right=offset+u.uw; x1=x3=x5=x7=x9=x11=x13=x15=x17=left; x2=x4=x6=x8=x10=x12=x14=x16=x18=right; y1=y2=0; cpen; 1 draw1..2; % baseline y3=y4=e; draw3..4; % e-height y5=y6=m; draw5..6; % mean line (x-height) y7=y8=h; draw7..8; % h-height y9=y10=topp; draw9..10; % top of character y11=y12=-d; draw11..12; % descender line y13=y14=bott; draw13..14; % bottom of character trxy 0; % temporarily turn off the slant y15=y16=topp; y17=y18=bott; draw15..17; draw16..18; % left and right edges if italcorr>0: x19=x20=right+italcorr.pixels; y19=topp; y20=0; draw19..20; % show italic correction fi; trxy slant; % restore slanted transformation pos=0; call unitlines. % draw the unit guidelines subroutine unitlines: % Recursive subroutine to draw guidelines: x1=x2=pos;y1=topp;y2=bott;cpen; if posâ?¥left: 1 draw1..2; fi; new pos; pos=x1+u; if posâ?¤right: call unitlines; fi. % The following subroutines are used to draw common features of characters. subroutine rect(index i): % plot a rectangle at point i if round(w0/2)=w0/2: x1=xi-.5; y1=yi; lpen; (w0-2)/2 draw 1; rpen; w0/2 draw 1; else: lpen; (w0-1)/2 draw i; rpen; (w0-1)/2 draw i; fi. subroutine serif(index i) % point where serif appears (index k) % $w$-variable for stem line (index j) % another point on the stem line (var sl): % serif length y1=yi; if yi(yj-y9)/(xj-x9)/(xj-x9): new x10,y10,aa,x8,y8; % correction to keep ellipses from crossing 2(yj-y9)/(xj-x9)/(xj-x9)=(yj-y6)aa-slope.slope/(yj-y6); if xqyi: bot49yp=bot6y1; top49yp=top6y2; bot49yq=bot6y9; top49yq=top6y10; else: top49yp=top6y1; bot49yp=bot6y2; top49yq=top6y9; bot49yq=bot6y10; fi; x2=xp; x9=xq; call zcomp(i,1,3,5,slope); % compute $xâ??1$ and point 3 call zcomp(i,2,4,6,slope); % compute $xâ??2$ and point 4 if (xi-x1)/(yi-y1)/(yi-y1)>(xi-x2)/(yi-y2)/(yi-y2): new x1,y1,aa,x3,y3; % correction to keep ellipses from crossing 2(xi-x2)/(yi-y2)/(yi-y2)=(xi-x5)aa-slope.slope/(xi-x5); if ypb: acc=a; else: acc=b; fi.