LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2002--2011 Juergen Reuter <reuter@ipd.uka.de>, | 4 Copyright (C) 2002--2011 Juergen Reuter <reuter@ipd.uka.de>, |
5 Pal Benko <benkop@freestart.hu> | 5 Pal Benko <benkop@freestart.hu> |
6 | 6 |
7 LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 9 the Free Software Foundation, either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 " undefined primitive -> ignoring grob"); | 120 " undefined primitive -> ignoring grob"); |
121 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); | 121 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); |
122 } | 122 } |
123 int primitive = scm_to_int (primitive_scm); | 123 int primitive = scm_to_int (primitive_scm); |
124 | 124 |
125 Real thickness = 0.0; | 125 Real thickness = 0.0; |
126 Real width = 0.0; | 126 Real width = 0.0; |
127 Real flexa_width = 0.0; | 127 Real flexa_width = 0.0; |
128 Real staff_space = Staff_symbol_referencer::staff_space (me); | 128 Real staff_space = Staff_symbol_referencer::staff_space (me); |
129 | 129 |
130 bool const color | 130 SCM style = me->get_property ("style"); |
131 = me->get_property ("style") == ly_symbol2scm ("blackpetrucci"); | 131 bool const black |
| 132 = scm_is_eq (style, ly_symbol2scm ("blackpetrucci")); |
132 bool const semi | 133 bool const semi |
133 = me->get_property ("style") == ly_symbol2scm ("semipetrucci"); | 134 = scm_is_eq (style, ly_symbol2scm ("semipetrucci")); |
134 | 135 |
135 if (primitive & MLP_ANY) | 136 if (primitive & MLP_ANY) |
136 { | 137 { |
137 thickness = robust_scm2double (me->get_property ("thickness"), .14); | 138 thickness = robust_scm2double (me->get_property ("thickness"), .13); |
138 width = robust_scm2double (me->get_property ("head-width"), staff_space); | 139 width = robust_scm2double (me->get_property ("head-width"), staff_space); |
139 } | 140 } |
140 if (primitive & MLP_FLEXA) | 141 if (primitive & MLP_FLEXA) |
141 flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2.0) | 142 flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2.0) |
142 * staff_space; | 143 * staff_space; |
143 | 144 |
144 Font_metric *fm = Font_interface::get_default_font (me); | |
145 Grob *stem = unsmob_grob (me->get_object ("stem")); | |
146 Direction stem_dir = stem ? get_grob_direction (stem) : CENTER; | |
147 int const duration_log = min (robust_scm2int ( | |
148 me->get_property ("duration-log"), | |
149 -1), | |
150 -1); | |
151 string prefix = "noteheads."; | |
152 string style = ""; | |
153 if (color) | |
154 style = "black"; | |
155 if (semi) | |
156 style = "semi"; | |
157 string suffix = to_string (duration_log) + style | |
158 + (duration_log == -3 ? "lig" : "") + "mensural"; | |
159 | |
160 Stencil out; | 145 Stencil out; |
161 int const note_shape = primitive & MLP_ANY; | 146 int const note_shape = primitive & MLP_ANY; |
| 147 int duration_log = 0; |
| 148 Font_metric *fm = Font_interface::get_default_font (me); |
| 149 string prefix = "noteheads."; |
| 150 string index; |
| 151 string suffix; |
| 152 string color = ""; |
| 153 if (black) |
| 154 color = "black"; |
| 155 if (semi) |
| 156 color = "semi"; |
162 | 157 |
163 switch (note_shape) | 158 switch (note_shape) |
164 { | 159 { |
165 case MLP_NONE: | 160 case MLP_NONE: |
166 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); | 161 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); |
167 case MLP_MAXIMA: | 162 case MLP_MAXIMA: |
| 163 duration_log--; |
168 case MLP_LONGA: | 164 case MLP_LONGA: |
| 165 duration_log--; |
169 case MLP_BREVIS: | 166 case MLP_BREVIS: |
170 out = fm->find_by_name (prefix + "s" + suffix); | 167 duration_log--; |
171 if (out.is_empty ()) | 168 suffix = to_string (duration_log) + color |
172 out = fm->find_by_name (prefix + ((stem_dir == UP) ? "sl" : "d") + suf
fix); | 169 + (duration_log == -3 ? "lig" : "") + "mensural"; |
| 170 index = prefix + "s"; |
| 171 out = fm->find_by_name (index + suffix); |
| 172 if (out.is_empty ()) |
| 173 index = prefix + "d"; |
| 174 out = fm->find_by_name (index + "r" + suffix); |
| 175 if (!out.is_empty () && scm_is_false ( |
| 176 scm_zero_p ( |
| 177 scm_modulo ( |
| 178 me->get_property ("staff-position"), |
| 179 scm_from_int (2))))) |
| 180 index += "r"; |
| 181 out = fm->find_by_name (index + suffix); |
173 break; | 182 break; |
174 case MLP_FLEXA_BEGIN: | 183 case MLP_FLEXA_BEGIN: |
175 case MLP_FLEXA_END: | 184 case MLP_FLEXA_END: |
176 out = brew_flexa (me, color, flexa_width, thickness, | 185 out = brew_flexa (me, black, flexa_width, thickness, |
177 note_shape == MLP_FLEXA_BEGIN); | 186 note_shape == MLP_FLEXA_BEGIN); |
178 break; | 187 break; |
179 default: | 188 default: |
180 programming_error (_ ("Mensural_ligature:" | 189 programming_error ("Mensural_ligature:" |
181 " unexpected case fall-through")); | 190 " unexpected case fall-through"); |
182 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); | 191 return Lookup::blank (Box (Interval (0, 0), Interval (0, 0))); |
183 } | 192 } |
184 | 193 |
185 Real blotdiameter | 194 Real blotdiameter |
186 = (me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))); | 195 = (me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))); |
187 | 196 |
188 if (primitive & MLP_STEM) | 197 if (primitive & MLP_STEM) |
189 { | 198 { |
190 // assume MLP_UP | 199 // assume MLP_UP |
191 Real y_bottom = 0.0, y_top = 3.0 * staff_space; | 200 Real y_bottom = 0.5 * staff_space, y_top = 2.5 * staff_space; |
192 | 201 |
193 if (primitive & MLP_DOWN) | 202 if (primitive & MLP_DOWN) |
194 { | 203 { |
195 y_bottom = -y_top; | 204 y_bottom = -y_top; |
196 y_top = 0.0; | 205 y_top = -0.5 * staff_space; |
197 } | 206 } |
198 | 207 |
199 Interval x_extent (0, thickness); | 208 Interval x_extent (0, thickness); |
200 Interval y_extent (y_bottom, y_top); | 209 Interval y_extent (y_bottom, y_top); |
201 Box join_box (x_extent, y_extent); | 210 Box join_box (x_extent, y_extent); |
202 | 211 |
203 Stencil join = Lookup::round_filled_box (join_box, blotdiameter); | 212 Stencil join = Lookup::round_filled_box (join_box, blotdiameter); |
204 out.add_stencil (join); | 213 out.add_stencil (join); |
205 } | 214 } |
206 | 215 |
(...skipping 14 matching lines...) Expand all Loading... |
221 if the previous note is longa-shaped, | 230 if the previous note is longa-shaped, |
222 the joining line may hide the stem, so made it longer | 231 the joining line may hide the stem, so made it longer |
223 to serve as stem as well | 232 to serve as stem as well |
224 */ | 233 */ |
225 if (primitive & MLP_LONGA) | 234 if (primitive & MLP_LONGA) |
226 /* | 235 /* |
227 instead of 3.0 the length of a longa stem should be used | 236 instead of 3.0 the length of a longa stem should be used |
228 Font_interface::get_default_font (???)->find_by_name | 237 Font_interface::get_default_font (???)->find_by_name |
229 ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5 | 238 ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5 |
230 */ | 239 */ |
231 y_bottom -= 3.0 * staff_space; | 240 y_bottom -= 2.5 * staff_space; |
232 } | 241 } |
233 | 242 |
234 Interval x_extent (width - thickness, width); | 243 Interval x_extent (width - thickness, width); |
235 Interval y_extent (y_bottom, y_top); | 244 Interval y_extent (y_bottom, y_top); |
236 Box join_box (x_extent, y_extent); | 245 Box join_box (x_extent, y_extent); |
237 Stencil join = Lookup::round_filled_box (join_box, blotdiameter); | 246 Stencil join = Lookup::round_filled_box (join_box, blotdiameter); |
238 | 247 |
239 out.add_stencil (join); | 248 out.add_stencil (join); |
240 } | 249 } |
241 else | 250 else |
242 programming_error (_ ("Mensural_ligature: (join_right == 0)")); | 251 programming_error ("Mensural_ligature: (join_right == 0)"); |
243 } | 252 } |
244 | 253 |
245 #if 0 /* what happend with the ledger lines? */ | 254 #if 0 /* what happend with the ledger lines? */ |
246 int pos = Staff_symbol_referencer::get_rounded_position (me); | 255 int pos = Staff_symbol_referencer::get_rounded_position (me); |
247 if (primitive & MLP_FLEXA) | 256 if (primitive & MLP_FLEXA) |
248 { | 257 { |
249 pos += delta_pitch; | 258 pos += delta_pitch; |
250 add_ledger_lines (me, &out, pos, 0.5 * delta_pitch, ledger_take_space); | 259 add_ledger_lines (me, &out, pos, 0.5 * delta_pitch, ledger_take_space); |
251 } | 260 } |
252 #endif | 261 #endif |
(...skipping 21 matching lines...) Expand all Loading... |
274 | 283 |
275 /* properties */ | 284 /* properties */ |
276 "delta-position " | 285 "delta-position " |
277 "ligature-flexa " | 286 "ligature-flexa " |
278 "head-width " | 287 "head-width " |
279 "add-join " | 288 "add-join " |
280 "flexa-interval " | 289 "flexa-interval " |
281 "primitive " | 290 "primitive " |
282 "thickness " | 291 "thickness " |
283 ); | 292 ); |
LEFT | RIGHT |