]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-beugel.mf
*** empty log message ***
[lilypond.git] / mf / feta-beugel.mf
1
2 % feta-beugel.mf -- [Staff] braces
3
4 % source file of the Feta (not an acronym for Font-En-Tja)
5 % pretty-but-neat music font
6
7 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 %                Jan Nieuwenhuizen <janneke@gnu.org>
9
10 input feta-autometric;
11 input feta-macros;
12
13 staffsize# := 20 pt#;   %% arbitrary.
14
15 input feta-params;
16
17
18 def abc_encode_int (expr i) =
19         if i > 0:
20                 abc_encode_int (i div 26) & char (65 + i mod 26)
21         else:
22                 "A"
23         fi
24 enddef ;
25
26 % we must let the design increase for each
27 % font to make sure that mftrace doesn't jack up the resolution too highly
28 % for the longer braces.
29 fet_beginfont ("feta-braces-" & char (97 + font_count), (font_count + 1) * 15,
30                "fetaBraces");
31
32 mode_setup;
33
34
35
36 save code;
37 code := 64;
38
39
40 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
41
42         save pendir, height, width, thin, thick, slt;
43         save penangle;
44         height# := height_sharp;
45         width# := width_sharp;
46         slt# := slt_sharp;
47
48 %% +1  is needed because fet_beginchar increments after dumping the strings.
49 fet_beginchar ("brace number " & (decimal (code + 1)),
50                 "brace" & decimal code)
51
52         set_char_box (0, width#, height#/2, height#/2);
53           
54         define_pixels (height, width, slt);
55         thin = 2 slt;
56         thick = .5 width;
57         
58         z2 = .5 [z1, z3];
59         y3l = y1 + height/2;
60         x3 = x1 + width;
61         y1 =0;
62         x3 = - width / 2;
63
64         pair pendir;
65         pendir = unitvector(x3 - x1, y3l/6 - y1);
66         penangle = angle pendir - 90;
67         penpos3(thin, penangle);
68         penpos2(thick, angle(z3 -z1) -90 );
69         penpos1(2/3 thin, penangle);
70         
71         penlabels(1,2,3);
72         fill z2r ..  simple_serif (z3r, z3l, 90)
73                 .. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
74
75         addto currentpicture also currentpicture yscaled -1;
76 fet_endchar;
77 enddef;
78
79
80
81 save stafflinethickness;
82 save increment;
83
84 linethickness := 0.5pt#;
85 increment := 0.5pt#;
86 y := 10pt#;
87
88
89
90 for i := 0 step 1 until font_count:
91
92   %% We can't store more than 64 (65?) height dimensions in a TFM
93   %% file, so we make small files.
94
95   for j := 0 step 1 until 63:
96     % message "l: "&decimal l;
97     % note: define_pixels (x) multiplies x by hppp,
98     % must never get bigger than infinity
99     y := y + increment;
100
101     if y > infinity/hppp:
102       message "Resolution and/or magnification is too high";
103       error please report: <bug-lilypond@gnu.org>;
104     fi
105
106     % x should be about one staff space, taking brace to have
107     % default height of 3 staffs, this yields height / 3 / 4 = 12
108     % but 15 looks better
109     x := y / 15;
110
111     increment := x / 10;
112     linethickness :=  min (0.5pt#, y/150);
113     if i = font_count:
114       draw_brace (y, x, linethickness);
115     fi
116   endfor;
117 endfor
118   
119 fet_endfont("feta-braces");