summaryrefslogtreecommitdiff
path: root/fonts/mathabx/source/mathacnt.mf
blob: 6a524b899d5f52dae40861e1fd6310f5db04f572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
% mathematical symbols by Anthony Phan.
% file: mathacnt.mf (accents)
% last modification: May 16, 2005.
% Only known charcodes will be generated.

def horizontal_rules_list=math_axis,
  -body_depth,-desc_depth,x_height,cap_height,asc_height,body_height
enddef;

% ACCENTS (nullissime)

diacritics_proofing;% changes extra_endchar for proof mode.
hat_w:=hex"70";
check_w:=hex"71";
tilde_w:=hex"72";
bar_w:=hex"73";
arrow_w:=hex"74";
paren_w:=hex"75";

hat_ww:=hex"78"; hat_www:=hex"79";
hat_wwww:=hex"7A"; hat_wwwww:=hex"7B";
check_ww:=hex"7C"; check_www:=hex"7D";
check_wwww:=hex"7E"; check_wwwww:=hex"7F";
tilde_ww:=hex"80"; tilde_www:=hex"81";
tilde_wwww:=hex"82"; tilde_wwwww:=hex"83";
bar_ww:=hex"84"; bar_www:=hex"85";
bar_wwww:=hex"86"; bar_wwwww:=hex"87";
arrow_ww:=hex"88"; arrow_www:=hex"89";
arrow_wwww:=hex"8A"; arrow_wwwww:=hex"8B";
paren_ww:=hex"8C"; paren_www:=hex"8D";
paren_wwww:=hex"8E"; paren_wwwww:=hex"8F";

charlist hat_w: hat_ww: hat_www: hat_wwww: hat_wwwww;
charlist check_w: check_ww: check_www: check_wwww: check_wwwww;
charlist tilde_w: tilde_ww: tilde_www: tilde_wwww: tilde_wwwww;
charlist bar_w: bar_ww: bar_www: bar_wwww: bar_wwwww;
charlist arrow_w: arrow_ww: arrow_www: arrow_wwww: arrow_wwwww;
charlist paren_w: paren_ww: paren_www: paren_wwww: paren_wwwww;

