| 1 |
%%%%%%%%%%%%%%%%% Endehandlung nach Zeichenbestimmung %%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Copyright 1995, 2010 Norbert Schwarz |
| 4 |
% You may freely use, modify, and/or distribute this file, without limitation. |
| 5 |
% |
| 6 |
% Dies wird am Ende jeden Zeichens v o r "endchar ausgefuehrt. |
| 7 |
% |
| 8 |
% Dort koennen globale Design-Entscheidungen durch evtl. |
| 9 |
% Mehrfachausgaben realisiert wdrden. |
| 10 |
% |
| 11 |
mode_setup; |
| 12 |
|
| 13 |
pen penxy; |
| 14 |
picture bild; picture bildb; |
| 15 |
path negpath; |
| 16 |
|
| 17 |
def dofinishing = |
| 18 |
prule; % Rule in xheight-- Hoehe |
| 19 |
for j:=1 step 1 until subchar: |
| 20 |
firstpath:= firstpathcount[j]; |
| 21 |
lastpath := lastpathcount[j]; |
| 22 |
% message "path "&decimal j ; |
| 23 |
% message " from "&decimal firstpath; |
| 24 |
% message " to "&decimal lastpath ; |
| 25 |
if j > 1 : |
| 26 |
penxy := defaultpen; |
| 27 |
if known penrand : defaultpen := defaultpen scaled penrand; fi |
| 28 |
cullit; undrawallpath; |
| 29 |
if sharpedges>0: cullit; shutedges -1; fi |
| 30 |
defaultpen :=penxy; |
| 31 |
cullit; |
| 32 |
fi |
| 33 |
drawallpath; |
| 34 |
% if globalslant>0 : "with slant"; fi |
| 35 |
if sharpedges>0 : |
| 36 |
% "with sharp edges"; |
| 37 |
shutedges 1; |
| 38 |
fi |
| 39 |
if hohl>0 l: |
| 40 |
% "'hohl'"; |
| 41 |
cullit; |
| 42 |
pickup pencircle scaled hohl; |
| 43 |
undrawallpath; |
| 44 |
cullit; |
| 45 |
if sharpedges>0 : shutedges -1 ; fi |
| 46 |
cullit; |
| 47 |
fi |
| 48 |
if extraline>0 : |
| 49 |
% " with extraline"; |
| 50 |
pickup pencircle scaled extraline; |
| 51 |
drawallpath; |
| 52 |
if sharpedges>0 : shutedges 1; fi |
| 53 |
fi |
| 54 |
endfor |
| 55 |
if negativ > 0: |
| 56 |
cullit; bild:=currentpicture; |
| 57 |
clearit; |
| 58 |
negpath:= (-0.5*SYMBWIDTH/scalefak ,-0.35maxy)-- |
| 59 |
( 0.5*SYMBWIDTH/scalefak ,-0.35maxy)-- |
| 60 |
( 0.5*SYMBWIDTH/scalefak , 1.2maxy)-- |
| 61 |
(-0.5*SYMBWIDTH/scalefak , 1.2maxy)--cycle; |
| 62 |
% (-0.5*SYMBWIDTH/scalefak ,-0.35maxy)..cycle; |
| 63 |
fill (negpath shifted (shiftfak,0) scaled scalefak); |
| 64 |
cullit; |
| 65 |
bildb := currentpicture; |
| 66 |
clearit; |
| 67 |
currentpicture := bildb-bild; |
| 68 |
cullit; |
| 69 |
% showit; |
| 70 |
fi |
| 71 |
clearallpath; |
| 72 |
enddef; |
| 73 |
|
| 74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 75 |
%def comment text x= |
| 76 |
% for k:=0 step 29 until (length x)+ 28 : |
| 77 |
% special " 9"&substring(k,k+29) of(x&" ") ; |
| 78 |
% numspecial 0;numspecial 0; endfor enddef; |
| 79 |
|
| 80 |
def corrwidth expr x= charwd:=x/pt; |
| 81 |
w:=x; |
| 82 |
h:=w; |
| 83 |
enddef; |
| 84 |
def prule = |
| 85 |
proofrule((0,0.5capheight),(capheight,0.5capheight)); |
| 86 |
proofrule((0,0.25capheight),(capheight,0.25capheight)); |
| 87 |
proofrule((0,0.75capheight),(capheight,0.75capheight)); |
| 88 |
proofrule((0.25capheight,0),(0.25capheight,capheight)); |
| 89 |
proofrule((0.75capheight,0),(0.75capheight,capheight)); |
| 90 |
proofrule(( 0.5capheight,0),(0.5capheight,capheight));enddef; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
sheight := 0.75 xheight; |
| 95 |
|
| 96 |
vardef make@#= |
| 97 |
if (length str@#) = 1: charcode:=ASCII str @#; else: charcode:=0; fi |
| 98 |
"Generierung: "&str@#; |
| 99 |
beginchar(charcode,10,10,0); |
| 100 |
char@#; |
| 101 |
endchar; |
| 102 |
enddef; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
path allpath[]; |
| 107 |
|
| 108 |
def clearallpath = |
| 109 |
subchar := 1; |
| 110 |
firstpathcount[subchar]:=0; |
| 111 |
lastpathcount[subchar]:=-1; |
| 112 |
pathcount:=-1; enddef; |
| 113 |
|
| 114 |
def nextsubchar = |
| 115 |
subchar := subchar+1; |
| 116 |
firstpathcount[subchar]:=pathcount+1; |
| 117 |
lastpathcount[subchar]:=pathcount; |
| 118 |
enddef; |
| 119 |
|
| 120 |
|
| 121 |
clearallpath; |
| 122 |
pen shutpen; |
| 123 |
path unitpath; |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
def shutedges expr www = |
| 128 |
unitpath := (-0.5,-0.5)--(0.5,-0.5)--(0.5,0.5)--(-0.5,0.5)..cycle; |
| 129 |
shutwidth := abs pen_lft + pen_rt; |
| 130 |
for i:=firstpath step 1 until lastpath: |
| 131 |
if cycle allpath[i]: |
| 132 |
else: |
| 133 |
shutpen:= makepen (unitpath scaled shutwidth |
| 134 |
rotated (angle(direction 0 of allpath[i]))) |
| 135 |
slanted globalslant ; |
| 136 |
pickup shutpen; |
| 137 |
drawdot ((point 0 of allpath[i]) |
| 138 |
slanted globalslant) |
| 139 |
withweight www; |
| 140 |
shutpen:= makepen (unitpath scaled shutwidth |
| 141 |
rotated (angle (direction infinity of allpath[i]))) |
| 142 |
slanted globalslant ; |
| 143 |
pickup shutpen; drawdot ((point infinity of allpath[i]) |
| 144 |
slanted globalslant) |
| 145 |
withweight www; |
| 146 |
fi |
| 147 |
endfor |
| 148 |
pickup defaultpen; |
| 149 |
enddef; |
| 150 |
|
| 151 |
def savepath text p = pathcount:=pathcount+1; |
| 152 |
lastpathcount[subchar]:=pathcount; |
| 153 |
allpath[pathcount]:=p; enddef; |
| 154 |
|
| 155 |
def drawallpath = |
| 156 |
if globalslant=0: |
| 157 |
for i:=firstpath step 1 until lastpath: draw allpath[i]; endfor |
| 158 |
else: |
| 159 |
for i:=firstpath step 1 until lastpath: |
| 160 |
draw (allpath[i] slanted globalslant); |
| 161 |
endfor |
| 162 |
fi |
| 163 |
enddef; |
| 164 |
|
| 165 |
def undrawallpath = |
| 166 |
if globalslant=0: |
| 167 |
for i:=firstpath step 1 until lastpath: undraw allpath[i]; endfor |
| 168 |
else: |
| 169 |
for i:=firstpath step 1 until lastpath: |
| 170 |
undraw (allpath[i] slanted globalslant); |
| 171 |
endfor |
| 172 |
fi |
| 173 |
enddef; |
| 174 |
|
| 175 |
|
| 176 |
%===================================================================== |
| 177 |
|
| 178 |
|
| 179 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$%%%%% |
| 180 |
%%%%%%%%%%%%%% Makros und Konstanten zum Font O C R B %%%%%%%%%%%%%%%%%% |
| 181 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 182 |
|
| 183 |
|
| 184 |
% ========== |
| 185 |
designfaktor := designsize*0.1; |
| 186 |
|
| 187 |
capheight := 12.275*mm*designfaktor; % Hoehe von "E" unskaliert |
| 188 |
xheight := 0.5*capheight * designfaktor; % |
| 189 |
SYMBWIDTH := 2.54mm*designfaktor; % 10 Zeichen je inch |
| 190 |
|
| 191 |
scalefak := mm*2.28/11.4*designfaktor; % ================================ |
| 192 |
|
| 193 |
path o.s[][]; |
| 194 |
|
| 195 |
ocrb.penwidth := 1.75; % Strichstaerke |
| 196 |
ocrb.width := 7 + ocrb.penwidth; |
| 197 |
|
| 198 |
pen defaultpen; |
| 199 |
defaultpen :=pencircle scaled (ocrb.penwidth*scalefak); |
| 200 |
maxy := 12.6 + 0.5ocrb.penwidth; |
| 201 |
|
| 202 |
%shiftfak := 0.5maxy; |
| 203 |
shiftfak := (0.5SYMBWIDTH)/scalefak; |
| 204 |
path xpath; |
| 205 |
|
| 206 |
%------- font dimensionen |
| 207 |
ptscale := 1/pt; |
| 208 |
|
| 209 |
font_x_height (8.5+0.5ocrb.penwidth)*scalefak / pt * designfaktor; |
| 210 |
font_slant globalslant ; |
| 211 |
font_normal_space 1.0 * SYMBWIDTH * ptscale; |
| 212 |
font_normal_stretch 0.0 * SYMBWIDTH * ptscale; |
| 213 |
font_normal_shrink 0.0 * SYMBWIDTH * ptscale; |
| 214 |
font_quad 2.0 * SYMBWIDTH * ptscale; |
| 215 |
font_extra_space 1.0 * SYMBWIDTH * ptscale; |
| 216 |
|
| 217 |
%============= Ligaturtabelle fuer Umlaute ==================== |
| 218 |
|
| 219 |
ligtable "a" : oct"042" =: oct"200"; |
| 220 |
ligtable "o" : oct"042" =: oct"201"; |
| 221 |
ligtable "u" : oct"042" =: oct"202"; |
| 222 |
ligtable "A" : oct"042" =: oct"203"; |
| 223 |
ligtable "O" : oct"042" =: oct"204"; |
| 224 |
ligtable "U" : oct"042" =: oct"205"; |
| 225 |
|
| 226 |
%=============================================================== |
| 227 |
|
| 228 |
|
| 229 |
def makechar expr charnumber = |
| 230 |
if known o.i[charnumber] : |
| 231 |
beginchar(charnumber,ocrb.width,ocrb.width,0); |
| 232 |
pickup defaultpen; |
| 233 |
kx := 0; |
| 234 |
for i:=1 step 1 until o.i[charnumber]: |
| 235 |
if known o.s[charnumber][i] : |
| 236 |
xpath :=(o.s[charnumber][i] shifted (shiftfak,0) ) scaled scalefak; |
| 237 |
savepath xpath; |
| 238 |
for k:=0 step 1 until (length xpath): |
| 239 |
kx:=kx+1; |
| 240 |
z[kx] = point k of xpath; |
| 241 |
endfor |
| 242 |
fi |
| 243 |
endfor |
| 244 |
if proofing>0 : |
| 245 |
labels(0,1,2,3,4,5,6,7,8,9); |
| 246 |
labels(10,11,12,13,14,15,16,17,18,19); |
| 247 |
labels(20,21,22,23,24,25,26,27,28,29); |
| 248 |
labels(30,31,32,33,34,35,36,37,38,39); |
| 249 |
fi |
| 250 |
dofinishing; |
| 251 |
%corrwidth capheight; |
| 252 |
corrwidth SYMBWIDTH; |
| 253 |
% Tiefe korrigieren |
| 254 |
if known o.m[charnumber]: |
| 255 |
if (o.m[charnumber]-(0.5*ocrb.penwidth))< 0: |
| 256 |
chardp := ((o.m[charnumber]-(0.5*ocrb.penwidth)) * scalefak ) / pt; |
| 257 |
d :=vround (chardp*pt); |
| 258 |
fi |
| 259 |
fi |
| 260 |
endchar; |
| 261 |
else: |
| 262 |
message "unknown character referenced in makechar"; |
| 263 |
fi |
| 264 |
enddef; |
| 265 |
|
| 266 |
body_height#:=11.5*scalefak; |
| 267 |
asc_height#:= 11.5*scalefak; |
| 268 |
cap_height#:= 11.5*scalefak; |
| 269 |
fig_height#:= 12.6*scalefak; |
| 270 |
x_height#:= 8.5*scalefak; |
| 271 |
math_axis#:= 8.5*scalefak; |
| 272 |
|
| 273 |
hohl := lightfactor * ocrb.penwidth * scalefak; % 0<= lightfactor < 1 |