]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-flags.mf
release: 1.5.33
[lilypond.git] / mf / parmesan-flags.mf
1 % -*-Fundamental-*-
2 % parmesan-flags.mf -- implement ancient flags
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 2001--2002 Juergen Reuter <reuter@ipd.uka.de>
7
8
9 fet_begingroup ("flags")
10
11 save between_staff_lines, on_staff_line, anywhere;
12 between_staff_lines = 0;
13 on_staff_line = 1;
14 anywhere = 2;
15
16 save dir_up, dir_down;
17 dir_up = 1;
18 dir_down = -1;
19
20
21 %%%%%%%%
22 %
23 %
24 %
25 % Mensural Notation
26 %
27 %
28 %
29
30 def draw_mensural_outermost_flare (expr staffline_adjustment) =
31         define_pixels(stafflinethickness, staff_space)
32
33         pickup pencircle
34                 xscaled 1.00 stafflinethickness
35                 yscaled 0.22 staff_space
36                 rotated -35;
37
38         save za, zb, zc, zd, ze;
39         pair za, zb, zc, zd, ze;
40
41         za = (+0.00 staff_space, -0.00 staff_space);
42         zb = (+0.15 staff_space, -0.00 staff_space);
43
44         if staffline_adjustment = between_staff_lines:
45                 zc = (+0.45 staff_space, -0.35 staff_space);
46                 zd = (+0.45 staff_space, -0.85 staff_space);
47                 ze = (+0.00 staff_space, -2.00 staff_space);
48         elseif staffline_adjustment = on_staff_line:
49                 zc = (+0.20 staff_space, -0.05 staff_space);
50                 zd = (+0.20 staff_space, -1.15 staff_space);
51                 ze = (+0.00 staff_space, -1.40 staff_space);
52         else: % staffline_adjustment = anywhere
53                 zc = (+0.33 staff_space, -0.20 staff_space);
54                 zd = (+0.33 staff_space, -1.00 staff_space);
55                 ze = (+0.00 staff_space, -1.70 staff_space);
56         fi;
57
58         draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
59 enddef;
60
61 def draw_mensural_inner_flare(expr il_shift) =
62         define_pixels(stafflinethickness, staff_space)
63
64         pickup pencircle
65                 xscaled 1.00 stafflinethickness
66                 yscaled 0.22 staff_space
67                 rotated -35;
68
69         save zs, za, zb, zc, zd;
70         pair zs, za, zb, zc, zd;
71
72         zs = (0, -il_shift * staff_space);
73         za = zs + (+0.00 staff_space, -0.10 staff_space);
74         zb = zs + (+0.33 staff_space, -0.30 staff_space);
75         zc = zs + (+0.33 staff_space, -0.70 staff_space);
76         zd = zs + (+0.00 staff_space, -0.90 staff_space);
77
78         draw za{2,1} .. zb .. zc .. {-2,-1}zd;
79 enddef;
80
81 def draw_mensural_flag (expr staffline_adjustment, flares, direction) =
82         save char_box_adjust, flare_shift;
83         if staffline_adjustment = between_staff_lines:
84                 flare_shift = 0.5;
85         elseif staffline_adjustment = on_staff_line:
86                 flare_shift = 0.0;
87         else: % staffline_adjustment = anywhere
88                 flare_shift = 0.25;
89         fi;
90         char_box_adjust = flare_shift+0.5;
91         if direction = dir_up:
92                 set_char_box(0, 0.60 staff_space#,
93                              (1.00+char_box_adjust)*staff_space#, 0)
94         else: % direction = dir_down
95                 set_char_box(0.60 staff_space#, 0,
96                              (1.00+char_box_adjust)*staff_space#, 0)
97         fi;
98         draw_mensural_outermost_flare (staffline_adjustment)
99         for flare_count := 2 step 1 until 4:
100                 if flares >= flare_count:
101                         draw_mensural_inner_flare(flare_shift+flare_count-0.5)
102                 fi;
103         endfor;
104         if direction = dir_down:
105                 currentpicture := currentpicture xscaled -1 yscaled -1;
106         fi;
107 enddef;
108
109 % 8th mensural flag, upwards, between staff lines
110 fet_beginchar("8th Mensural Flag (up)", "mensuralu03", "menseighthflag")
111         draw_mensural_flag (between_staff_lines, 1, dir_up)
112 fet_endchar;
113
114 % 8th mensural flag, upwards, on staff line
115 fet_beginchar("8th Mensural Flag (up)", "mensuralu13", "mens1eighthflag")
116         draw_mensural_flag (on_staff_line, 1, dir_up)
117 fet_endchar;
118
119 % 8th mensural flag, upwards, anywhere
120 fet_beginchar("8th Mensural Flag (up)", "mensuralu23", "mens1eighthflag")
121         draw_mensural_flag (anywhere, 1, dir_up)
122 fet_endchar;
123
124 % 8th mensural flag, downwards, between staff lines
125 fet_beginchar("8th Mensural Flag (down)", "mensurald03", "mensdeighthflag")
126         draw_mensural_flag (between_staff_lines, 1, dir_down)
127 fet_endchar;
128
129 % 8th mensural flag, downwards, on staff line
130 fet_beginchar("8th Mensural Flag (down)", "mensurald13", "mensd1eighthflag")
131         draw_mensural_flag (on_staff_line, 1, dir_down)
132 fet_endchar;
133
134 % 8th mensural flag, downwards, anywhere
135 fet_beginchar("8th Mensural Flag (down)", "mensurald23", "mensd1eighthflag")
136         draw_mensural_flag (anywhere, 1, dir_down)
137 fet_endchar;
138
139 % 16th mensural flag, upwards, between staff lines
140 fet_beginchar("16th Mensural Flag (up)", "mensuralu04", "menssixteenthflag")
141         draw_mensural_flag (between_staff_lines, 2, dir_up)
142 fet_endchar;
143
144 % 16th mensural flag, upwards, on staff line
145 fet_beginchar("16th Mensural Flag (up)", "mensuralu14", "mens1sixteenthflag")
146         draw_mensural_flag (on_staff_line, 2, dir_up)
147 fet_endchar;
148
149 % 16th mensural flag, upwards, anywhere
150 fet_beginchar("16th Mensural Flag (up)", "mensuralu24", "mens1sixteenthflag")
151         draw_mensural_flag (anywhere, 2, dir_up)
152 fet_endchar;
153
154 % 16th mensural flag, downwards, between staff lines
155 fet_beginchar("16th Mensural Flag (down)", "mensurald04", "mensdsixteenthflag")
156         draw_mensural_flag (between_staff_lines, 2, dir_down)
157 fet_endchar;
158
159 % 16th mensural flag, downwards, on staff line
160 fet_beginchar("16th Mensural Flag (down)", "mensurald14", "mensd1sixteenthflag")
161         draw_mensural_flag (on_staff_line, 2, dir_down)
162 fet_endchar;
163
164 % 16th mensural flag, downwards, anywhere
165 fet_beginchar("16th Mensural Flag (down)", "mensurald24", "mensd1sixteenthflag")
166         draw_mensural_flag (anywhere, 2, dir_down)
167 fet_endchar;
168
169 % 32th mensural flag, upwards, between staff lines
170 fet_beginchar("32th Mensural Flag (up)", "mensuralu05", "mensthirtysecondflag")
171         draw_mensural_flag (between_staff_lines, 3, dir_up)
172 fet_endchar;
173
174 % 32th mensural flag, upwards, on staff line
175 fet_beginchar("32th Mensural Flag (up)", "mensuralu15", "mens1thirtysecondflag")
176         draw_mensural_flag (on_staff_line, 3, dir_up)
177 fet_endchar;
178
179 % 32th mensural flag, upwards, anywhere
180 fet_beginchar("32th Mensural Flag (up)", "mensuralu25", "mens1thirtysecondflag")
181         draw_mensural_flag (anywhere, 3, dir_up)
182 fet_endchar;
183
184 % 32th mensural flag, downwards, between staff lines
185 fet_beginchar("32th Mensural Flag (down)", "mensurald05", "mensdthirtysecondflag")
186         draw_mensural_flag (between_staff_lines, 3, dir_down)
187 fet_endchar;
188
189 % 32th mensural flag, downwards, on staff line
190 fet_beginchar("32th Mensural Flag (down)", "mensurald15", "mensd1thirtysecondflag")
191         draw_mensural_flag (on_staff_line, 3, dir_down)
192 fet_endchar;
193
194 % 32th mensural flag, downwards, anywhere
195 fet_beginchar("32th Mensural Flag (down)", "mensurald25", "mensd1thirtysecondflag")
196         draw_mensural_flag (anywhere, 3, dir_down)
197 fet_endchar;
198
199 % 64th mensural flag, upwards, between staff lines
200 fet_beginchar("64th Mensural Flag (up)", "mensuralu06", "menssixtyfourthflag")
201         draw_mensural_flag (between_staff_lines, 4, dir_up)
202 fet_endchar;
203
204 % 64th mensural flag, upwards, on staff line
205 fet_beginchar("64th Mensural Flag (up)", "mensuralu16", "mens1sixtyfourthflag")
206         draw_mensural_flag (on_staff_line, 4, dir_up)
207 fet_endchar;
208
209 % 64th mensural flag, upwards, anywhere
210 fet_beginchar("64th Mensural Flag (up)", "mensuralu26", "mens1sixtyfourthflag")
211         draw_mensural_flag (anywhere, 4, dir_up)
212 fet_endchar;
213
214 % 64th mensural flag, downwards, between staff lines
215 fet_beginchar("64th Mensural Flag (down)", "mensurald06", "mensdsixtyfourthflag")
216         draw_mensural_flag (between_staff_lines, 4, dir_down)
217 fet_endchar;
218
219 % 64th mensural flag, downwards, on staff line
220 fet_beginchar("64th Mensural Flag (down)", "mensurald16", "mensd1sixtyfourthflag")
221         draw_mensural_flag (on_staff_line, 4, dir_down)
222 fet_endchar;
223
224 % 64th mensural flag, downwards, anywhere
225 fet_beginchar("64th Mensural Flag (down)", "mensurald26", "mensd1sixtyfourthflag")
226         draw_mensural_flag (anywhere, 4, dir_down)
227 fet_endchar;
228
229 fet_endgroup ("flags")