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) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 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 | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 /* | 103 /* |
104 make this function easily usable in C++ | 104 make this function easily usable in C++ |
105 */ | 105 */ |
106 string | 106 string |
107 Rest::glyph_name (Grob *me, int durlog, string style, bool try_ledgers) | 107 Rest::glyph_name (Grob *me, int durlog, string style, bool try_ledgers) |
108 { | 108 { |
109 bool is_ledgered = false; | 109 bool is_ledgered = false; |
110 if (try_ledgers && (durlog == -1 || durlog == 0 || durlog == 1)) | 110 if (try_ledgers && (durlog == -1 || durlog == 0 || durlog == 1)) |
111 { | 111 { |
112 Interval ext(0.0, 0.0); | 112 int const pos = int (Staff_symbol_referencer::get_position (me)); |
113 if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me)) | 113 |
114 ext = staff->extent (staff, Y_AXIS); | 114 /* |
115 | 115 » half rests need ledger if not lying on a staff line, |
116 Real pos = 0.5 * Staff_symbol_referencer::get_position (me) | 116 » whole rests need ledger if not hanging from a staff line, |
117 * Staff_symbol_referencer::staff_space (me); | 117 » breve rests need ledger if neither lying on nor hanging from a staff lin
e |
118 | 118 */ |
119 /* | 119 if (-1 <= durlog && durlog <= 1) |
120 glyph for rests outside staff must include ledger line | 120 is_ledgered = !Staff_symbol_referencer::on_staff_line (me, pos) |
121 for some durations | 121 » && !(durlog == -1 |
122 */ | 122 » && Staff_symbol_referencer::on_staff_line (me, pos + 2)); |
123 is_ledgered | |
124 = (durlog == -1) && (pos < ext[DOWN] - 1 || pos > ext[UP]) | |
125 || (durlog == 0) && (pos < ext[DOWN] || pos > ext[UP] + 0.5) | |
126 || (durlog == 1) && (pos < ext[DOWN] - 0.5 || pos > ext[UP]); | |
127 } | 123 } |
128 | 124 |
129 string actual_style (style.c_str ()); | 125 string actual_style (style.c_str ()); |
130 | 126 |
131 if ((style == "mensural") || (style == "neomensural")) | 127 if ((style == "mensural") || (style == "neomensural")) |
132 { | 128 { |
133 | 129 |
134 /* | 130 /* |
135 FIXME: Currently, ancient font does not provide ledgered rests; | 131 FIXME: Currently, ancient font does not provide ledgered rests; |
136 hence the "o" suffix in the glyph name is bogus. But do we need | 132 hence the "o" suffix in the glyph name is bogus. But do we need |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 ADD_INTERFACE (Rest, | 256 ADD_INTERFACE (Rest, |
261 "A rest symbol. The property @code{style} can be" | 257 "A rest symbol. The property @code{style} can be" |
262 " @code{default}, @code{mensural}, @code{neomensural} or" | 258 " @code{default}, @code{mensural}, @code{neomensural} or" |
263 " @code{classical}.", | 259 " @code{classical}.", |
264 | 260 |
265 /* properties */ | 261 /* properties */ |
266 "direction " | 262 "direction " |
267 "minimum-distance " | 263 "minimum-distance " |
268 "style " | 264 "style " |
269 ); | 265 ); |
LEFT | RIGHT |