diff options
Diffstat (limited to 'fonts/ocr-b/ocrbmac.mf')
-rw-r--r-- | fonts/ocr-b/ocrbmac.mf | 273 |
1 files changed, 273 insertions, 0 deletions
diff --git a/fonts/ocr-b/ocrbmac.mf b/fonts/ocr-b/ocrbmac.mf new file mode 100644 index 0000000000..105f9dbdd2 --- /dev/null +++ b/fonts/ocr-b/ocrbmac.mf @@ -0,0 +1,273 @@ +%%%%%%%%%%%%%%%%% Endehandlung nach Zeichenbestimmung %%%%%%%%%%%%%%%%%%%%%% +% +% Copyright 1995, 2010 Norbert Schwarz +% You may freely use, modify, and/or distribute this file, without limitation. +% +% Dies wird am Ende jeden Zeichens v o r "endchar ausgefuehrt. +% +% Dort koennen globale Design-Entscheidungen durch evtl. +% Mehrfachausgaben realisiert wdrden. +% +mode_setup; + +pen penxy; +picture bild; picture bildb; +path negpath; + +def dofinishing = + prule; % Rule in xheight-- Hoehe + for j:=1 step 1 until subchar: + firstpath:= firstpathcount[j]; + lastpath := lastpathcount[j]; +% message "path "&decimal j ; +% message " from "&decimal firstpath; +% message " to "&decimal lastpath ; + if j > 1 : + penxy := defaultpen; + if known penrand : defaultpen := defaultpen scaled penrand; fi + cullit; undrawallpath; + if sharpedges>0: cullit; shutedges -1; fi + defaultpen :=penxy; + cullit; + fi + drawallpath; +% if globalslant>0 : "with slant"; fi + if sharpedges>0 : +% "with sharp edges"; + shutedges 1; + fi + if hohl>0 l: +% "'hohl'"; + cullit; + pickup pencircle scaled hohl; + undrawallpath; + cullit; + if sharpedges>0 : shutedges -1 ; fi + cullit; + fi + if extraline>0 : +% " with extraline"; + pickup pencircle scaled extraline; + drawallpath; + if sharpedges>0 : shutedges 1; fi + fi + endfor + if negativ > 0: + cullit; bild:=currentpicture; + clearit; + negpath:= (-0.5*SYMBWIDTH/scalefak ,-0.35maxy)-- + ( 0.5*SYMBWIDTH/scalefak ,-0.35maxy)-- + ( 0.5*SYMBWIDTH/scalefak , 1.2maxy)-- + (-0.5*SYMBWIDTH/scalefak , 1.2maxy)--cycle; +% (-0.5*SYMBWIDTH/scalefak ,-0.35maxy)..cycle; + fill (negpath shifted (shiftfak,0) scaled scalefak); + cullit; + bildb := currentpicture; + clearit; + currentpicture := bildb-bild; + cullit; +% showit; + fi + clearallpath; + enddef; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%def comment text x= +% for k:=0 step 29 until (length x)+ 28 : +% special " 9"&substring(k,k+29) of(x&" ") ; +% numspecial 0;numspecial 0; endfor enddef; + +def corrwidth expr x= charwd:=x/pt; + w:=x; + h:=w; + enddef; +def prule = + proofrule((0,0.5capheight),(capheight,0.5capheight)); + proofrule((0,0.25capheight),(capheight,0.25capheight)); + proofrule((0,0.75capheight),(capheight,0.75capheight)); + proofrule((0.25capheight,0),(0.25capheight,capheight)); + proofrule((0.75capheight,0),(0.75capheight,capheight)); + proofrule(( 0.5capheight,0),(0.5capheight,capheight));enddef; + + + +sheight := 0.75 xheight; + +vardef make@#= + if (length str@#) = 1: charcode:=ASCII str @#; else: charcode:=0; fi + "Generierung: "&str@#; + beginchar(charcode,10,10,0); + char@#; + endchar; + enddef; + + + +path allpath[]; + +def clearallpath = + subchar := 1; + firstpathcount[subchar]:=0; + lastpathcount[subchar]:=-1; + pathcount:=-1; enddef; + +def nextsubchar = + subchar := subchar+1; + firstpathcount[subchar]:=pathcount+1; + lastpathcount[subchar]:=pathcount; + enddef; + + +clearallpath; +pen shutpen; +path unitpath; + + + +def shutedges expr www = + unitpath := (-0.5,-0.5)--(0.5,-0.5)--(0.5,0.5)--(-0.5,0.5)..cycle; + shutwidth := abs pen_lft + pen_rt; + for i:=firstpath step 1 until lastpath: + if cycle allpath[i]: + else: + shutpen:= makepen (unitpath scaled shutwidth + rotated (angle(direction 0 of allpath[i]))) + slanted globalslant ; + pickup shutpen; + drawdot ((point 0 of allpath[i]) + slanted globalslant) + withweight www; + shutpen:= makepen (unitpath scaled shutwidth + rotated (angle (direction infinity of allpath[i]))) + slanted globalslant ; + pickup shutpen; drawdot ((point infinity of allpath[i]) + slanted globalslant) + withweight www; + fi + endfor + pickup defaultpen; + enddef; + +def savepath text p = pathcount:=pathcount+1; + lastpathcount[subchar]:=pathcount; + allpath[pathcount]:=p; enddef; + +def drawallpath = + if globalslant=0: + for i:=firstpath step 1 until lastpath: draw allpath[i]; endfor + else: + for i:=firstpath step 1 until lastpath: + draw (allpath[i] slanted globalslant); + endfor + fi + enddef; + +def undrawallpath = + if globalslant=0: + for i:=firstpath step 1 until lastpath: undraw allpath[i]; endfor + else: + for i:=firstpath step 1 until lastpath: + undraw (allpath[i] slanted globalslant); + endfor + fi + enddef; + + +%===================================================================== + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$%%%%% +%%%%%%%%%%%%%% Makros und Konstanten zum Font O C R B %%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% ========== +designfaktor := designsize*0.1; + +capheight := 12.275*mm*designfaktor; % Hoehe von "E" unskaliert +xheight := 0.5*capheight * designfaktor; % +SYMBWIDTH := 2.54mm*designfaktor; % 10 Zeichen je inch + +scalefak := mm*2.28/11.4*designfaktor; % ================================ + +path o.s[][]; + +ocrb.penwidth := 1.75; % Strichstaerke +ocrb.width := 7 + ocrb.penwidth; + +pen defaultpen; +defaultpen :=pencircle scaled (ocrb.penwidth*scalefak); +maxy := 12.6 + 0.5ocrb.penwidth; + +%shiftfak := 0.5maxy; +shiftfak := (0.5SYMBWIDTH)/scalefak; +path xpath; + +%------- font dimensionen + ptscale := 1/pt; + + font_x_height (8.5+0.5ocrb.penwidth)*scalefak / pt * designfaktor; + font_slant globalslant ; + font_normal_space 1.0 * SYMBWIDTH * ptscale; + font_normal_stretch 0.0 * SYMBWIDTH * ptscale; + font_normal_shrink 0.0 * SYMBWIDTH * ptscale; + font_quad 2.0 * SYMBWIDTH * ptscale; + font_extra_space 1.0 * SYMBWIDTH * ptscale; + +%============= Ligaturtabelle fuer Umlaute ==================== + +ligtable "a" : oct"042" =: oct"200"; +ligtable "o" : oct"042" =: oct"201"; +ligtable "u" : oct"042" =: oct"202"; +ligtable "A" : oct"042" =: oct"203"; +ligtable "O" : oct"042" =: oct"204"; +ligtable "U" : oct"042" =: oct"205"; + +%=============================================================== + + +def makechar expr charnumber = + if known o.i[charnumber] : + beginchar(charnumber,ocrb.width,ocrb.width,0); + pickup defaultpen; + kx := 0; + for i:=1 step 1 until o.i[charnumber]: + if known o.s[charnumber][i] : + xpath :=(o.s[charnumber][i] shifted (shiftfak,0) ) scaled scalefak; + savepath xpath; + for k:=0 step 1 until (length xpath): + kx:=kx+1; + z[kx] = point k of xpath; + endfor + fi + endfor + if proofing>0 : + labels(0,1,2,3,4,5,6,7,8,9); + labels(10,11,12,13,14,15,16,17,18,19); + labels(20,21,22,23,24,25,26,27,28,29); + labels(30,31,32,33,34,35,36,37,38,39); + fi + dofinishing; +%corrwidth capheight; + corrwidth SYMBWIDTH; +% Tiefe korrigieren + if known o.m[charnumber]: + if (o.m[charnumber]-(0.5*ocrb.penwidth))< 0: + chardp := ((o.m[charnumber]-(0.5*ocrb.penwidth)) * scalefak ) / pt; + d :=vround (chardp*pt); + fi + fi + endchar; + else: + message "unknown character referenced in makechar"; + fi +enddef; + +body_height#:=11.5*scalefak; +asc_height#:= 11.5*scalefak; +cap_height#:= 11.5*scalefak; +fig_height#:= 12.6*scalefak; +x_height#:= 8.5*scalefak; +math_axis#:= 8.5*scalefak; + +hohl := lightfactor * ocrb.penwidth * scalefak; % 0<= lightfactor < 1 |