lilypond-1.3.21
[lilypond.git] / mf / feta-sleur.mf
blob40a4e84885850a8657ad7b7d2978e0200688bec0
1
2 % feta-sleur.mf --  implement runtime MF slurs
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 1997, 1998 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@stack.nl>
8
9 % see Documentation/fonts.tex
11 % mode_setup;
13 %% staffsize#=16pt#;
14 % staff_space#:=staffsize#/4;
15 % stafflinethickness#:=0.1staff_space#;
17 pi:=3.14159;
19 def atan(expr x) = 
20         (angle(1,x)*pi/180)
21         enddef;
24 sleur_pen#:=stafflinethickness#;
25 slurheightlimit#:=staffsize#/2;
26 slurthick#:=1.8stafflinethickness#;
28 define_pixels(staffsize,staff_space,stafflinethickness);
29 define_pixels(sleur_pen,slurheightlimit,slurthick);
31 sluralpha:=2slurheightlimit#/pi;
32 slurratio:=1/3;
33 slurbeta:=pi*slurratio/2slurheightlimit#;
35 def draw_slur(expr dxs,dys,hs,d) =
36         save x, y;
37         save b, dx, dy, h, indent;
38         dx#:=dxs*1pt#;
39         dy#:=dys*1pt#;
40         h#:=hs*1pt#;
41         define_pixels(dx,dy);
42         b#:=length(dx#,dy#);
43         indent#:=sluralpha*atan(slurbeta*b#);
44         define_pixels(b,h,indent);
45         height:=(indent+h)*d;
46         z1=(0,0);
47         z2=(b,0);
48         z3=(indent,height);
49         z4=(b-indent,height);
50         z5=z4-(0,d*slurthick);
51         z6=z3-(0,d*slurthick);
52         path boogje;
53         boogje=z1..controls z3 and z4..z2..controls z5 and z6..cycle;
54         boogje:=boogje rotated angle(dxs,dys);
55         pickup pencircle scaled sleur_pen;
56         filldraw boogje;
57 enddef;