]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-arrowheads.mf
Add '-dcrop' option to ps and svg backends
[lilypond.git] / mf / feta-arrowheads.mf
1 % Feta (not the Font-En-Tja) music font -- draw arrow heads
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 ("arrowheads");
20
21 %
22 % To consider: we could put arrow heads at their real Unicode locations.
23 %
24
25 %
26 % Set up paths for upper half of arrow head pointing right.
27 % CLOSE_PATH is for a closed arrow, OPEN_PATH is for the open arrow.
28 % OPEN_TENSION sets the tension for the part which forms the path in
29 % OPEN_PATH.
30 %
31
32 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
33         save pat, finalpath;
34         save tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o;
35         save indent;
36         path pat, open_path, close_path;
37         pair tip_dir_o, tip_dir_c;
38
39         pickup pencircle scaled arrowlinethickness;
40
41         indent = linethickness / 2;
42
43         lft x1 = -width;
44         x2 = 0;
45         top y1 = height;
46         y2 = 0;
47
48         z4 = z3;
49         y5 = 0;
50         x5 = x4 + indent;
51
52         pat := z1
53                ..tension open_tension.. z2{right};
54         penpos2 (arrowlinethickness, 90);
55         tip_dir_o := direction 0.0 of pat;
56         tip_angle_o := angle (tip_dir_o);
57         penpos1 (arrowlinethickness, 90 + tip_angle_o);
58         z3 = z1;
59         penpos3 (arrowlinethickness, tip_angle_o);
60
61         open_path := z1r{tip_dir_o}
62                      .. z2r{right}
63                      .. z2l{left}
64                      .. z1l{-tip_dir_o}
65                      .. z3l
66                      .. cycle;
67
68         pat := z4
69                .. z5{down};
70         tip_dir_c := direction 0.0 of pat;
71         tip_angle_c := angle (tip_dir_c);
72         penpos4 (arrowlinethickness, 90+ tip_angle_c);
73         penpos5 (arrowlinethickness, 0);
74         z6 = z5;
75         penpos6 (arrowlinethickness, 90);
76
77         close_path := z4l{tip_dir_c}
78                       .. z5l{down}
79                       .. z6l{right}
80                       .. z2l{right}
81                       .. z2r{left}
82                       ..tension open_tension.. z1r{-tip_dir_o}
83                       .. z3l
84                       .. cycle;
85 enddef;
86
87
88 fet_beginchar ("open", "open.01");
89         set_char_box (staff_space#, 1.6 linethickness# / 2,
90                       0.5 staff_space#, 0.5 staff_space#);
91         set_arrow_paths (staff_space, 0.5 staff_space,
92                          1.0, 1.6 linethickness);
93         fill open_path;
94         open_path := open_path yscaled -1;
95         fill open_path;
96
97         penlabels (1, 2, 3);
98         penlabels (4, 5, 6);
99 fet_endchar;
100
101
102 fet_beginchar ("open", "open.0M1");
103         set_char_box (1.6 linethickness# / 2, staff_space#,
104                       0.5 staff_space#, 0.5 staff_space#);
105         set_arrow_paths (staff_space, 0.5 staff_space,
106                          1.0, 1.6 linethickness);
107         fill open_path;
108         open_path := open_path yscaled -1;
109         fill open_path;
110         currentpicture := currentpicture xscaled -1;
111 fet_endchar;
112
113
114 fet_beginchar ("open", "open.11");
115         set_char_box (.5 staff_space#, .5 staff_space#,
116                       1.0 staff_space#, 1.6 linethickness# / 2);
117         set_arrow_paths (staff_space, 0.5 staff_space,
118                          1.0, 1.6 linethickness);
119         fill open_path;
120         open_path := open_path yscaled -1;
121         fill open_path;
122         currentpicture := currentpicture rotated 90;
123 fet_endchar;
124
125
126 fet_beginchar ("open", "open.1M1");
127         set_char_box (.5 staff_space#, .5 staff_space#,
128                       1.6 linethickness# / 2, 1.0 staff_space#);
129         set_arrow_paths (staff_space, 0.5 staff_space,
130                          1.0, 1.6 linethickness);
131         fill open_path;
132         open_path := open_path yscaled -1;
133         fill open_path;
134         currentpicture := currentpicture rotated 90;
135         currentpicture := currentpicture yscaled -1;
136 fet_endchar;
137
138
139 fet_beginchar ("close", "close.01");
140         set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
141         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
142         fill close_path;
143         close_path := close_path yscaled -1;
144         fill close_path;
145 fet_endchar;
146
147
148 fet_beginchar ("close", "close.0M1");
149         set_char_box (0, staff_space#,  0.5 staff_space#, 0.5 staff_space#);
150         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
151         fill close_path;
152         close_path := close_path yscaled -1;
153         fill close_path;
154         currentpicture := currentpicture xscaled -1;
155 fet_endchar;
156
157
158 fet_beginchar ("close", "close.11");
159         set_char_box (.5 staff_space#, .5 staff_space#,
160                       1.0 staff_space#, 0.0 staff_space#);
161         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
162         fill close_path;
163         close_path := close_path yscaled -1;
164         fill close_path;
165         currentpicture := currentpicture rotated 90;
166 fet_endchar;
167
168
169 fet_beginchar ("close", "close.1M1");
170         set_char_box (.5 staff_space#, .5 staff_space#,
171                       0.0 staff_space#, 1.0 staff_space#);
172         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
173         fill close_path;
174         close_path := close_path yscaled -1;
175         fill close_path;
176         currentpicture := currentpicture rotated -90;
177 fet_endchar;
178
179
180 fet_endgroup ("arrowheads");