release commit
[lilypond.git] / mf / parmesan-flags.mf
blob994c7840a0220500cd88df77b2d9c00c3ea06d19
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--2004 Juergen Reuter <reuter@ipd.uka.de>
7
9 fet_begingroup ("flags")
11 save between_staff_lines, on_staff_line, anywhere;
12 between_staff_lines = 0;
13 on_staff_line = 1;
14 anywhere = 2;
16 save dir_up, dir_down;
17 dir_up = 1;
18 dir_down = -1;
21 %%%%%%%%
25 % Mensural Notation
30 def draw_mensural_outermost_flare (expr staffline_adjustment) =
31         define_pixels(linethickness, staff_space)
33         pickup pencircle
34                 xscaled 1.00 linethickness
35                 yscaled 0.22 staff_space
36                 rotated -35;
38         save za, zb, zc, zd, ze;
39         pair za, zb, zc, zd, ze;
41         za = (+0.00 staff_space, -0.00 staff_space);
42         zb = (+0.15 staff_space, -0.00 staff_space);
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;
58         draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
59 enddef;
61 def draw_mensural_inner_flare(expr il_shift) =
62         define_pixels(linethickness, staff_space)
64         pickup pencircle
65                 xscaled 1.00 linethickness
66                 yscaled 0.22 staff_space
67                 rotated -35;
69         save zs, za, zb, zc, zd;
70         pair zs, za, zb, zc, zd;
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);
78         draw za{2,1} .. zb .. zc .. {-2,-1}zd;
79 enddef;
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,
93                              0.60 staff_space#,
94                              (flares+char_box_adjust)*staff_space#,
95                              0.10 staff_space#)
96         else: % direction = dir_down
97                 set_char_box(0.60 staff_space#,
98                              0,
99                              0.10 staff_space#,
100                              (flares+char_box_adjust)*staff_space#)
101         fi;
102         draw_mensural_outermost_flare (staffline_adjustment)
103         for flare_count := 2 step 1 until 4:
104                 if flares >= flare_count:
105                         draw_mensural_inner_flare(flare_shift+flare_count-0.5)
106                 fi;
107         endfor;
108         if direction = dir_down:
109                 currentpicture := currentpicture xscaled -1 yscaled -1;
110         fi;
111 enddef;
113 % 8th mensural flag, upwards, between staff lines
114 fet_beginchar("8th Mensural Flag (up)", "mensuralu03", "menseighthflag")
115         draw_mensural_flag (between_staff_lines, 1, dir_up)
116 fet_endchar;
118 % 8th mensural flag, upwards, on staff line
119 fet_beginchar("8th Mensural Flag (up)", "mensuralu13", "mens1eighthflag")
120         draw_mensural_flag (on_staff_line, 1, dir_up)
121 fet_endchar;
123 % 8th mensural flag, upwards, anywhere
124 fet_beginchar("8th Mensural Flag (up)", "mensuralu23", "mens1eighthflag")
125         draw_mensural_flag (anywhere, 1, dir_up)
126 fet_endchar;
128 % 8th mensural flag, downwards, between staff lines
129 fet_beginchar("8th Mensural Flag (down)", "mensurald03", "mensdeighthflag")
130         draw_mensural_flag (between_staff_lines, 1, dir_down)
131 fet_endchar;
133 % 8th mensural flag, downwards, on staff line
134 fet_beginchar("8th Mensural Flag (down)", "mensurald13", "mensd1eighthflag")
135         draw_mensural_flag (on_staff_line, 1, dir_down)
136 fet_endchar;
138 % 8th mensural flag, downwards, anywhere
139 fet_beginchar("8th Mensural Flag (down)", "mensurald23", "mensd1eighthflag")
140         draw_mensural_flag (anywhere, 1, dir_down)
141 fet_endchar;
143 % 16th mensural flag, upwards, between staff lines
144 fet_beginchar("16th Mensural Flag (up)", "mensuralu04", "menssixteenthflag")
145         draw_mensural_flag (between_staff_lines, 2, dir_up)
146 fet_endchar;
148 % 16th mensural flag, upwards, on staff line
149 fet_beginchar("16th Mensural Flag (up)", "mensuralu14", "mens1sixteenthflag")
150         draw_mensural_flag (on_staff_line, 2, dir_up)
151 fet_endchar;
153 % 16th mensural flag, upwards, anywhere
154 fet_beginchar("16th Mensural Flag (up)", "mensuralu24", "mens1sixteenthflag")
155         draw_mensural_flag (anywhere, 2, dir_up)
156 fet_endchar;
158 % 16th mensural flag, downwards, between staff lines
159 fet_beginchar("16th Mensural Flag (down)", "mensurald04", "mensdsixteenthflag")
160         draw_mensural_flag (between_staff_lines, 2, dir_down)
161 fet_endchar;
163 % 16th mensural flag, downwards, on staff line
164 fet_beginchar("16th Mensural Flag (down)", "mensurald14", "mensd1sixteenthflag")
165         draw_mensural_flag (on_staff_line, 2, dir_down)
166 fet_endchar;
168 % 16th mensural flag, downwards, anywhere
169 fet_beginchar("16th Mensural Flag (down)", "mensurald24", "mensd1sixteenthflag")
170         draw_mensural_flag (anywhere, 2, dir_down)
171 fet_endchar;
173 % 32th mensural flag, upwards, between staff lines
174 fet_beginchar("32th Mensural Flag (up)", "mensuralu05", "mensthirtysecondflag")
175         draw_mensural_flag (between_staff_lines, 3, dir_up)
176 fet_endchar;
178 % 32th mensural flag, upwards, on staff line
179 fet_beginchar("32th Mensural Flag (up)", "mensuralu15", "mens1thirtysecondflag")
180         draw_mensural_flag (on_staff_line, 3, dir_up)
181 fet_endchar;
183 % 32th mensural flag, upwards, anywhere
184 fet_beginchar("32th Mensural Flag (up)", "mensuralu25", "mens1thirtysecondflag")
185         draw_mensural_flag (anywhere, 3, dir_up)
186 fet_endchar;
188 % 32th mensural flag, downwards, between staff lines
189 fet_beginchar("32th Mensural Flag (down)", "mensurald05", "mensdthirtysecondflag")
190         draw_mensural_flag (between_staff_lines, 3, dir_down)
191 fet_endchar;
193 % 32th mensural flag, downwards, on staff line
194 fet_beginchar("32th Mensural Flag (down)", "mensurald15", "mensd1thirtysecondflag")
195         draw_mensural_flag (on_staff_line, 3, dir_down)
196 fet_endchar;
198 % 32th mensural flag, downwards, anywhere
199 fet_beginchar("32th Mensural Flag (down)", "mensurald25", "mensd1thirtysecondflag")
200         draw_mensural_flag (anywhere, 3, dir_down)
201 fet_endchar;
203 % 64th mensural flag, upwards, between staff lines
204 fet_beginchar("64th Mensural Flag (up)", "mensuralu06", "menssixtyfourthflag")
205         draw_mensural_flag (between_staff_lines, 4, dir_up)
206 fet_endchar;
208 % 64th mensural flag, upwards, on staff line
209 fet_beginchar("64th Mensural Flag (up)", "mensuralu16", "mens1sixtyfourthflag")
210         draw_mensural_flag (on_staff_line, 4, dir_up)
211 fet_endchar;
213 % 64th mensural flag, upwards, anywhere
214 fet_beginchar("64th Mensural Flag (up)", "mensuralu26", "mens1sixtyfourthflag")
215         draw_mensural_flag (anywhere, 4, dir_up)
216 fet_endchar;
218 % 64th mensural flag, downwards, between staff lines
219 fet_beginchar("64th Mensural Flag (down)", "mensurald06", "mensdsixtyfourthflag")
220         draw_mensural_flag (between_staff_lines, 4, dir_down)
221 fet_endchar;
223 % 64th mensural flag, downwards, on staff line
224 fet_beginchar("64th Mensural Flag (down)", "mensurald16", "mensd1sixtyfourthflag")
225         draw_mensural_flag (on_staff_line, 4, dir_down)
226 fet_endchar;
228 % 64th mensural flag, downwards, anywhere
229 fet_beginchar("64th Mensural Flag (down)", "mensurald26", "mensd1sixtyfourthflag")
230         draw_mensural_flag (anywhere, 4, dir_down)
231 fet_endchar;
233 fet_endgroup ("flags")