1 % Feta (not the Font-En-Tja) music font -- draw arrow heads
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 % LilyPond 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.
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.
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/>.
19 fet_begingroup ("arrowheads");
22 % To consider: we could put arrow heads at their real Unicode locations.
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
32 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
34 save tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o;
36 path pat, open_path, close_path;
37 pair tip_dir_o, tip_dir_c;
39 pickup pencircle scaled arrowlinethickness;
41 indent = linethickness / 2;
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);
59 penpos3 (arrowlinethickness, tip_angle_o);
61 open_path := z1r{tip_dir_o}
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);
75 penpos6 (arrowlinethickness, 90);
77 close_path := z4l{tip_dir_c}
82 ..tension open_tension.. z1r{-tip_dir_o}
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);
94 open_path := open_path yscaled -1;
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);
108 open_path := open_path yscaled -1;
110 currentpicture := currentpicture xscaled -1;
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);
120 open_path := open_path yscaled -1;
122 currentpicture := currentpicture rotated 90;
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);
132 open_path := open_path yscaled -1;
134 currentpicture := currentpicture rotated 90;
135 currentpicture := currentpicture yscaled -1;
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);
143 close_path := close_path yscaled -1;
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);
152 close_path := close_path yscaled -1;
154 currentpicture := currentpicture xscaled -1;
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);
163 close_path := close_path yscaled -1;
165 currentpicture := currentpicture rotated 90;
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);
174 close_path := close_path yscaled -1;
176 currentpicture := currentpicture rotated -90;
180 fet_endgroup ("arrowheads");