vardef tmp_program(expr orientation,overshot,appr,coef)=
  save a,b,c;
  pickup crisp.nib;
  b=coef[0.8[vair,stem],stem];
  b'=coef[min(vair,hair),max(vair,hair)];
  if orientation=up:
    top y2r=top y3r=h+overshot;
    bot y1r=bot y4r=vround 0.5[x_height,h];
  else:
    bot y2r=bot y3r=vround 0.5[x_height,h]-overshot;
    top y1r=top y4r=h; fi
  lft x2r=hround 0.5(w-b);
  rt x3r-lft x2r=hround b;
  lft x1r=appr; x4r-x3r=x2r-x1r;
  x=0.5(b-b')/length(z2r-z1r);
  a=if orientation=up: 180+ fi (angle(z2r-z1r)-angle(x,1+-+x));
  pos1(b',a); pos2(b,a); pos3(b,180-a); pos4(b',180-a);
  z0=whatever[z1l,z2l]; z0=whatever[z3l,z4l];
  filldraw z1r--z2r--z3r--z4r--z4l--z0--z1l--cycle;
  penlabels(0,1,2,3,4)
enddef;

use_rule1;

beginchar(hat_accent,7u#+2appr#,min(asc_height#,2x_height#),0);
  "Circumflex accent";
  tmp_program(up,0,appr+u,0);
endchar;

beginchar(hat_w,8u#+2appr#,0.5[asc_height#,body_height#],0);
  "Wide circumflex accent 1";
  tmp_program(up,o,appr-0.5u,0.2);
endchar;

beginchar(hat_ww,16u#+2appr#,body_height#,0);
  "Wide circumflex accent 2";
  tmp_program(up,o,appr-0.5u,0.4);
endchar;

beginchar(hat_www,24u#+2appr#,body_height#,0);
  "Wide circumflex accent 3";
  tmp_program(up,o,appr-0.5u,0.6);
endchar;

beginchar(hat_wwww,32u#+2appr#,body_height#,0);
  "Wide circumflex accent 4";
  tmp_program(up,o,appr-0.5u,0.8);
endchar;

beginchar(hat_wwwww,40u#+2appr#,body_height#,0);
  "Wide circumflex accent 5";
  tmp_program(up,o,appr-0.5u,1);
endchar;

beginchar(check_accent,7u#+2appr#,min(asc_height#,2x_height#),0);
  "Check accent";
  tmp_program(down,0,appr-0.5u,0);
endchar;

beginchar(check_w,8u#+2appr#,0.5[asc_height#,body_height#],0);
  "Wide check accent 1";
  tmp_program(down,o,appr-0.5u,0.2);
endchar;

beginchar(check_ww,16u#+2appr#,body_height#,0);
  "Wide check accent 2";
  tmp_program(down,o,appr-0.5u,0.4);
endchar;

beginchar(check_www,24u#+2appr#,body_height#,0);
  "Wide check accent 3";
  tmp_program(down,o,appr-0.5u,0.6);
endchar;

beginchar(check_wwww,32u#+2appr#,body_height#,0);
  "Wide check accent 4";
  tmp_program(down,o,appr-0.5u,0.8);
endchar;

beginchar(check_wwwww,40u#+2appr#,body_height#,0);
  "Wide check accent 5";
  tmp_program(down,o,appr-0.5u,1);
endchar;

vardef tmp_program(expr height,depth,approach,coef)=
  pickup tiny.nib;
  save a,b,c;
  a=angle(w-2approach,9(height-depth));
  b=angle(w-2approach,-3(height-depth));
  b'=coef[0.5[vair,hair],max(vair,hair)];
  c=coef[0.8[vair,stem],stem];
  pos1(b',a+90); pos9(b',a+90); pos5(c,b+90);
  bot y7l=depth-eps; top y3r=height+eps;
  y1l=good.y 1/6[y7l,y3r]; y3r-y9r=y1l-y7l;
  top y3r-bot y3l=top y7r-bot y7l=vround 0.5[b',c];
  lft x1r=w-rt x9l=approach;
  z5=0.5[z1,z9];
  forsuffixes $=r,l: y2$=y3$=y4$; y6$=y7$=y8$;
    z2$-z1$=whatever*dir a; z8$-z9$=whatever*dir a;
    z4$-z5$=whatever*dir b; z6$-z5$=whatever*dir b;
    x3$=0.666[x2$,x4$]; x7$=0.666[x8$,x6$];
  endfor
  filldraw stroke z1e..controls .666[z1e,z2e] and .666[z3e,z2e]
  ..z3e..controls .666[z3e,z4e] and .666[z5e,z4e]
  ..z5e..controls .666[z5e,z6e] and .666[z7e,z6e]
  ..z7e..controls .666[z7e,z8e] and .666[z9e,z8e]..z9e;
%penlabels(1,2,3,4,5,6,7,8,9);
enddef;

beginchar(tilde_accent,7u#+2appr#,min(asc_height#,2x_height#),0);
  "Tilde accent";
  tmp_program(h,vround 0.5[x_height,asc_height],appr,0);
endchar;

beginchar(tilde_w,8u#+2appr#,0.5[asc_height#,body_height#],0);
  "Wide tilde accent 1";
  tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.2);
endchar;

beginchar(tilde_ww,16u#+2appr#,body_height#,0);
  "Wide tilde accent 2";
  tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.4);
endchar;

beginchar(tilde_www,24u#+2appr#,body_height#,0);
  "Wide tilde accent 3";
  tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.6);
endchar;

beginchar(tilde_wwww,32u#+2appr#,body_height#,0);
  "Wide tilde accent 4";
  tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,0.8);
endchar;

beginchar(tilde_wwwww,40u#+2appr#,body_height#,0);
  "Wide tilde accent 5";
  tmp_program(h,vround 0.5[x_height,asc_height],appr-0.5u,1);
endchar;

% changes august 23, 2004.

beginchar(bar_accent,7u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,asc_height#],0);
  "Bar accent";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.25u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(bar_w,8u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,body_height#],0);
  "Wide bar accent 1";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(bar_ww,16u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,body_height#],0);
  "Wide bar accent 2";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(bar_www,24u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,body_height#],0);
  "Wide bar accent 3";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(bar_wwww,32u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,body_height#],0);
  "Wide bar accent 4";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(bar_wwwww,40u#+2appr#,
    %x_height#+body_height#-cap_height#,0);
    0.5[x_height#,body_height#],0);
  "Wide bar accent 5";
  pickup crisp.nib;
  a:=vround 0.0[min(0.2[vair,stem],rth0),rth1];
  pos1(a,90); pos2(a,90); lft x1-appr=w-appr-rt x2=hround 0.0u;
  top y1r=top y2r=vround(h+0.5a);
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

arrow_stress  := 0.52;
arrow_tense1  := 0.75;
arrow_tense2  := 0.875;

beginchar(arrow_accent,7u#+2appr#,min(asc_height#,2x_height#),0);
  "Arrow accent";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.25u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(arrow_w,8u#+2appr#,0.5[asc_height#,body_height#],0);
  "Wide arrow accent 1";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.3u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(arrow_ww,16u#+2appr#,body_height#,0);
  "Wide arrow accent 2";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.35u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(arrow_www,24u#+2appr#,body_height#,0);
  "Wide arrow accent 3";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.4u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(arrow_wwww,32u#+2appr#,body_height#,0);
  "Wide arrow accent 4";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.45u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

beginchar(arrow_wwwww,40u#+2appr#,body_height#,0);
  "Wide arrow accent 5";
  pickup tiny.nib;
  arrow_width   := 2ceiling 0.3(h-x_height)+rth;
  arrow_height  := hround 3.5u;
  arrow_breadth := rth;
  y2=y3=vround(0.7[x_height,h]-0.5rth)+0.5rth;
  lft x2=w-rt x3=appr-hround 0.5u;
  arrow_head1(z2..z3,both); x2r=x2l=x2; y1r=y2r; y1l=y2l;
  filldraw stroke z1e..z2e; penlabels(1,2);
endchar;

def tmp_program(expr orientation,overshot,approach,coef)=
  pickup tiny.nib;
  a:=vround 0.5[vair,stem]; pos2(a,90);
  y2+0.5a=vround(h+0.5a+overshot); y1r=y3r=good.y 1/3[x_height,h];
  lft x1r=w-rt x3r=hround approach; x2=0.5[x1r,x3r];
  z1'-z1r=(z2r-z1r) xscaled 1/3;
  z3'-z3r=(z2r-z3r) xscaled 1/3;
  pos1(hair,angle(z1'-z1r)+90);
  pos3(hair,angle(z3'-z3r)-90);
  filldraw stroke z1e{z1'-z1r}...z2e{right}...z3e{z3r-z3'};
  penlabels(1,2,3); labels(1',3');
enddef;

beginchar(paren_accent,7u#+2appr#,0.5[x_height#,asc_height#],0);
  "Parenthesis accent";
  tmp_program(up,0,appr+0.25u,0);
endchar;

beginchar(paren_w,8u#+2appr#,0.5[x_height#,body_height#],0);
  "Wide parenthesis accent 1";
  tmp_program(up,o,appr,0.2);
endchar;

beginchar(paren_ww,16u#+2appr#,0.5[x_height#,body_height#],0);
  "Wide parenthesis accent 2";
  tmp_program(up,o,appr-0.25u,0.4);
endchar;

beginchar(paren_www,24u#+2appr#,0.5[x_height#,body_height#],0);
  "Wide parenthesis accent 3";
  tmp_program(up,o,appr-0.5u,0.6);
endchar;

beginchar(paren_wwww,32u#+2appr#,0.5[x_height#,body_height#],0);
  "Wide parenthesis accent 4";
  tmp_program(up,o,appr-0.5u,0.8);
endchar;

beginchar(paren_wwwww,40u#+2appr#,0.5[x_height#,body_height#],0);
  "Wide parenthesis accent 5";
  tmp_program(up,o,appr-0.5u,1);
endchar;

standard_proofing;% restore extra_endchar.