]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
* scm/sodipodi.scm: Add more output functions.
[lilypond.git] / mf / feta-beugel.mf
1 input feta-autometric;
2 input feta-macros;
3 input feta-params;
4
5 font_coding_scheme "feta braces";
6
7
8 fet_beginfont("feta-braces", 16);
9 mode_setup;
10
11 staffsize#:=16pt#;
12
13 save code;
14 code := -1;
15
16
17 def abc_encode_int (expr i) =
18         if i > 0:
19                 abc_encode_int(i div 26)&char(65 + i mod 26)
20         else:
21                 "A"
22         fi
23 enddef ;
24
25 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
26
27         save pendir, height, width, thin, thick, slt;
28         save penangle;
29         height# := height_sharp;
30         width# := width_sharp;
31         slt# := slt_sharp;
32
33 fet_beginchar("brace number "&(decimal code), "brace"&abc_encode_int(code),
34                 "brace"&abc_encode_int (code))
35
36         set_char_box (0, width#, height#/2, height#/2);
37           
38         define_pixels (height, width, slt);
39         thin = 2 slt;
40         thick = .5 width;
41         
42         z2 = .5 [z1, z3];
43         y3l = y1 + height/2;
44         x3 = x1 + width;
45         y1 =0;
46         x3 = - width / 2;
47
48         pair pendir;
49         pendir = unitvector(x3 - x1, y3l/6 - y1);
50         penangle = angle pendir - 90;
51         penpos3(thin, penangle);
52         penpos2(thick, angle(z3 -z1) -90 );
53         penpos1(2/3 thin, penangle);
54         
55         penlabels(1,2,3);
56         fill z2r ..  simple_serif (z3r, z3l, 90)
57                 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
58
59         addto currentpicture also currentpicture yscaled -1;
60 fet_endchar;
61 enddef;
62
63
64
65 save stafflinethickness;
66 save increment;
67
68 stafflinethickness := 0.5pt#;
69 increment := 0.5pt#;
70 y := 10pt#;
71
72
73
74 for i := 0 step 1 until font_count:
75
76   %% We can't store more than 64 (65?) height dimensions in a TFM
77   %% file, so we make small files.
78
79   for j := 0 step 1 until 63:
80     % message "l: "&decimal l;
81     % note: define_pixels (x) multiplies x by hppp,
82     % must never get bigger than infinity
83     y := min (y + increment, infinity/hppp - 1);
84
85     % x should be about one staff space, taking brace to have
86     % default height of 3 staffs, this yields height / 3 / 4 = 12
87     % but 15 looks better
88     x := y / 15;
89
90     increment := x / 10;
91     stafflinethickness :=  min (0.5pt#, y/150);
92     if i = font_count:
93       draw_brace (y, x, stafflinethickness);
94     fi
95   endfor;
96 endfor
97   
98 fet_endfont("feta-braces");