| 1 |
%% @metafontfile{ |
| 2 |
%% filename="eubase.mf", |
| 3 |
%% version="2.2", |
| 4 |
%% date="04-JAN-1995", |
| 5 |
%% filetype="Metafont: base", |
| 6 |
%% copyright="Copyright (C) American Mathematical Society, |
| 7 |
%% all rights reserved. Copying of this file is |
| 8 |
%% authorized only if either: |
| 9 |
%% (1) you make absolutely no changes to your copy |
| 10 |
%% including name; OR |
| 11 |
%% (2) if you do make changes, you first rename it to some |
| 12 |
%% other name.", |
| 13 |
%% author="American Mathematical Society", |
| 14 |
%% address="American Mathematical Society, |
| 15 |
%% Technical Support, Electronic Products and Services, |
| 16 |
%% P. O. Box 6248, |
| 17 |
%% Providence, RI 02940, |
| 18 |
%% USA", |
| 19 |
%% telephone="401-455-4080 or (in the USA) 800-321-4AMS", |
| 20 |
%% email="Internet: [email protected]", |
| 21 |
%% codetable="ISO/ASCII", |
| 22 |
%% checksum = "28056 419 2057 14865" |
| 23 |
%% keywords="amsfonts, tex, metafont , euler ", |
| 24 |
%% abstract="This is the base file for use with |
| 25 |
%% the euler fonts in AMSFonts 2.2." |
| 26 |
%% docstring = "The checksum field above contains a CRC-16 |
| 27 |
%% checksum as the first value, followed by the |
| 28 |
%% equivalent of the standard UNIX wc (word |
| 29 |
%% count) utility output of lines, words, and |
| 30 |
%% characters. This is produced by Robert |
| 31 |
%% Solovay's checksum utility.", |
| 32 |
%% } |
| 33 |
% |
| 34 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 |
% base file for Euler Fonts, by David Siegel and John Hobby |
| 36 |
|
| 37 |
%def define_euler_pixels(text t) = |
| 38 |
%forsuffixes $=t: $=$.#*hppp; endfor enddef; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
pixperem = ptsize*pt; |
| 43 |
|
| 44 |
% Beginning of change for version 2.1 |
| 45 |
% replaced the next four lines: |
| 46 |
%h#=ptsize/programem; |
| 47 |
%v#=h#*aspect_ratio; |
| 48 |
% define_euler_pixels(h,v); |
| 49 |
%v#:=h#; % DEK (I doubt if aspect_ratio<>1 will work, but this does help) |
| 50 |
|
| 51 |
% with the following five lines: |
| 52 |
if unknown xscale_factor: xscale_factor := 1; fi |
| 53 |
h# = ptsize * xscale_factor / programem; |
| 54 |
v# = ptsize / programem; |
| 55 |
h = h#*hppp; |
| 56 |
v = v#*vppp; |
| 57 |
|
| 58 |
% end of change for version 2.1 4/4/91 NGB |
| 59 |
|
| 60 |
define_pixels(leftside, rightside); |
| 61 |
% h = pixperem/programem; |
| 62 |
% v = pixperem/programem*aspect_ratio; |
| 63 |
|
| 64 |
dandch = 3.94h; % dandch = (pixperem/935); |
| 65 |
dandcv = 3.94v; % dandcv = (pixperem/935); |
| 66 |
|
| 67 |
nwdh# = h#*programem/925; % h*3.784 |
| 68 |
nwdv# = v#*programem/925; % v*3.784 |
| 69 |
nwdh = h*programem/925; |
| 70 |
nwdv = v*programem/925; |
| 71 |
% dandc == dan mills and carol twombly; nwd == dave siegel -- DEK |
| 72 |
adjustx:= 3.92; |
| 73 |
adjusty:= 3.92; |
| 74 |
|
| 75 |
save_leftside#:=leftside#; save_rightside#:=rightside#; % DEK |
| 76 |
def more_side(expr s_sharp) = |
| 77 |
leftside#:=save_leftside#+s_sharp; rightside#:=save_rightside#+s_sharp; |
| 78 |
define_pixels(leftside,rightside); |
| 79 |
enddef; |
| 80 |
|
| 81 |
% ----- Fontbegin, Charbegin ----------------------------------- |
| 82 |
% -------------------------------------------------------------- |
| 83 |
|
| 84 |
transform rot; |
| 85 |
|
| 86 |
def charbegin(expr c,w_sharp,h_sharp,d_sharp) = |
| 87 |
begingroup |
| 88 |
charcode:=if known c: byte c else: 0 fi; |
| 89 |
W := w_sharp*pt; |
| 90 |
chardx:=round(W+leftside+rightside); % desired width of character in pixels |
| 91 |
charwd:=w_sharp+leftside#+rightside#; charht:=h_sharp; chardp:=d_sharp; |
| 92 |
% charic:=0; clearxy; clearit; clearpen; scantokens extra_beginchar; |
| 93 |
% rot := identity; |
| 94 |
charic:=0; clearxy; clearit; clearpen; % DEK |
| 95 |
rot := identity; scantokens extra_beginchar; |
| 96 |
pair tiept[]; |
| 97 |
enddef; |
| 98 |
|
| 99 |
def endchar(expr addwidth_sharp) = |
| 100 |
scantokens extra_endchar; |
| 101 |
%if proofing>0: makebox(proofrule); fi |
| 102 |
addwidth:=addwidth_sharp*pt; |
| 103 |
%currentpicture := currentpicture shifted (leftside+addwidth,0); |
| 104 |
xoffset:=leftside+addwidth; |
| 105 |
H:=charht*pt; D:=chardp*pt; |
| 106 |
if known nohashmarks:; |
| 107 |
else: |
| 108 |
if proofing>0: |
| 109 |
for y=0,H,-D*pt: |
| 110 |
proofrule((-xoffset,y),(10-xoffset,y)); |
| 111 |
proofrule((chardx-10-xoffset,y),(chardx-xoffset,y)); endfor % horizontals |
| 112 |
for x=-xoffset,chardx-xoffset: |
| 113 |
proofrule((x,10-D),(x,-D)); proofrule((x,H-10),(x,H)); endfor % verticals fi |
| 114 |
fi |
| 115 |
fi |
| 116 |
shipit; |
| 117 |
%if displaying>0: makebox(screenrule); showit; fi |
| 118 |
endgroup enddef; |
| 119 |
|
| 120 |
def mathcorr(expr subwidth_sharp) = % DEK |
| 121 |
charic:=subwidth_sharp; charwd:=charwd-charic; |
| 122 |
enddef; |
| 123 |
|
| 124 |
% ----- TeX Information: ---------------------------------------- |
| 125 |
|
| 126 |
fontdimen 1: |
| 127 |
|
| 128 |
0, % italic correction degrees |
| 129 |
ptsize/3, % default spacing (3em) points |
| 130 |
0, % stretch " |
| 131 |
0, % shrink " |
| 132 |
(lcbody*v#), % xheight " |
| 133 |
ptsize, % quad " |
| 134 |
0, % math space |
| 135 |
(1400*v#), % num1 baseline raise, for numerators, display style |
| 136 |
(1000*v#), % num2 baseline raise, for numerators, non-atop |
| 137 |
(1100*v#), % num3 baseline raise, for numerators, atop styles |
| 138 |
(1400*v#), % denom1 amount to lower baselines in display style |
| 139 |
(600*v#), % denom1 amount to lower baselines in non-display |
| 140 |
(1500*v#), % sup1 |
| 141 |
(1400*v#), % sup2 guess at superscript raising again |
| 142 |
(1200*v#), % sup3 |
| 143 |
(depthy*v#), % sub1 subscripts with no super |
| 144 |
(900*v#), % sub2 maybe this is off by a little. |
| 145 |
(1500*v#), % supdrop how much to drop below a large box |
| 146 |
(100*v#), % supdrop how much to raise above a large box |
| 147 |
2.2(programem*v#), % size of \comb delimiters for display |
| 148 |
(programem*v#), % size of \comb delimiters for non-display |
| 149 |
(950*v#); % axisheight center for fraction line |
| 150 |
|
| 151 |
font_size ptsize; |
| 152 |
|
| 153 |
|
| 154 |
% Adjusting stems |
| 155 |
% revised by DEK to allow highres adjustments, 11 Aug 87 |
| 156 |
|
| 157 |
vardef set_stem_round(expr slo,s,shi,clo,c,chi) = |
| 158 |
stem_lo:=slo*h; stem_hi:=shi*h; stem_norm:=s*h; |
| 159 |
curve_lo:=clo*h; curve_hi:=chi*h; curve_norm:=c*h; |
| 160 |
save a,b; |
| 161 |
a-b = round (stem_norm - curve_norm); |
| 162 |
a = round(.5(stem_norm + curve_norm + a - b)); |
| 163 |
stem_norm_corr := a-stem_norm; % a is normal stem width in pixels |
| 164 |
curve_norm_corr := b-curve_norm; % b is normal curve width in pixels |
| 165 |
enddef; |
| 166 |
|
| 167 |
def no_stem_round = set_stem_round(-1,-1,-1,-1,-1,-1) enddef; |
| 168 |
no_stem_round; % default is to do ordinary rounding |
| 169 |
|
| 170 |
% The |stem_round| macro rounds its argument, forcing numbers that look like |
| 171 |
% stem widths to round near to |stem_norm|, and similarly forcing vertical curve |
| 172 |
% weights to round near to |curve_norm|. |
| 173 |
|
| 174 |
def stem_round primary w = if w<0: -stem_rnd(-w) else: stem_rnd(w) fi enddef; |
| 175 |
|
| 176 |
def stem_rnd(expr w) = |
| 177 |
round(w |
| 178 |
if (stem_lo<=w) and (w<=stem_hi): +stem_norm_corr |
| 179 |
elseif (curve_lo<=w) and (w<=curve_hi): +curve_norm_corr |
| 180 |
fi) |
| 181 |
enddef; |
| 182 |
|
| 183 |
% Filling cyclic paths with step width adjustment and rounding |
| 184 |
|
| 185 |
% Before calling the |adj_fill| macro, the user should set up an |
| 186 |
% array |t[]| and a nonnegative integer |n| so that |t[1]| through |t[n]| |
| 187 |
% are time values on some cyclic path |p|. It should be true that |t[i]<t[j]| |
| 188 |
% whenever |i<j|. Also |t[n]-t[1]| should be less than the length of |p|. |
| 189 |
% The |adj_fill| macro takes four lists of time values given as indices into |
| 190 |
% the |t| array. The avoids the necessity of writing \MF\ macros to sort |
| 191 |
% the time values. |
| 192 |
% Groups of paths are allowed to have points ``tied together.'' This is |
| 193 |
% implemented by saving coordinates in a special array of type |pair| |
| 194 |
% called |tiept|. If a path contains a point that is tied to a point in |
| 195 |
% an already computed path, then the adjusted coordinates of that point will |
| 196 |
% be saved in the |tiept| array. This array should be made unknown before |
| 197 |
% starting a new group of paths; e.g., in |beginchar|. |
| 198 |
|
| 199 |
|
| 200 |
% Make |y'a| and |y'b| rounded versions of |y.a| and |y.b|, so that |
| 201 |
% |y'a-y'b| is as close as possible to |y.a-y.b|. |
| 202 |
% If a time value is given as both fixed and vertical or horizontal then |
| 203 |
% |y'a| or |y'b| or both may already be known. Then we just round what |
| 204 |
% we can. |
| 205 |
|
| 206 |
vardef rnd_pr_y(suffix a, b) = |
| 207 |
if known y'a: if unknown y'b: y'b-y'a=round(y.b-y.a); fi |
| 208 |
elseif known y'b: y'b-y'a=round(y.b-y.a); |
| 209 |
else: |
| 210 |
y'a-y'b = round(y.a-y.b); |
| 211 |
y'a = round(.5(y.a + y.b + y'a - y'b)); |
| 212 |
fi |
| 213 |
enddef; |
| 214 |
|
| 215 |
% Rounding |x| coordinates is similar except we use the special |stem_round| |
| 216 |
% routine. |
| 217 |
|
| 218 |
vardef rnd_pr_x(suffix a, b) = |
| 219 |
% use the next line if you want to see what channel settings are reasonable |
| 220 |
% (also set tracingtitles:=1 in such a case) |
| 221 |
% message decimal t.a&","&decimal t.b&":"&decimal((x.b-x.a)/h); |
| 222 |
if known x'a: if unknown x'b: x'b-x'a=stem_round(x.b-x.a); fi |
| 223 |
elseif known x'b: x'b-x'a=stem_round(x.b-x.a); |
| 224 |
else: |
| 225 |
x'a-x'b = stem_round(x.a-x.b); |
| 226 |
x'a = round(.5(x.a + x.b + x'a - x'b)); |
| 227 |
fi |
| 228 |
enddef; |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
% Set up a transform |curtx=tx.a| that takes |x.a| into |x'a| and |x.b| |
| 233 |
% into |x'b| without slanting or changing $y$-components. |
| 234 |
|
| 235 |
vardef set_tx(suffix a,b) = |
| 236 |
save u,v; |
| 237 |
xypart tx.a = yxpart tx.a = 0; |
| 238 |
(x.a,0) transformed tx.a = (x'a,0); |
| 239 |
(u,v) = (x.b,1) transformed tx.a - (x'b,1); |
| 240 |
if known u: xxpart tx.a = yypart tx.a = 1; |
| 241 |
else: (u,v)=origin; |
| 242 |
fi |
| 243 |
curtx := tx.a |
| 244 |
enddef; |
| 245 |
|
| 246 |
|
| 247 |
% Set up a transform |curty=ty.a| that takes |y.a| into |y'a| and |y.b| |
| 248 |
% into |y'b| without slanting or changing $x$-components. |
| 249 |
|
| 250 |
vardef set_ty(suffix a,b) = |
| 251 |
save u,v; |
| 252 |
xypart ty.a = yxpart ty.a = 0; |
| 253 |
(0,y.a) transformed ty.a = (0,y'a); |
| 254 |
(u,v) = (1,y.b) transformed ty.a - (1,y'b); |
| 255 |
if known v: xxpart ty.a = yypart ty.a = 1; |
| 256 |
else: (u,v)=origin; |
| 257 |
fi |
| 258 |
curty := ty.a |
| 259 |
enddef; |
| 260 |
|
| 261 |
|
| 262 |
% The following macros ensure that |x'i| or |y'i| agree with the current |
| 263 |
% transform. It is important that this be done for all relevant |i| each |
| 264 |
% time |set_tx| or |set_ty| is called. Since some points may be tied to |
| 265 |
% others, this can affect which |x'j| and |y'j| are known. Future calls to |
| 266 |
% |set_tx| and |set_ty| should be based on the most up to date possible |
| 267 |
% information. |
| 268 |
|
| 269 |
vardef yset@# = (0,y'@#) = (0,y@#) transformed curty; enddef; |
| 270 |
vardef xset@# = (x'@#,0) = (x@#,0) transformed curtx; enddef; |
| 271 |
|
| 272 |
|
| 273 |
% Apply |set_txy| to each pair indices |a,b| such that |xy'[a]| and |xy'[b]| |
| 274 |
% are known, but |xy'[c] is unknown for all |c| between |a| and |b|. |
| 275 |
% This leaves the appropriate initial transformation in |curtx| or |curty|. |
| 276 |
% The |xyset| parameter is either |xset| or |yset| as explained above. |
| 277 |
|
| 278 |
vardef set_trans(suffix xy, set_txy, xyset) = |
| 279 |
save previ, firsti; |
| 280 |
for i=1 upto n: if known xy'[i]: |
| 281 |
if known firsti: |
| 282 |
set_txy([previ], [i]); |
| 283 |
for j=previ+1 upto i-1: xyset[j]; endfor |
| 284 |
else: firsti = i; |
| 285 |
fi |
| 286 |
previ := i; |
| 287 |
fi endfor |
| 288 |
if known firsti: |
| 289 |
for i=1 upto firsti: if known xy'[i]: |
| 290 |
set_txy([previ], [i]); |
| 291 |
if previ>=firsti: |
| 292 |
for j=previ+1 upto n: xyset[j]; endfor |
| 293 |
for j=1 upto i-1: xyset[j]; endfor |
| 294 |
else: |
| 295 |
for j=previ+1 upto i-1: xyset[j]; endfor |
| 296 |
fi |
| 297 |
previ:=i; |
| 298 |
fi endfor |
| 299 |
else: |
| 300 |
for i=1 upto n: xyset[i]; endfor |
| 301 |
fi |
| 302 |
enddef; |
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
% Return the transformed $i$th segement of |p_path| as defined by the time |
| 307 |
% values in |t[]|, updating |curtx| and |curty| if appropriate. |
| 308 |
|
| 309 |
vardef new_seg(expr i) = |
| 310 |
save p; path p; |
| 311 |
if known tx[i]: curtx:=tx[i]; fi |
| 312 |
if known ty[i]: curty:=ty[i]; fi |
| 313 |
p = subpath (t[i],t[i+1]) of p_path transformed (curtx transformed curty); |
| 314 |
p |
| 315 |
enddef; |
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
% The following macros are used only when |t| entries are readjusted: |
| 320 |
|
| 321 |
|
| 322 |
% Find the first time on the path |p| where the direction is |dir| or |-dir|. |
| 323 |
|
| 324 |
def extremetime expr dir of p = |
| 325 |
begingroup save a,b; |
| 326 |
a = directiontime dir of p; if a<0: a:=infinity; fi |
| 327 |
b = directiontime -dir of p; if b<0: b:=infinity; fi |
| 328 |
if a<b: a else: b fi |
| 329 |
endgroup |
| 330 |
enddef; |
| 331 |
|
| 332 |
|
| 333 |
% Adjust the time value |tt| to the nearest time when the direction of |p_path| |
| 334 |
% is |dir| or |-dir|. |
| 335 |
|
| 336 |
vardef adj_t(suffix tt)(expr dir) = |
| 337 |
save p, a, b; path p; |
| 338 |
p = subpath (tt,tt+nn) of p_path & cycle; |
| 339 |
a = extremetime dir of p; |
| 340 |
a := if a<1: a[tt,floor tt+1] else: a+floor tt fi; |
| 341 |
b = extremetime dir of reverse p; |
| 342 |
b := if b<1: b[tt,ceiling tt-1] else: ceiling tt - b fi; |
| 343 |
tt := if b+a>2tt: b else: a fi; |
| 344 |
enddef; |
| 345 |
|
| 346 |
|
| 347 |
% Issue an error message when |t[i]>t[i+1]| after the above adjustment process. |
| 348 |
|
| 349 |
vardef bad_order(expr i) = |
| 350 |
initerim showstopping:=0; |
| 351 |
show t[i], t[i+1]; |
| 352 |
errmessage "Adjusted t entries "&decimal i&" and "&decimal(i+1) |
| 353 |
&" are out of order. (See above)"; |
| 354 |
enddef; |
| 355 |
|
| 356 |
|
| 357 |
% The |adj_fill| macro performs the entire adjustment and filling based on |
| 358 |
% the following parameters: a list |tfx| of |t| indices for points whose |
| 359 |
% $x$-coordinates should not be moved during the adjustment process, a similar |
| 360 |
% list |tfy| for $y$-coordinates, a list of pairs $(i,j)$ where $i$ is a |t| |
| 361 |
% index and |tiept[j]| is the corresponding tie point, lists |tv| and |th| of |
| 362 |
% pairs of |t| indices that correspond to opposite sides of vertical and |
| 363 |
% horizontal strokes, and finally a cyclic path |p|. (Note the scaling by |h| |
| 364 |
% and |v|.) |
| 365 |
|
| 366 |
vardef adj_fill@#(text tfx, tfy, tie, tv, th)(expr p) = |
| 367 |
% message str@#; % that's for use with the stem-round message above |
| 368 |
save p_path, nn, x, y, tx, ty, curtx, curty; |
| 369 |
path p_path, p_path'; |
| 370 |
transform tx[], ty[], curtx, curty; |
| 371 |
p_path = p transformed (identity xscaled h yscaled v transformed rot); |
| 372 |
nn = length p_path; |
| 373 |
if proofing>1: |
| 374 |
makelabel(str @#, point 0 of p_path); |
| 375 |
for i=1 upto nn-1: makelabel(decimal i, point i of p_path); endfor |
| 376 |
fi |
| 377 |
forsuffixes i=tfx: x.fix.i=1; endfor % Prepare for |adj_t| calls. |
| 378 |
forsuffixes i=tfy: y.fix.i=1; endfor |
| 379 |
for w=1 tv: if pair w: (x.fix[xpart w],x.fix[ypart w]) = (1,1); fi endfor |
| 380 |
for w=1 th: if pair w: (y.fix[xpart w],y.fix[ypart w]) = (1,1); fi endfor |
| 381 |
for i=1 upto n: |
| 382 |
if t[i]>floor t[i]: |
| 383 |
if unknown x.fix[i]: adj_t(t[i],right); fi |
| 384 |
if unknown y.fix[i]: adj_t(t[i],up); fi |
| 385 |
fi |
| 386 |
endfor |
| 387 |
t[n+1] := t1+nn; |
| 388 |
for i=1 upto n: if t[i]>t[i+1]: bad_order(i); fi endfor |
| 389 |
for i=1 upto n: z[i] = point t[i] of p_path; endfor |
| 390 |
forsuffixes i=tfx: x'i =x.i; endfor |
| 391 |
forsuffixes i=tfy: y'i =y.i; endfor |
| 392 |
for w=1 tie: if pair w: z'[xpart w] = tiept[ypart w]; fi endfor |
| 393 |
for w=1 tv: if pair w: rnd_pr_x([xpart w], [ypart w]); fi endfor |
| 394 |
for w=1 th: if pair w: rnd_pr_y([xpart w], [ypart w]); fi endfor |
| 395 |
curtx=curty=identity; |
| 396 |
set_trans(x, set_tx, xset); |
| 397 |
set_trans(y, set_ty, yset); |
| 398 |
p_path' = if n=0: p_path else: |
| 399 |
for i=1 upto n: new_seg(i)-- endfor cycle |
| 400 |
fi; |
| 401 |
interim autorounding := 0; |
| 402 |
interim smoothing := 0; |
| 403 |
begingroup save currenttransform; |
| 404 |
transform currenttransform; currenttransform:=identity; |
| 405 |
if known fillwhite: |
| 406 |
draw p_path' withpen pencircle scaled 4; % was scaled 2 |
| 407 |
else: |
| 408 |
begingroup save pic; % Now fill |
| 409 |
picture pic; |
| 410 |
pic=currentpicture; |
| 411 |
currentpicture:=nullpicture; |
| 412 |
interim turningcheck := 0; |
| 413 |
fill p_path'; |
| 414 |
cull currentpicture dropping origin; |
| 415 |
addto currentpicture also pic; |
| 416 |
endgroup; |
| 417 |
fi |
| 418 |
endgroup; |
| 419 |
enddef; |