]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-arrow.mf
* input/proportional.ly: use #'used property. Set break-overshoot property.
[lilypond.git] / mf / feta-arrow.mf
1 %
2 % feta-arrow.mf -- draw arrow heads
3 %
4 % source file of the GNU LilyPond music typesetter
5 %
6 % (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 %
8
9
10
11 fet_begingroup ("arrowheads");
12
13 %
14 % To consider: we could put arrow heads at their real Unicode locations. 
15
16
17 %
18 % Setup paths for upper half of arrow head pointing right. 
19 % CLOSE_PATH is for a closed arrow, OPEN_PATH is for the open arrow 
20 % OPEN_TENSION sets the tension for the part which forms the path in OPEN_PATH
21
22 def set_arrow_paths (expr width, height, open_tension, arrowlinethickness) =
23         save pat, finalpath,
24                 tip_angle_o, tip_angle_c, tip_dir_c, tip_dir_o,
25                 indent;
26         path pat, open_path, close_path;
27         pair tip_dir_o, tip_dir_c;
28
29         pickup pencircle scaled arrowlinethickness;
30
31         indent = linethickness/2;
32
33         lft x1 = -width;
34         x2 = 0;
35         top y1 = height;
36         y2 = 0;
37
38         z4 = z3;
39         y5 = 0;
40         x5 = x4 + indent;
41
42         pat := z1 .. tension open_tension .. z2{right};
43
44         penpos2 (arrowlinethickness, 90);
45         tip_dir_o := direction 0.0 of pat;
46         tip_angle_o := angle (tip_dir_o);
47         penpos1 (arrowlinethickness, 90 + tip_angle_o);
48         z3 = z1;
49         penpos3 (arrowlinethickness, tip_angle_o);
50
51         open_path := z1r{tip_dir_o} .. z2r{right}
52                 .. z2l{left} .. z1l{-tip_dir_o} .. z3l .. cycle;
53
54         pat := z4 .. z5{down};
55         tip_dir_c := direction 0.0 of pat;
56         tip_angle_c := angle (tip_dir_c);
57         penpos4 (arrowlinethickness, 90+ tip_angle_c);
58         penpos5 (arrowlinethickness, 0);
59         z6 = z5;
60         penpos6 (arrowlinethickness, 90);
61
62         close_path := z4l{tip_dir_c} .. z5l{down} .. z6l{right}
63                 .. z2l{right} .. z2r{left}
64                 .. tension open_tension 
65                 .. z1r{-tip_dir_o}
66                 .. z3l
67                 .. cycle;
68
69 enddef;
70
71 fet_beginchar ("open", "open.01");
72         set_char_box (staff_space#, 1.6 linethickness#/2, 0.5 staff_space#, 0.5 staff_space#);
73         set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
74         fill open_path; 
75         addto currentpicture also currentpicture yscaled -1;
76         penlabels (1, 2, 3);
77         penlabels (4, 5, 6);
78 fet_endchar;
79
80 fet_beginchar ("open", "open.0M1");
81         set_char_box ( 1.6 linethickness#/2, staff_space#, 0.5 staff_space#, 0.5 staff_space#);
82         set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
83         fill open_path; 
84         addto currentpicture also currentpicture yscaled -1;
85         currentpicture := currentpicture xscaled -1;
86 fet_endchar;
87
88 fet_beginchar ("open", "open.11");
89         set_char_box (.5 staff_space#, .5 staff_space#,
90                         1.0 staff_space#,  1.6 linethickness#/2);
91         set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
92         fill open_path; 
93         addto currentpicture also currentpicture yscaled -1;
94         currentpicture := currentpicture rotated 90;
95 fet_endchar;
96
97 fet_beginchar ("open", "open.1M1");
98         set_char_box (.5 staff_space#, .5 staff_space#,
99                       1.6 linethickness#/2, 1.0 staff_space#);
100         set_arrow_paths (staff_space, 0.5 staff_space, 1.0, 1.6 linethickness);
101         fill open_path; 
102         addto currentpicture also currentpicture yscaled -1;
103         currentpicture := currentpicture rotated 90;
104         currentpicture := currentpicture yscaled -1;
105 fet_endchar;
106
107
108
109 fet_beginchar ("close", "close.01");
110         set_char_box (staff_space#, 0, 0.5 staff_space#, 0.5 staff_space#);
111         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
112         fill close_path;        
113         addto currentpicture also currentpicture yscaled -1;
114 fet_endchar;
115 fet_beginchar ("close", "close.0M1");
116         set_char_box (0, staff_space#,  0.5 staff_space#, 0.5 staff_space#);
117         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
118         fill close_path;        
119         addto currentpicture also currentpicture yscaled -1;
120         currentpicture := currentpicture xscaled -1;
121 fet_endchar;
122
123 fet_beginchar ("close", "close.11");
124         set_char_box (.5 staff_space#, .5 staff_space# ,
125                         1.0 staff_space#, 0.0 staff_space#);
126         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
127         fill close_path;        
128         addto currentpicture also currentpicture yscaled -1;
129         currentpicture := currentpicture rotated 90;
130 fet_endchar;
131
132 fet_beginchar ("close", "close.1M1");
133         set_char_box (.5 staff_space#, .5 staff_space# ,
134                         0.0 staff_space#, 1.0 staff_space#);
135         set_arrow_paths (staff_space, 0.5 staff_space, 1.5, blot_diameter);
136         fill close_path;        
137         addto currentpicture also currentpicture yscaled -1;
138         currentpicture := currentpicture rotated -90;
139 fet_endchar;
140
141
142 fet_endgroup ("arrowheads");