| 1 |
% mathematical symbols by Anthony Phan. |
| 2 |
% file: mathacnt.mf (accents) |
| 3 |
% last modification: May 16, 2005. |
| 4 |
% Only known charcodes will be generated. |
| 5 |
|
| 6 |
def horizontal_rules_list=math_axis, |
| 7 |
-body_depth,-desc_depth,x_height,cap_height,asc_height,body_height |
| 8 |
enddef; |
| 9 |
|
| 10 |
% ACCENTS (nullissime) |
| 11 |
|
| 12 |
diacritics_proofing;% changes extra_endchar for proof mode. |
| 13 |
hat_w:=hex"70"; |
| 14 |
check_w:=hex"71"; |
| 15 |
tilde_w:=hex"72"; |
| 16 |
bar_w:=hex"73"; |
| 17 |
arrow_w:=hex"74"; |
| 18 |
paren_w:=hex"75"; |
| 19 |
|
| 20 |
hat_ww:=hex"78"; hat_www:=hex"79"; |
| 21 |
hat_wwww:=hex"7A"; hat_wwwww:=hex"7B"; |
| 22 |
check_ww:=hex"7C"; check_www:=hex"7D"; |
| 23 |
check_wwww:=hex"7E"; check_wwwww:=hex"7F"; |
| 24 |
tilde_ww:=hex"80"; tilde_www:=hex"81"; |
| 25 |
tilde_wwww:=hex"82"; tilde_wwwww:=hex"83"; |
| 26 |
bar_ww:=hex"84"; bar_www:=hex"85"; |
| 27 |
bar_wwww:=hex"86"; bar_wwwww:=hex"87"; |
| 28 |
arrow_ww:=hex"88"; arrow_www:=hex"89"; |
| 29 |
arrow_wwww:=hex"8A"; arrow_wwwww:=hex"8B"; |
| 30 |
paren_ww:=hex"8C"; paren_www:=hex"8D"; |
| 31 |
paren_wwww:=hex"8E"; paren_wwwww:=hex"8F"; |
| 32 |
|
| 33 |
charlist hat_w: hat_ww: hat_www: hat_wwww: hat_wwwww; |
| 34 |
charlist check_w: check_ww: check_www: check_wwww: check_wwwww; |
| 35 |
charlist tilde_w: tilde_ww: tilde_www: tilde_wwww: tilde_wwwww; |
| 36 |
charlist bar_w: bar_ww: bar_www: bar_wwww: bar_wwwww; |
| 37 |
charlist arrow_w: arrow_ww: arrow_www: arrow_wwww: arrow_wwwww; |
| 38 |
charlist paren_w: paren_ww: paren_www: paren_wwww: paren_wwwww; |
| 39 |
|
| 40 |
vardef tmp_program(expr orientation,overshot,appr,coef)= |
| 41 |
save a,b,c; |
| 42 |
pickup crisp.nib; |
| 43 |
b=coef[0.8[vair,stem],stem]; |
| 44 |
b'=coef[min(vair,hair),max(vair,hair)]; |
| 45 |
if orientation=up: |
| 46 |
top y2r=top y3r=h+overshot; |
| 47 |
bot y1r=bot y4r=vround 0.5[x_height,h]; |
| 48 |
else: |
| 49 |
bot y2r=bot y3r=vround 0.5[x_height,h]-overshot; |
| 50 |
top y1r=top y4r=h; fi |
| 51 |
lft x2r=hround 0.5(w-b); |
| 52 |
rt x3r-lft x2r=hround b; |
| 53 |
lft x1r=appr; x4r-x3r=x2r-x1r; |
| 54 |
x=0.5(b-b')/length(z2r-z1r); |
| 55 |
a=if orientation=up: 180+ fi (angle(z2r-z1r)-angle(x,1+-+x)); |
| 56 |
pos1(b',a); pos2(b,a); pos3(b,180-a); pos4(b',180-a); |
| 57 |
z0=whatever[z1l,z2l]; z0=whatever[z3l,z4l]; |
| 58 |
filldraw z1r--z2r--z3r--z4r--z4l--z0--z1l--cycle; |
| 59 |
penlabels(0,1,2,3,4) |
| 60 |
enddef; |
| 61 |
|
| 62 |
use_rule1; |
| 63 |
|
| 64 |
beginchar(hat_accent,7u#+2appr#,min(asc_height#,2x_height#),0); |
| 65 |
"Circumflex accent"; |
| 66 |
tmp_program(up,0,appr+u,0); |
| 67 |
endchar; |
| 68 |
|
| 69 |
beginchar(hat_w,8u#+2appr#,0.5[asc_height#,body_height#],0); |
| 70 |
"Wide circumflex accent 1"; |
| 71 |
tmp_program(up,o,appr-0.5u,0.2); |
| 72 |
endchar; |
| 73 |
|
| 74 |
beginchar(hat_ww,16u#+2appr#,body_height#,0); |
| 75 |
"Wide circumflex accent 2"; |
| 76 |
tmp_program(up,o,appr-0.5u,0.4); |
| 77 |
endchar; |
| 78 |
|
| 79 |
beginchar(hat_www,24u#+2appr#,body_height#,0); |
| 80 |
"Wide circumflex accent 3"; |
| 81 |
tmp_program(up,o,appr-0.5u,0.6); |
| 82 |
endchar; |
| 83 |
|
| 84 |
beginchar(hat_wwww,32u#+2appr#,body_height#,0); |
| 85 |
"Wide circumflex accent 4"; |
| 86 |
tmp_program(up,o,appr-0.5u,0.8); |
| 87 |
endchar; |
| 88 |
|
| 89 |
beginchar(hat_wwwww,40u#+2appr#,body_height#,0); |
| 90 |
"Wide circumflex accent 5"; |
| 91 |
tmp_program(up,o,appr-0.5u,1); |
| 92 |
endchar; |
| 93 |
|
| 94 |
beginchar(check_accent,7u#+2appr#,min(asc_height#,2x_height#),0); |
| 95 |
"Check accent"; |
| 96 |
tmp_program(down,0,appr-0.5u,0); |
| 97 |
endchar; |
| 98 |
|
| 99 |
beginchar(check_w,8u#+2appr#,0.5[asc_height#,body_height#],0); |
| 100 |
"Wide check accent 1"; |
| 101 |
tmp_program(down,o,appr-0.5u,0.2); |
| 102 |
endchar; |
| 103 |
|
| 104 |
beginchar(check_ww,16u#+2appr#,body_height#,0); |
| 105 |
"Wide check accent 2"; |
| 106 |
tmp_program(down,o,appr-0.5u,0.4); |
| 107 |
endchar; |
| 108 |
|
| 109 |
beginchar(check_www,24u#+2appr#,body_height#,0); |
| 110 |
"Wide check accent 3"; |
| 111 |
tmp_program(down,o,appr-0.5u,0.6); |
| 112 |
endchar; |
| 113 |
|
| 114 |
beginchar(check_wwww,32u#+2appr#,body_height#,0); |
| 115 |
"Wide check accent 4"; |
| 116 |
tmp_program(down,o,appr-0.5u,0.8); |
| 117 |
endchar; |
| 118 |
|
| 119 |
beginchar(check_wwwww,40u#+2appr#,body_height#,0); |
| 120 |
"Wide check accent 5"; |
| 121 |
tmp_program(down,o,appr-0.5u,1); |
| 122 |
endchar; |
| 123 |
|
| 124 |
vardef tmp_program(expr height,depth,approach,coef)= |
| 125 |
pickup tiny.nib; |
| 126 |
save a,b,c; |
| 127 |
a=angle(w-2approach,9(height-depth)); |
| 128 |
b=angle(w-2approach,-3(height-depth)); |
| 129 |
b'=coef[0.5[vair,hair],max(vair,hair)]; |
| 130 |
c=coef[0.8[vair,stem],stem]; |
| 131 |
pos1(b',a+90); pos9(b',a+90); pos5(c,b+90); |
| 132 |
bot y7l=depth-eps; top y3r=height+eps; |
| 133 |
y1l=good.y 1/6[y7l,y3r]; y3r-y9r=y1l-y7l; |
| 134 |
top y3r-bot y3l=top y7r-bot y7l=vround 0.5[b',c]; |
| 135 |
lft x1r=w-rt x9l=approach; |
| 136 |
z5=0.5[z1,z9]; |
| 137 |
forsuffixes $=r,l: y2$=y3$=y4$; y6$=y7$=y8$; |
| 138 |
z2$-z1$=whatever*dir a; z8$-z9$=whatever*dir a; |
| 139 |
z4$-z5$=whatever*dir b; z6$-z5$=whatever*dir b; |
| 140 |
x3$=0.666[x2$,x4$]; x7$=0.666[x8$,x6$]; |
| 141 |
endfor |
| 142 |
filldraw stroke z1e..controls .666[z1e,z2e] and .666[z3e,z2e] |
| 143 |
..z3e..controls .666[z3e,z4e] and .666[z5e,z4e] |
| 144 |
..z5e..controls .666[z5e,z6e] and .666[z7e,z6e] |
| 145 |
..z7e..controls .666[z7e,z8e] and .666[z9e,z8e]..z9e; |
| 146 |
%penlabels(1,2,3,4,5,6,7,8,9); |
| 147 |
enddef; |
| 148 |
|
| 149 |
beginchar(tilde_accent,7u#+2appr#,min(asc_height#,2x_height#),0); |
| 150 |
"Tilde accent"; |
| 151 |
tmp_program(h,vround 0.5[x_height,asc_height],appr,0); |
| 152 |
endchar; |
| 153 |
|
| 154 |
beginchar(tilde_w,8u#+2appr#,0.5[asc_height#,body_height#],0); |
| 155 |
"Wide tilde accent 1"; |
| 156 |
tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.2); |
| 157 |
endchar; |
| 158 |
|
| 159 |
beginchar(tilde_ww,16u#+2appr#,body_height#,0); |
| 160 |
"Wide tilde accent 2"; |
| 161 |
tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.4); |
| 162 |
endchar; |
| 163 |
|
| 164 |
beginchar(tilde_www,24u#+2appr#,body_height#,0); |
| 165 |
"Wide tilde accent 3"; |
| 166 |
tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.6); |
| 167 |
endchar; |
| 168 |
|
| 169 |
beginchar(tilde_wwww,32u#+2appr#,body_height#,0); |
| 170 |
"Wide tilde accent 4"; |
| 171 |
tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.8); |
| 172 |
endchar; |
| 173 |
|
| 174 |
beginchar(tilde_wwwww,40u#+2appr#,body_height#,0); |
| 175 |
"Wide tilde accent 5"; |
| 176 |
tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,1); |
| 177 |
endchar; |
| 178 |
|
| 179 |
% changes august 23, 2004. |
| 180 |
|
| 181 |
beginchar(bar_accent,7u#+2appr#, |
| 182 |
%x_height#+body_height#-cap_height#,0); |
| 183 |
0.5[x_height#,asc_height#],0); |
| 184 |
"Bar accent"; |
| 185 |
pickup crisp.nib; |
| 186 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 187 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.25u; |
| 188 |
top y1r=top y2r=vround(h+0.5a); |
| 189 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 190 |
endchar; |
| 191 |
|
| 192 |
beginchar(bar_w,8u#+2appr#, |
| 193 |
%x_height#+body_height#-cap_height#,0); |
| 194 |
0.5[x_height#,body_height#],0); |
| 195 |
"Wide bar accent 1"; |
| 196 |
pickup crisp.nib; |
| 197 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 198 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u; |
| 199 |
top y1r=top y2r=vround(h+0.5a); |
| 200 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 201 |
endchar; |
| 202 |
|
| 203 |
beginchar(bar_ww,16u#+2appr#, |
| 204 |
%x_height#+body_height#-cap_height#,0); |
| 205 |
0.5[x_height#,body_height#],0); |
| 206 |
"Wide bar accent 2"; |
| 207 |
pickup crisp.nib; |
| 208 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 209 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u; |
| 210 |
top y1r=top y2r=vround(h+0.5a); |
| 211 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 212 |
endchar; |
| 213 |
|
| 214 |
beginchar(bar_www,24u#+2appr#, |
| 215 |
%x_height#+body_height#-cap_height#,0); |
| 216 |
0.5[x_height#,body_height#],0); |
| 217 |
"Wide bar accent 3"; |
| 218 |
pickup crisp.nib; |
| 219 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 220 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u; |
| 221 |
top y1r=top y2r=vround(h+0.5a); |
| 222 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 223 |
endchar; |
| 224 |
|
| 225 |
beginchar(bar_wwww,32u#+2appr#, |
| 226 |
%x_height#+body_height#-cap_height#,0); |
| 227 |
0.5[x_height#,body_height#],0); |
| 228 |
"Wide bar accent 4"; |
| 229 |
pickup crisp.nib; |
| 230 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 231 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u; |
| 232 |
top y1r=top y2r=vround(h+0.5a); |
| 233 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 234 |
endchar; |
| 235 |
|
| 236 |
beginchar(bar_wwwww,40u#+2appr#, |
| 237 |
%x_height#+body_height#-cap_height#,0); |
| 238 |
0.5[x_height#,body_height#],0); |
| 239 |
"Wide bar accent 5"; |
| 240 |
pickup crisp.nib; |
| 241 |
a:=vround 0.0[min(0.2[vair,stem],rth0),rth1]; |
| 242 |
pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u; |
| 243 |
top y1r=top y2r=vround(h+0.5a); |
| 244 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 245 |
endchar; |
| 246 |
|
| 247 |
arrow_stress := 0.52; |
| 248 |
arrow_tense1 := 0.75; |
| 249 |
arrow_tense2 := 0.875; |
| 250 |
|
| 251 |
beginchar(arrow_accent,7u#+2appr#,min(asc_height#,2x_height#),0); |
| 252 |
"Arrow accent"; |
| 253 |
pickup tiny.nib; |
| 254 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 255 |
arrow_height := hround 3.25u; |
| 256 |
arrow_breadth := rth; |
| 257 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 258 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 259 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 260 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 261 |
endchar; |
| 262 |
|
| 263 |
beginchar(arrow_w,8u#+2appr#,0.5[asc_height#,body_height#],0); |
| 264 |
"Wide arrow accent 1"; |
| 265 |
pickup tiny.nib; |
| 266 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 267 |
arrow_height := hround 3.3u; |
| 268 |
arrow_breadth := rth; |
| 269 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 270 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 271 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 272 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 273 |
endchar; |
| 274 |
|
| 275 |
beginchar(arrow_ww,16u#+2appr#,body_height#,0); |
| 276 |
"Wide arrow accent 2"; |
| 277 |
pickup tiny.nib; |
| 278 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 279 |
arrow_height := hround 3.35u; |
| 280 |
arrow_breadth := rth; |
| 281 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 282 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 283 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 284 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 285 |
endchar; |
| 286 |
|
| 287 |
beginchar(arrow_www,24u#+2appr#,body_height#,0); |
| 288 |
"Wide arrow accent 3"; |
| 289 |
pickup tiny.nib; |
| 290 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 291 |
arrow_height := hround 3.4u; |
| 292 |
arrow_breadth := rth; |
| 293 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 294 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 295 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 296 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 297 |
endchar; |
| 298 |
|
| 299 |
beginchar(arrow_wwww,32u#+2appr#,body_height#,0); |
| 300 |
"Wide arrow accent 4"; |
| 301 |
pickup tiny.nib; |
| 302 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 303 |
arrow_height := hround 3.45u; |
| 304 |
arrow_breadth := rth; |
| 305 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 306 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 307 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 308 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 309 |
endchar; |
| 310 |
|
| 311 |
beginchar(arrow_wwwww,40u#+2appr#,body_height#,0); |
| 312 |
"Wide arrow accent 5"; |
| 313 |
pickup tiny.nib; |
| 314 |
arrow_width := 2ceiling 0.3(h-x_height)+rth; |
| 315 |
arrow_height := hround 3.5u; |
| 316 |
arrow_breadth := rth; |
| 317 |
y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth; |
| 318 |
lft x2=w-rt x3=appr-hround 0.5u; |
| 319 |
arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l; |
| 320 |
filldraw stroke z1e..z2e; penlabels(1,2); |
| 321 |
endchar; |
| 322 |
|
| 323 |
def tmp_program(expr orientation,overshot,approach,coef)= |
| 324 |
pickup tiny.nib; |
| 325 |
a:=vround 0.5[vair,stem]; pos2(a,90); |
| 326 |
y2+0.5a=vround(h+0.5a+overshot); y1r=y3r=good.y 1/3[x_height,h]; |
| 327 |
lft x1r=w-rt x3r=hround approach; x2=0.5[x1r,x3r]; |
| 328 |
z1'-z1r=(z2r-z1r) xscaled 1/3; |
| 329 |
z3'-z3r=(z2r-z3r) xscaled 1/3; |
| 330 |
pos1(hair,angle(z1'-z1r)+90); |
| 331 |
pos3(hair,angle(z3'-z3r)-90); |
| 332 |
filldraw stroke z1e{z1'-z1r}...z2e{right}...z3e{z3r-z3'}; |
| 333 |
penlabels(1,2,3); labels(1',3'); |
| 334 |
enddef; |
| 335 |
|
| 336 |
beginchar(paren_accent,7u#+2appr#,0.5[x_height#,asc_height#],0); |
| 337 |
"Parenthesis accent"; |
| 338 |
tmp_program(up,0,appr+0.25u,0); |
| 339 |
endchar; |
| 340 |
|
| 341 |
beginchar(paren_w,8u#+2appr#,0.5[x_height#,body_height#],0); |
| 342 |
"Wide parenthesis accent 1"; |
| 343 |
tmp_program(up,o,appr,0.2); |
| 344 |
endchar; |
| 345 |
|
| 346 |
beginchar(paren_ww,16u#+2appr#,0.5[x_height#,body_height#],0); |
| 347 |
"Wide parenthesis accent 2"; |
| 348 |
tmp_program(up,o,appr-0.25u,0.4); |
| 349 |
endchar; |
| 350 |
|
| 351 |
beginchar(paren_www,24u#+2appr#,0.5[x_height#,body_height#],0); |
| 352 |
"Wide parenthesis accent 3"; |
| 353 |
tmp_program(up,o,appr-0.5u,0.6); |
| 354 |
endchar; |
| 355 |
|
| 356 |
beginchar(paren_wwww,32u#+2appr#,0.5[x_height#,body_height#],0); |
| 357 |
"Wide parenthesis accent 4"; |
| 358 |
tmp_program(up,o,appr-0.5u,0.8); |
| 359 |
endchar; |
| 360 |
|
| 361 |
beginchar(paren_wwwww,40u#+2appr#,0.5[x_height#,body_height#],0); |
| 362 |
"Wide parenthesis accent 5"; |
| 363 |
tmp_program(up,o,appr-0.5u,1); |
| 364 |
endchar; |
| 365 |
|
| 366 |
standard_proofing;% restore extra_endchar. |
| 367 |
|