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