summaryrefslogtreecommitdiff
path: root/fonts/mathabx/source/mathmbcb.mf
blob: f08a8eba68e2ae57fd94069d9a2ac4039c6797a5 (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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
% mathematical symbols by Anthony Phan.
% file: mathmbcb.mf (symbols medium or big in circles or boxes)
% last modification: May 16, 2005.
% Only known charcodes will be generated.

def horizontal_rules_list=
  0.5[-d,h]-math_axis,0.5[-d,h]-math_axis+x_height,
  0.25[-d,h],0.5[-d,h],0.75[-d,h] enddef;

extra_beginchar_save:=extra_beginchar;
numeric display_over_text;

% Beware: one can not execute conditionnal commands
% thru the following construction. For instance,
% on_size(use_rule1,use_rule2,use_rule3) would
% lead to the use of rule3.

def on_size(expr $,$$,$$$)=
  if substring (0,1) of main_name_string="m": $
  elseif substring (0,1) of main_name_string="b": $$
  else: $$$ fi% "B" case or else
enddef;

if substring (0,1) of main_name_string="m":
  let tmp_bounds=arithmetic_bounds;
  def tmp_radius=6.75u enddef;
  use_rule1;
elseif substring (0,1) of main_name_string="b":
  def tmp_bounds=10/6dh#+2appr#,0,10/6dh# enddef;
  % def tmp_bounds=18u#+2appr#,0,10/6dh# enddef;
  def tmp_radius=0.5(h+d) enddef;
  use_rule2;
else:% "B" case or else
  def tmp_bounds= 1.20*10/6dh#+2appr#,
    0,1.20*10/6dh# enddef;
  %  def tmp_bounds= 25.2u#+2appr#,0,14/6dh# enddef;
  def tmp_radius=0.5(h+d) enddef;
  use_rule3;
fi

numeric tmp_dtsz;
a:=on_size(max(0.82u,1.25u-rth1),1.33u,1.20*1.33u);
tmp_dtsz=on_size(dtsz,1.2dtsz,1.20*1.2dtsz);
tmp_string:=on_size("Medium ","Textstyle ","Displaystyle ")
& substring (1,infinity) of main_name_string;
extra_beginchar:=extra_beginchar & on_size("","","padded bigop_padding#;");

% I know what anyone will think while reading this file:
% ``this guy had totally messed up with boundaries''.
% Believe me, I had not.

% The next programs put a circle or a box exactly around the point
% z0. So that z0 must be adjusted with respect to the pen 
% with which the circle will be drawn.

if substring (1,infinity) of main_name_string="circle":
  vardef tmp_program=
    autorounded; pickup rule.nib;
    x0=good.x 0.5w; y0=good.y 0.5[-d,h];
    for i=1 upto 8:
      z[i]=z0+round(tmp_radius-0.5rth)*right rotated(45*(i-1));
    endfor; labels(0,1,2,3,4,5,6,7,8);
    tmp_path:=z1{up}...z2{z3-z1}
    ...z3{left}...z4{z5-z3}...z5{down}...z6{z7-z5}
    ...z7{right}...z8{z1-z7}...cycle; draw tmp_path;
  enddef;
  def dot_spread=4*tmp_radius/(3*3.14159) enddef;
 % average point of some half disc
  def prepare_triangle(expr orientation)=
    save b,c; pickup tiny.nib;
    b=min(on_size(7u,12u,1.20*12u),
      2*sqrt(3)*(tmp_radius-rth-a));
    c=on_size(rth0,rth1,rth2);
    tmp_boolean:=true
  enddef;
else:
  vardef tmp_program=
    pickup rule.nib;
    x0=good.x 0.5w; y0=good.y 0.5[-d,h];
    pickup tiny.nib;
    for i=1 step 2 until 7:
      z[i]=z0+round(tmp_radius-0.5rth)*right rotated(45*(i-1));
    endfor;
    pos1(rth,0); pos5(rth,180);
    pos3(rth,90); pos7(rth,-90);
    forsuffixes $=,r,l:
      x1$=x2$=x8$; x5$=x4$=x6$;
      y2$=y3$=y4$; y6$=y7$=y8$;
    endfor
    penlabels(0,1,2,3,4,5,6,7,8);
    filldraw stroke z8e--z6e--z4e--z2e--z8e;
    tmp_path:=z1--z2--z3--z4--z5--z6--z7--z8--cycle;
    pickup rule.nib;
  enddef;
  def dot_spread=0.5(y3-y0) enddef;
  def prepare_triangle(expr orientation)=
    save b,c; pickup tiny.nib;
    b=min(on_size(7u,12u,1.20*12u),
      2*sqrt(3)*(tmp_radius-rth-a));
    c=on_size(rth0,rth1,rth2);
    tmp_boolean:=false;
    save triangle_foot;
    triangle_foot=
    if (orientation=up)or(orientation=down): y0 else: x0 fi
    if (orientation=up)or(orientation=right): - else: + fi
    0.5[1/3,1/2]*0.5b*sqrt 3
  enddef;
fi

%
% Let's go
%

beginchar(main_name_with(_plus),tmp_bounds);
  tmp_string & " plus";
  tmp_program;
  pickup tiny.nib;
  top y9=vround(y3-0.5rth-a); y3-y9=y10-y7; y11=y12=y0;
  rt x12=hround(x1-0.5rth-a); x1-x12=x11-x5; x9=x10=x0;
  pos9(rth,0); pos10(rth,0); pos11(rth,90); pos12(rth,90);
  filldraw stroke z9e..z10e; filldraw stroke z11e..z12e;
  penlabels(9,10,11,12);
endchar;

beginchar(main_name_with(_minus),tmp_bounds);
  tmp_string & " minus";
  tmp_program;
  pickup tiny.nib;
  rt x9=hround(x1-0.5rth-a);
  x10-x5=x1-x9; y9=y10=y0; pos9(rth,90); pos10(rth,90);
  filldraw stroke z10e..z9e; penlabels(9,10,11,12);
endchar;

beginchar(main_name_with(_times),tmp_bounds);
  tmp_string & " times";
  tmp_program;
  pickup tiny.nib;
  rt x0'=hround(x1-0.5rth-a); y0=y0';
  z9-z0=z0-z10=(z0'-z0) rotated 45; z11-z0=z0-z12=(z0'-z0) rotated -45;
  pos9(rth+2eps,-45); pos10(rth+2eps,-45);
  pos11(rth+2eps,45); pos12(rth+2eps,45);
  filldraw stroke z9e..z10e; filldraw stroke z12e..z11e;
  penlabels(9,10,11,12);
endchar;

beginchar(main_name_with(_division),tmp_bounds);
  tmp_string & " division";
  tmp_program;
  pickup tiny.nib;
  rt x9=hround(x1-0.5rth-a); x10-x5=x1-x9;
  y9=y10=y0; pos9(rth,90); pos10(rth,90);
  filldraw stroke z10e..z9e; penlabels(9,10);
  pickup null.nib;
  adjust_dot11((x0,y0+dot_spread),tmp_dtsz,true,false); dot(11,11');
  adjust_dot12((x0,y0-dot_spread),tmp_dtsz,true,false); dot(12,12');
endchar;

beginchar(main_name_with(_dot),tmp_bounds);
  tmp_string & " dot";
  tmp_program;
  pickup null.nib;
  adjust_dot9(z0,1.3tmp_dtsz,true,true); dot(9,9');
endchar;

beginchar(main_name_with(_circle),tmp_bounds);
  tmp_string & " circle";
  tmp_program;
  numeric b;
  b=min(max(on_size(7u,7u,1.20*7u),tmp_dtsz),tmp_radius-rth-a);
  pickup rule.nib0; adjust_dot9((x0,y0),b,true,true);
  full_dot:=false; dot(9,9');
endchar;

% the asterisk is the same in textstyle and displaystyle

beginchar(main_name_with(_asterisk),tmp_bounds);
  tmp_string & " asterisk";
  tmp_program;
  autorounded;
  interim stress:=0.5;
  pickup null.nib;
  numeric b,c,dag_stem,dag_curve;
  dag_curve=on_size(ast_curve,round 1.1cap_curve,round 1.1cap_curve);
  dag_stem=on_size(ast_stem,hair,hair);
  b=on_size(1.8ast_stem,2.6hair,2.6hair);
  c=on_size(1.4dag_stem,0.625b,0.625b);
  spread:=min(on_size(ast_size,12u,12u),2(tmp_radius-rth-a));
  for $=9 upto 14: z[$]=b*dir(($-9)*60+30)+z0;
    z[$]'=c*dir(($-9)*60+60)+z0; endfor
  filldraw for $=9 upto 14: dagger_stroke[$](round(0.5spread-b)+eps,
      dag_curve,dag_stem,dir(($-9)*60+30))...z[$]'...endfor cycle;
endchar;

% the asterisk is the same in textstyle and displaystyle

beginchar(main_name_with(_co_asterisk),tmp_bounds);
  tmp_string & " co-asterisk";
  tmp_program;
  autorounded;
  interim stress:=0.5;
  pickup null.nib;
  numeric b,c,dag_stem,dag_curve;
  dag_curve=on_size(ast_curve,round 1.1cap_curve,round 1.1cap_curve);
  dag_stem=on_size(ast_stem,hair,hair);
  b=1.8dag_stem; c=1.4dag_stem;
  spread:=min(on_size(ast_size,12u,12u),2(tmp_radius-rth-a));
  for $=9 upto 14: z[$]=b*dir(($-9)*60)+z0;
    z[$]'=c*dir(($-9)*60+30)+z0; endfor
  filldraw for $=9 upto 14: dagger_stroke[$](round(0.5spread-b)+eps,
      dag_curve,dag_stem,dir(($-9)*60))...z[$]'...endfor cycle;
endchar;

beginchar(main_name_with(_left),tmp_bounds);
  tmp_string & " left";
  tmp_program;
  draw z3..z7; draw z0..z5;
endchar;

beginchar(main_name_with(_right),tmp_bounds);
  tmp_string & " right";
  tmp_program;
  draw z3..z7; draw z0..z1;
endchar;

beginchar(main_name_with(_top),tmp_bounds);
  tmp_string & " top";
  tmp_program;
  draw z1..z5; draw z0..z7;
endchar;

beginchar(main_name_with(_bot),tmp_bounds);
  tmp_string & " bot";
  tmp_program;
  draw z1..z5; draw z0..z3;
endchar;

beginchar(main_name_with(_slash),tmp_bounds);
  tmp_string & " slash";
  tmp_program;
  draw z2..z6;
endchar;

beginchar(main_name_with(_backslash),tmp_bounds);
  tmp_string & " backslash";
  tmp_program;
  draw z4..z8;
endchar;

beginchar(main_name_with(_sign),tmp_bounds);
  tmp_string & " sign";
  tmp_program;
endchar;

beginchar(main_name_with(_triangle_up),tmp_bounds);
  tmp_string & " triangle up";
  tmp_program;
  begingroup save math_axis; math_axis=y0;
    prepare_triangle(up);
    set_triangle'(up,b,c,tmp_boolean,false);
    filldraw stroke z1'e--z2'e--z3'e--z1'e;
  endgroup;
endchar;

% UNSUPPORTED

beginchar(main_name_with(_truc),tmp_bounds);
  tmp_string & " truc";
  tmp_program;
  x9=x0; y9=good.y
  if substring (1,infinity) of main_name_string="circle":
    0.632466 else: 2/3 fi [top y7,bot y3];
  z10=tmp_path intersectionpoint (z9..(x5,y9));
  z11=tmp_path intersectionpoint (z9..(x1,y9));
  draw z7..z9; draw z10..z11; labels(9,10,11);
endchar;

% numerics are such that all the three parts
% have almost the same area. (look at the circle's case)

beginchar(main_name_with(_curt),tmp_bounds);
  tmp_string & " curt";
  tmp_program;
  x9=x0; y9=good.y
  if substring (1,infinity) of main_name_string="circle":
    0.632466 else: 2/3 fi [bot y3,top y7];
  z10=tmp_path intersectionpoint (z9..(x5,y9));
  z11=tmp_path intersectionpoint (z9..(x1,y9));
  draw z3..z9; draw z10..z11; labels(9,10,11);
endchar;

% hummm, too big
beginchar(main_name_with(_full_circle),tmp_bounds);
  tmp_string & " full circle";
  tmp_program;
  numeric b;
  b=min(max(on_size(7u-rth0,7u-rth0,1.20*7u-rth0),
      tmp_dtsz),tmp_radius-rth-a);
  pickup rule.nib0; adjust_dot9((x0,y0),b,true,true);
  dot(9,9');
endchar;

% the star is the same in textstyle and displaystyle

beginchar(main_name_with(_five_star),tmp_bounds);
  tmp_string & " five star";
  tmp_program;
  pickup tiny.nib;
  save b,tense;
  b=on_size(3.5u+o,6u+o,6u+o);
  tense=on_size(0.2,0.1,0.1); 
  draw_star.a(z0,5,b,tense,90,false);
  labels(a);
endchar;

% the star is the same in textstyle and displaystyle

beginchar(main_name_with(_six_star),tmp_bounds);
  tmp_string & " six star";
  tmp_program;
  pickup tiny.nib;
  save b,tense;
  b=on_size(3.5u,6u+o,6u+o);
  tense=on_size(0.4,0.3,0.3); 
  draw_star.a(z0,6,b,tense,90,false);
  labels(a);
endchar;

beginchar(main_name_with(_triangle_down),tmp_bounds);
  tmp_string & " triangle down";
  tmp_program;
  begingroup save math_axis; math_axis=y0;
    prepare_triangle(down);
    set_triangle'(down,b,c,tmp_boolean,false);
    filldraw stroke z1'e--z2'e--z3'e--z1'e;
  endgroup;
endchar;

beginchar(main_name_with(_triangle_left),tmp_bounds);
  tmp_string & " triangle left";
  tmp_program;
  begingroup save math_axis; math_axis=y0;
    prepare_triangle(left);
    set_triangle'(left,b,c,tmp_boolean,false);
    filldraw stroke z1'e--z2'e--z3'e--z1'e;
  endgroup;
endchar;

beginchar(main_name_with(_triangle_right),tmp_bounds);
  tmp_string & " triangle right";
  tmp_program;
  begingroup save math_axis; math_axis=y0;
    prepare_triangle(right);
    set_triangle'(right,b,c,tmp_boolean,false);
    filldraw stroke z1'e--z2'e--z3'e--z1'e;
  endgroup;
endchar;

beginchar(main_name_with(_top_dot_minus),tmp_bounds);
  tmp_string & " top dot minus";
  tmp_program; pickup tiny.nib;
  rt x9=hround(x1-0.5rth-a); x10-x5=x1-x9;
  y9=y10=y0; pos9(rth,90); pos10(rth,90);
  filldraw stroke z10e..z9e; penlabels(9,10);
  pickup null.nib;
  adjust_dot11((x0,y0+dot_spread),tmp_dtsz,true,false); dot(11,11');
endchar;

beginchar(main_name_with(_bot_dot_minus),tmp_bounds);
  tmp_string & " bot dot minus";
  tmp_program;
  pickup tiny.nib;
  rt x9=hround(x1-0.5rth-a); x10-x5=x1-x9;
  y9=y10=y0; pos9(rth,90); pos10(rth,90);
  filldraw stroke z10e..z9e; penlabels(9,10);
  pickup null.nib;
  adjust_dot11((x0,y0-dot_spread),tmp_dtsz,true,false); dot(11,11');
endchar;

beginchar(main_name_with(_horiz),tmp_bounds);
  tmp_string & " horizontal";
  tmp_program;
  draw z1..z5;
endchar;

beginchar(main_name_with(_vert),tmp_bounds);
  tmp_string & " vertical";
  tmp_program;
  draw z3..z7;
endchar;

beginchar(main_name_with(_cross),tmp_bounds);
  tmp_string & " cross";
  tmp_program;
  draw z1..z5; draw z3..z7;
endchar;

beginchar(main_name_with(_across),tmp_bounds);
  tmp_string & " across";
  tmp_program;
  draw z2..z6; draw z4..z8;
endchar;

beginchar(main_name_with(_wedge),tmp_bounds);
  tmp_string & " wedge";
  tmp_program;
  draw z8--z3--z6;
endchar;

beginchar(main_name_with(_vee),tmp_bounds);
  tmp_string & " vee";
  tmp_program;
  draw z2--z7--z4;
endchar;

beginchar(main_name_with(_black_left),tmp_bounds);
  tmp_string & " black left";
  tmp_program;
  fill subpath (2,6) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_right),tmp_bounds);
  tmp_string & " black right";
  tmp_program;
  fill subpath (6,8) of tmp_path
  & subpath (0,2) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_top),tmp_bounds);
  tmp_string & " black top";
  tmp_program;
  fill subpath (0,4) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_bot),tmp_bounds);
  tmp_string & " black bot";
  tmp_program;
  fill subpath (4,8) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_northwest),tmp_bounds);
  tmp_string & " black north-west";
  tmp_program;
  fill subpath (1,5) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_northeast),tmp_bounds);
  tmp_string & " black north-east";
  tmp_program;
  fill subpath (7,8) of tmp_path
  --subpath (0,3) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_southwest),tmp_bounds);
  tmp_string & " black south-west";
  tmp_program;
  fill subpath (3,7) of tmp_path--cycle;
