lilypond-0.1.27
[lilypond.git] / mf / feta-sleur.mf
blob1eba2a6ce441e32a265cd1739bd49c0baa641c2b
1 % feta-sleur.mf
3 mode_setup;
4 thin:=.2pt;
5 thick:=5thin;
6 bow:=.2;
8 def sign(expr a) =
9         ((abs(a))/(a))
10         enddef;
12 def draw_slur(expr a,b,d) =
13         beginchar(0,0,0,0) "Embedded mf";
14                 % huh, factor 8?
15                 z1=8a;
16                 z3=8b;
17                 save alpha; alpha=angle(z3-z1);
18                 z2=(1/2[x1,x3],1/2[y1,y3])+d*bow*(x3-x1)*dir(alpha+90);
19                 save beta; beta=d*sign(y3-y1)*1.5angle(z2-z1)-alpha;
20 %               message "d: "&decimal d;
21 %               message "dy: "& decimal sign(y3-y1);
22 %               message "alpha: "&decimal alpha;
23 %               message "beta: "&decimal beta;
24                 penpos1(thin,alpha+beta+90);
25                 penpos2(thick,alpha+90);
26                 penpos3(thin,alpha-beta+90);
27                 pickup pencircle;
28                 fill z1l{dir(alpha+beta)}..z2l{dir(alpha)}..z3l{dir(alpha-beta)}
29                         ..z3r{dir(180+alpha-beta)}..z2r{dir(180+alpha)}..z1r{dir(180+alpha+beta)}
30                         ..cycle;
31                 penlabels(1,2,3);
32                 endchar;
33         enddef;