]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-flags.mf
Merge branch 'master' of /home/jcharles/GIT/Lily/. into translation
[lilypond.git] / mf / parmesan-flags.mf
1 % Feta (not the Font-En-Tja) music font --  ancient flags
2 % This file is part of LilyPond, the GNU music typesetter.
3 %
4 % Copyright (C) 2001--2012 Juergen Reuter <reuter@ipd.uka.de>
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 ("flags");
20
21 save between_staff_lines, on_staff_line, anywhere;
22
23 between_staff_lines := 0;
24 on_staff_line := 1;
25 anywhere := 2;
26
27 save dir_up, dir_down;
28
29 dir_up := 1;
30 dir_down := -1;
31
32
33 %%%%%%%%
34 %
35 %
36 %
37 % Mensural Notation
38 %
39 %
40 %
41
42 def draw_mensural_outermost_flare (expr staffline_adjustment, d_) =
43         define_pixels (linethickness, staff_space);
44
45         save ellipse, pat, T;
46         path ellipse, pat;
47         transform T;
48
49         T := identity xscaled 1.00 linethickness
50                       yscaled 0.22 staff_space
51                       rotated -35;
52         pickup pencircle transformed T;
53         ellipse := fullcircle transformed T;    
54
55         z11 = (+0.00 staff_space, -0.00 staff_space);
56         z12 = (+0.15 staff_space, -0.00 staff_space);
57
58         if staffline_adjustment = between_staff_lines:
59                 z13 = (+0.45 staff_space, -0.35 staff_space);
60                 z14 = (+0.45 staff_space, -0.85 staff_space);
61                 z15 = (+0.00 staff_space, -2.00 staff_space);
62         elseif staffline_adjustment = on_staff_line:
63                 z13 = (+0.20 staff_space, -0.05 staff_space);
64                 z14 = (+0.20 staff_space, -1.15 staff_space);
65                 z15 = (+0.00 staff_space, -1.40 staff_space);
66         else: % staffline_adjustment = anywhere
67                 z13 = (+0.33 staff_space, -0.20 staff_space);
68                 z14 = (+0.33 staff_space, -1.00 staff_space);
69                 z15 = (+0.00 staff_space, -1.70 staff_space);
70         fi;
71
72         pat := z13{z13 - z12}
73                .. {z15 - z14}z14;
74
75         fill get_subpath (ellipse, z11 - z12, z12 - z11, z11)
76              -- get_subpoint (ellipse, z12 - z11, z12)
77              -- get_subpoint (ellipse, z13 - z12, z12)
78              -- get_subpoint (ellipse, direction 0 of pat, z13)
79                   {direction 0 of pat}
80              .. {direction 1 of pat}
81                   get_subpoint (ellipse, direction 1 of pat, z14)
82              -- get_subpath (ellipse, z15 - z14, z14 - z15, z15)
83              -- get_subpoint (ellipse, -direction 1 of pat, z14)
84                   {-direction 1 of pat}
85              .. {-direction 0 of pat}
86                   get_subpoint (ellipse, -direction 0 of pat, z13)
87              -- get_subpath (ellipse, z12 - z13, z11 - z12, z12)
88              -- cycle;
89
90         if d_ = dir_up:
91                 labels (11, 12, 13, 14, 15);
92         fi;
93 enddef;
94
95
96 def draw_mensural_inner_flare (expr il_shift, idx, d_) =
97         define_pixels (linethickness, staff_space);
98
99         save ellipse, pat, T;
100         path ellipse, pat;
101         transform T;
102
103         T := identity xscaled 1.00 linethickness
104                       yscaled 0.22 staff_space
105                       rotated -35;
106         pickup pencircle transformed T;
107         ellipse := fullcircle transformed T;    
108
109         save i;
110         numeric i[];
111
112         i0 := idx * 10;
113         i1 := idx * 10 + 1;
114         i2 := idx * 10 + 2;
115         i3 := idx * 10 + 3;
116         i4 := idx * 10 + 4;
117
118         z[i0] = (0, -il_shift * staff_space);
119         z[i1] = z[i0] + (+0.00 staff_space, -0.10 staff_space);
120         z[i2] = z[i0] + (+0.33 staff_space, -0.30 staff_space);
121         z[i3] = z[i0] + (+0.33 staff_space, -0.70 staff_space);
122         z[i4] = z[i0] + (+0.00 staff_space, -0.90 staff_space);
123
124         pat := z[i1]{2, 1}
125                .. z[i2]
126                .. z[i3]
127                .. {-2, -1}z[i4];
128
129         % we avoid cusps originally present in `draw pat'
130         fill get_subpath (ellipse,
131                           -direction 0 of pat, direction 0 of pat, z[i1])
132              .. get_subpoint (ellipse, direction 1 of pat, z[i2])
133                   {direction 1 of pat}
134              .. get_subpoint (ellipse, direction 2 of pat, z[i3])
135                   {direction 2 of pat}
136              .. get_subpath (ellipse,
137                              direction 3 of pat, -direction 3 of pat, z[i4])
138              .. get_subpoint (ellipse, -direction 2 of pat, z[i3])
139                   {-direction 2 of pat}
140              .. get_subpoint (ellipse, -direction 1 of pat, z[i2])
141                   {-direction 1 of pat}
142              .. cycle;
143
144         if d_ = dir_up:
145                 labels ([i0], [i1], [i2], [i3], [i4]);
146         fi;
147 enddef;
148
149
150 def draw_mensural_flag (expr staffline_adjustment, flares, d_) =
151         save char_box_adjust, flare_shift;
152
153         if staffline_adjustment = between_staff_lines:
154                 flare_shift := 0.5;
155         elseif staffline_adjustment = on_staff_line:
156                 flare_shift := 0.0;
157         else: % staffline_adjustment = anywhere
158                 flare_shift := 0.25;
159         fi;
160
161         char_box_adjust := flare_shift + 0.5;
162
163         if d_ = dir_up:
164                 set_char_box (0,
165                               0.60 staff_space#,
166                               (flares + char_box_adjust) * staff_space#,
167                               0.10 staff_space#);
168         else: % d_ = dir_down
169                 set_char_box (0.60 staff_space#,
170                               0,
171                               0.10 staff_space#,
172                               (flares + char_box_adjust) * staff_space#);
173         fi;
174
175         draw_mensural_outermost_flare (staffline_adjustment, d_);
176
177         for flare_count := 2 step 1 until 4:
178                 if flares >= flare_count:
179                         draw_mensural_inner_flare (flare_shift
180                                                    + flare_count - 0.5,
181                                                    flare_count, d_);
182                 fi;
183         endfor;
184
185         if d_ = dir_down:
186                 currentpicture := currentpicture xscaled -1
187                                                  yscaled -1;
188         fi;
189 enddef;
190
191
192 % 8th mensural flag, upwards, between staff lines
193 fet_beginchar ("8th Mensural Flag (up)", "mensuralu03");
194         draw_mensural_flag (between_staff_lines, 1, dir_up);
195 fet_endchar;
196
197
198 % 8th mensural flag, upwards, on staff line
199 fet_beginchar ("8th Mensural Flag (up)", "mensuralu13");
200         draw_mensural_flag (on_staff_line, 1, dir_up);
201 fet_endchar;
202
203
204 % 8th mensural flag, upwards, anywhere
205 fet_beginchar ("8th Mensural Flag (up)", "mensuralu23");
206         draw_mensural_flag (anywhere, 1, dir_up);
207 fet_endchar;
208
209
210 % 8th mensural flag, downwards, between staff lines
211 fet_beginchar ("8th Mensural Flag (down)", "mensurald03");
212         draw_mensural_flag (between_staff_lines, 1, dir_down);
213 fet_endchar;
214
215
216 % 8th mensural flag, downwards, on staff line
217 fet_beginchar ("8th Mensural Flag (down)", "mensurald13");
218         draw_mensural_flag (on_staff_line, 1, dir_down);
219 fet_endchar;
220
221
222 % 8th mensural flag, downwards, anywhere
223 fet_beginchar ("8th Mensural Flag (down)", "mensurald23");
224         draw_mensural_flag (anywhere, 1, dir_down);
225 fet_endchar;
226
227
228 % 16th mensural flag, upwards, between staff lines
229 fet_beginchar ("16th Mensural Flag (up)", "mensuralu04");
230         draw_mensural_flag (between_staff_lines, 2, dir_up);
231 fet_endchar;
232
233
234 % 16th mensural flag, upwards, on staff line
235 fet_beginchar ("16th Mensural Flag (up)", "mensuralu14");
236         draw_mensural_flag (on_staff_line, 2, dir_up);
237 fet_endchar;
238
239
240 % 16th mensural flag, upwards, anywhere
241 fet_beginchar ("16th Mensural Flag (up)", "mensuralu24");
242         draw_mensural_flag (anywhere, 2, dir_up);
243 fet_endchar;
244
245
246 % 16th mensural flag, downwards, between staff lines
247 fet_beginchar ("16th Mensural Flag (down)", "mensurald04");
248         draw_mensural_flag (between_staff_lines, 2, dir_down);
249 fet_endchar;
250
251
252 % 16th mensural flag, downwards, on staff line
253 fet_beginchar ("16th Mensural Flag (down)", "mensurald14");
254         draw_mensural_flag (on_staff_line, 2, dir_down);
255 fet_endchar;
256
257
258 % 16th mensural flag, downwards, anywhere
259 fet_beginchar ("16th Mensural Flag (down)", "mensurald24");
260         draw_mensural_flag (anywhere, 2, dir_down);
261 fet_endchar;
262
263
264 % 32th mensural flag, upwards, between staff lines
265 fet_beginchar ("32th Mensural Flag (up)", "mensuralu05");
266         draw_mensural_flag (between_staff_lines, 3, dir_up);
267 fet_endchar;
268
269
270 % 32th mensural flag, upwards, on staff line
271 fet_beginchar ("32th Mensural Flag (up)", "mensuralu15");
272         draw_mensural_flag (on_staff_line, 3, dir_up);
273 fet_endchar;
274
275
276 % 32th mensural flag, upwards, anywhere
277 fet_beginchar ("32th Mensural Flag (up)", "mensuralu25");
278         draw_mensural_flag (anywhere, 3, dir_up);
279 fet_endchar;
280
281
282 % 32th mensural flag, downwards, between staff lines
283 fet_beginchar ("32th Mensural Flag (down)", "mensurald05");
284         draw_mensural_flag (between_staff_lines, 3, dir_down);
285 fet_endchar;
286
287
288 % 32th mensural flag, downwards, on staff line
289 fet_beginchar ("32th Mensural Flag (down)", "mensurald15");
290         draw_mensural_flag (on_staff_line, 3, dir_down);
291 fet_endchar;
292
293
294 % 32th mensural flag, downwards, anywhere
295 fet_beginchar ("32th Mensural Flag (down)", "mensurald25");
296         draw_mensural_flag (anywhere, 3, dir_down);
297 fet_endchar;
298
299
300 % 64th mensural flag, upwards, between staff lines
301 fet_beginchar ("64th Mensural Flag (up)", "mensuralu06");
302         draw_mensural_flag (between_staff_lines, 4, dir_up);
303 fet_endchar;
304
305
306 % 64th mensural flag, upwards, on staff line
307 fet_beginchar ("64th Mensural Flag (up)", "mensuralu16");
308         draw_mensural_flag (on_staff_line, 4, dir_up);
309 fet_endchar;
310
311
312 % 64th mensural flag, upwards, anywhere
313 fet_beginchar ("64th Mensural Flag (up)", "mensuralu26");
314         draw_mensural_flag (anywhere, 4, dir_up);
315 fet_endchar;
316
317
318 % 64th mensural flag, downwards, between staff lines
319 fet_beginchar ("64th Mensural Flag (down)", "mensurald06");
320         draw_mensural_flag (between_staff_lines, 4, dir_down);
321 fet_endchar;
322
323
324 % 64th mensural flag, downwards, on staff line
325 fet_beginchar ("64th Mensural Flag (down)", "mensurald16");
326         draw_mensural_flag (on_staff_line, 4, dir_down);
327 fet_endchar;
328
329
330 % 64th mensural flag, downwards, anywhere
331 fet_beginchar ("64th Mensural Flag (down)", "mensurald26");
332         draw_mensural_flag (anywhere, 4, dir_down);
333 fet_endchar;
334
335
336 fet_endgroup ("flags");