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