]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-brackettips.mf
Add '-dcrop' option to ps and svg backends
[lilypond.git] / mf / feta-brackettips.mf
1 % Feta (not the Font-En-Tja) music font --  bracket tips -*-Fundamental-*-
2 % This file is part of LilyPond, the GNU music typesetter.
3 %
4 % Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 %
6 % The LilyPond font is free software: you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation, either version 3 of the License, or
9 % (at your option) any later version, or under the SIL Open Font License.
10 %
11 % LilyPond is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 % GNU General Public License for more details.
15 %
16 % You should have received a copy of the GNU General Public License
17 % along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18
19 fet_begingroup ("brackettips");
20
21 def draw_bracket (expr thick_sharp, width_sharp, updown) =
22 begingroup;
23         save p, thin, thick, flattening, width, hair, flare;
24         path p;
25         pair tipdir;
26
27         flattening = 0.72;
28         thick# = thick_sharp;
29         flare# = flattening * width#;
30         width# = width_sharp;
31
32         define_pixels (thick, width, flare);
33         if updown = 1:
34                 set_char_box (0, width#,
35                               .5 thick#, flare#);
36         else:
37                 set_char_box (0, width#,
38                               flare#, .5 thick#);
39         fi;
40
41         thin = 2 linethickness;
42         hair = 1.25 linethickness;
43
44         pickup pencircle scaled thin;
45         y7 = y1;
46         x7 = x2;
47         z2 = z4r + (thin, 0);
48
49         penpos3 (thin, 0);
50         penpos4 (thin, 90);
51
52         z3 = z4;
53
54         top y3 = 0.5 thick;
55         lft x3 = 0.0;
56         x1 = x3l;
57         y1 = -0.5 thick;
58
59         z8 = .5 [z2, z7];
60         top y5 = flare;
61         rt x5 = width;
62
63         p := z8{right}
64              ..tension 1.2.. z5{curl 0};
65         tipdir := direction 1 of p;
66
67         penpos5 (hair, angle tipdir);
68         penpos6 (hair, 90 + angle tipdir);
69
70         z5 = z6;
71
72         pickup pencircle scaled 1;
73
74         fill (z1
75               -- z3l{up}
76               .. z4r{right}
77               -- z2{right}
78               .. z6r{tipdir}
79               .. z5r
80               .. z6l{-tipdir}
81               ..tension 1.1.. z7{left}
82               & z7
83               -- z1
84               & cycle) yscaled updown;
85
86         if updown = 1:
87                 penlabels (1, 2, 3, 4, 5, 6, 7, 8);
88         fi;
89 endgroup;
90 enddef;
91
92
93 fet_beginchar ("bracket tip up", "up");
94         draw_bracket (0.45 staff_space#, 1.9 staff_space#, 1);
95 fet_endchar;
96
97
98 fet_beginchar ("bracket tip down", "down");
99         draw_bracket (0.45 staff_space#, 1.9 staff_space#, -1);
100 fet_endchar;
101
102 fet_endgroup ("brackettips");