summaryrefslogtreecommitdiff
path: root/macros/mtex/metafont/beam16.mf
blob: 03239d178492893aa3cffb4488a79e04dcb6a447 (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
input musicdef
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                             %
%                   BALKEN                                    %
%                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



font_x_height beamht#;

def drawbeams (expr st, jj) =
    save i, length, height;
    numeric i, length, height;
    length:= 0.5;
    for i=0 upto 7:
        height := length*st + beamht#;
        beginchar(jj*8+i, length, height, 0);
           clear;
         % x2 = w; x1 = 0;
           z2r = (w,h);
           z1l = origin;
           penpos1(beamht,90);
           penpos2(beamht,90);
           penstroke z1e---z2e;
         endchar;
         length :=  2*length;
    endfor;
enddef;

def drawbeamsneg (expr st, jj) =
    save i, length, depth;
    numeric i, length, depth;
    length:= 0.5;
    for i=0 upto 7:
        depth := length*st - beamht#;
        beginchar(jj*8+i, length, 0, depth);
           clear;
           z2l = (w,d);
           z1r = origin;
           penpos1(beamht,90);
           penpos2(beamht,90);
           penstroke z1e---z2e;
         endchar;
         length :=  2*length;
    endfor;
enddef;

numeric ss[];

ss[0]:=0.05;
ss[1]:=0.10;
ss[2]:=0.15;
ss[3]:=0.20;
ss[4]:=0.25;
ss[5]:=0.30;
ss[6]:=0.35;
ss[7]:=0.45;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Balken mit positiver Steigung %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for j=0 upto 7 :
drawbeams(ss[j],j);
endfor;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Balken mit negativer Steigung %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for j=0 upto 7 :
drawbeamsneg(-ss[j],j+8);
endfor;

end;