]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
patch::: 1.3.152.jcn3
[lilypond.git] / mf / feta-beugel.mf
1 input feta-autometric;
2 input feta-macros;
3 input feta-params;
4
5 fet_beginfont("feta-braces", 16);
6 mode_setup;
7
8 staffsize#:=16pt#;
9
10 save code;
11 code := 0;
12
13
14 def draw_brace (expr height_sharp, width_sharp, slt_sharp) = 
15         save pendir, height, width, thin, thick, slt;
16         save penangle;
17         height# := height_sharp;
18         width# := width_sharp;
19         slt# := slt_sharp;
20
21         beginchar(code, width#, height#/2, height#/2);
22         code := incr code;
23           
24         define_pixels (height, width, slt);
25         thin = 2 slt;
26         thick = .5 width;
27         
28         z2 = .5 [z1, z3];
29         y3l = y1 + height/2;
30         x3 = x1 + width;
31         y1 =0;
32         x3 = - width / 2;
33
34         pair pendir;
35         pendir = unitvector(x3 - x1, y3l/6 - y1);
36         penangle = angle pendir - 90;
37         penpos3(thin, penangle);
38         penpos2(thick, angle(z3 -z1) -90 );
39         penpos1(2/3 thin, penangle);
40         
41         penlabels(1,2,3);
42         fill z2r ..  simple_serif (z3r, z3l, 90)
43                 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
44
45         addto currentpicture also currentpicture yscaled -1;
46 endchar;
47 enddef;
48
49 l := 0.05pt#;
50 y := 10pt#;
51
52 for i := 0 step 1 until font_count:
53   for j := 0 step 1 until 255:
54     % message "l: "&decimal l;
55     % note: define_pixels (x) multiplies x by hppp,
56     % must never get bigger than infinity
57     y := min (y + l / 2, infinity/hppp - 1);
58     % x should be about one staff space, taking brace to have
59     % default height of 3 staffs, this yields height / 3 / 4
60     x := y / 12;
61     % l should be about one stafflinethickness
62     l := x / 10;
63     if i = font_count:
64       draw_brace (y, x, l);
65     fi
66   endfor;
67 endfor
68   
69 fet_endfont("feta-braces");