endchar;

beginchar(main_name_with(_black_southeast),tmp_bounds);
  tmp_string & " black south-east";
  tmp_program;
  fill subpath (5,8) of tmp_path
  --subpath (0,1) of tmp_path--cycle;
endchar;

% There is no normalization for the next symbol as it seems...

beginchar(main_name_with(_ying_yang),tmp_bounds);
  tmp_string & " Ying-Yang";
  tmp_program;
  autorounded;
  y9=bot y3; y10=0.5[y9,y0]; y11=0.5[y0,y12]; y12=top y7;
  x0=x9=x12; x10=ceiling(x0+y0-y11); x10-x0=x0-x11;
  pickup null.nib;
  fill subpath (6,8) of tmp_path
  -- subpath (0,2) of tmp_path
  --z9 right_to_down z10 down_to_left
  z0 left_to_down z11 down_to_right z12
  --cycle;
  adjust_dot13((x0,y10),tmp_dtsz,true,true);
  adjust_dot14((x0,y11),tmp_dtsz,true,true);
  dot(13,13'); unfill dot_path(14,14');
  labels(9,10,11,12,14,14');
endchar;

beginchar(main_name_with(_peace_and_love),tmp_bounds);
  tmp_string & " peace and love";
  tmp_program;
  z9=tmp_path intersectionpoint (z0..(z0+2(tmp_radius)*dir 210));
  z10=tmp_path intersectionpoint (z0..(z0+2(tmp_radius)*dir 330));
  draw z3..z7; draw z0..z9; draw z0..z10;
  labels(9,10);
endchar;

% numerics are such that all the three parts
% have almost the same area. (look at the circle's case)

extra_beginchar:=extra_beginchar_save;