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