| 1 |
% mathematical symbols by Anthony Phan. |
| 2 |
% file: mathgrey.mf (grey symbols) |
| 3 |
% last modification: May 16, 2005. |
| 4 |
|
| 5 |
def horizontal_rules_list= |
| 6 |
0.5[-d,h]-math_axis,0.5[-d,h]-math_axis+x_height, |
| 7 |
0.25[-d,h],0.5[-d,h],0.75[-d,h] enddef; |
| 8 |
|
| 9 |
% basic pieces and parameters |
| 10 |
|
| 11 |
grey_ppi=1200;% maximum resolution |
| 12 |
grey_sc:=round max(1,pixels_per_inch/grey_ppi); |
| 13 |
grey_ht:=4grey_sc; grey_wd:=4grey_sc; |
| 14 |
picture grey.light,grey.medium,grey.dark; |
| 15 |
grey.light=nullpicture; |
| 16 |
grey.medium=nullpicture; |
| 17 |
grey.dark=nullpicture; |
| 18 |
for z=(0,2),(1,0),(2,3),(3,1): |
| 19 |
addto grey.light contour |
| 20 |
(unitsquare scaled grey_sc) shifted (z scaled grey_sc); |
| 21 |
endfor |
| 22 |
for z=(0,1),(0,3),(1,0),(1,2),(2,1),(2,3),(3,0),(3,2): |
| 23 |
addto grey.medium contour |
| 24 |
(unitsquare scaled grey_sc) shifted (z scaled grey_sc); |
| 25 |
endfor |
| 26 |
addto grey.dark contour |
| 27 |
(0,0)--(grey_wd,0)--(grey_wd,grey_ht)--(0,grey_ht)--cycle; |
| 28 |
for z=(0,2),(1,0),(2,3),(3,1): |
| 29 |
addto grey.dark contour |
| 30 |
(unitsquare scaled grey_sc) shifted (z scaled grey_sc) withweight -1; |
| 31 |
endfor |
| 32 |
|
| 33 |
% The whole bounding box is shaded (tmp_light not currentpicture). |
| 34 |
|
| 35 |
vardef grey_background@#(expr x_min,x_max,y_min,y_max)= |
| 36 |
for j=floor(y_min/grey_ht) upto ceiling(y_max/grey_ht): |
| 37 |
for i=floor(x_min/grey_wd) upto ceiling(x_max/grey_wd): |
| 38 |
addto tmp_picture also (grey.@# shifted (i*grey_wd,j*grey_ht)); |
| 39 |
endfor endfor |
| 40 |
enddef; |
| 41 |
|
| 42 |
% The path p must lies within the character bounding box. |
| 43 |
|
| 44 |
vardef grey_fill(expr p,x_min,x_max,y_min,y_max)(suffix @#)= |
| 45 |
tmp_picture:=nullpicture; |
| 46 |
grey_background@#(x_min,x_max,y_min,y_max); |
| 47 |
addto tmp_picture contour p; |
| 48 |
cull tmp_picture keeping (2,infinity); |
| 49 |
addto tmp_picture also currentpicture; |
| 50 |
currentpicture:=tmp_picture; |
| 51 |
enddef; |
| 52 |
|
| 53 |
def tmp_program(expr circle,radius)(suffix @#)= |
| 54 |
x0=good.x 0.5w; y0=good.y 0.5[-d,h]; |
| 55 |
if circle: |
| 56 |
for i=1 upto 8: |
| 57 |
z[i]=z0+round(radius-0.5rth)*right rotated(45*(i-1)); |
| 58 |
endfor; labels(0,1,2,3,4,5,6,7,8); |
| 59 |
tmp_path:=z1{up}...z2{z3-z1} |
| 60 |
...z3{left}...z4{z5-z3}...z5{down}...z6{z7-z5} |
| 61 |
...z7{right}...z8{z1-z7}...cycle; |
| 62 |
else: |
| 63 |
for i=1 step 2 until 7: |
| 64 |
z[i]=z0+round(6.75u-0.5rth)*right rotated(45*(i-1)); |
| 65 |
endfor; |
| 66 |
x1=x2=x8; x5=x4=x6; y2=y3=y4; y6=y7=y8; |
| 67 |
labels(0,1,2,3,4,5,6,7,8); |
| 68 |
tmp_path:=z1--z2--z3--z4--z5--z6--z7--z8--cycle; |
| 69 |
fi |
| 70 |
grey_fill(tmp_path,x5,x1,y7,y3,@#); |
| 71 |
enddef; |
| 72 |
|
| 73 |
beginchar(hex"DD",arithmetic_bounds); |
| 74 |
tmp_program(true,6.75u,light); |
| 75 |
endchar; |
| 76 |
|
| 77 |
beginchar(hex"FD",arithmetic_bounds); |
| 78 |
tmp_program(false,6.75u,light); |
| 79 |
endchar; |
| 80 |
|
| 81 |
beginchar(hex"DE",arithmetic_bounds); |
| 82 |
tmp_program(true,6.75u,medium); |
| 83 |
endchar; |
| 84 |
|
| 85 |
beginchar(hex"FE",arithmetic_bounds); |
| 86 |
tmp_program(false,6.75u,medium); |
| 87 |
endchar; |
| 88 |
|
| 89 |
beginchar(hex"DF",arithmetic_bounds); |
| 90 |
tmp_program(true,6.75u,dark); |
| 91 |
endchar; |
| 92 |
|
| 93 |
beginchar(hex"FF",arithmetic_bounds); |
| 94 |
tmp_program(false,6.75u,dark); |
| 95 |
endchar; |
| 96 |
|
| 97 |
|