--- /dev/null
+\version "2.15.18"
+
+\header {
+ texidoc = "half rests should lie on a staff line, whole rests should hang
+ from a staff line by default even for non-standard staves, except when
+ the position is set by pitch."
+}
+
+
+\layout {
+ ragged-right = ##t
+ indent = 0.0
+}
+
+\new StaffGroup <<
+ \new Staff {
+ r2
+ g'2\rest
+ r1
+ g'1\rest
+ }
+
+ \new Staff {
+ \override Staff.StaffSymbol #'line-positions = #'(-4 -2 0 2)
+ r2
+ g'2\rest
+ r1
+ g'1\rest
+ }
+
+ \new Staff {
+ \override Staff.StaffSymbol #'line-count = #4
+ r2
+ g'2\rest
+ r1
+ g'1\rest
+ }
+>>
Real ss = Staff_symbol_referencer::staff_space (me);
bool position_override = scm_is_number (me->get_property ("staff-position"));
- Real amount = robust_scm2double (me->get_property ("staff-position"), 0)
- * 0.5 * ss;
+ Real amount;
- if (line_count % 2)
+ if (position_override)
{
- if (duration_log == 0 && line_count > 1)
- amount += ss;
+ amount =
+ robust_scm2double (me->get_property ("staff-position"), 0) * 0.5 * ss;
+ /*
+ trust the client on good positioning;
+ would be tempting to adjust position of rests longer than a quarter
+ to be properly aligned to staff lines,
+ but custom rest shapes may not need that sort of care.
+ */
}
else
- amount += ss / 2;
+ {
+ amount = 2 * ss * get_grob_direction (me);
- if (!position_override)
- amount += 2 * ss * get_grob_direction (me);
+ if (line_count % 2 == 0)
+ amount += ss / 2;
+ }
+
+ /*
+ make a semibreve rest hang from the next line,
+ except for a single line staff
+ */
+ if (duration_log == 0 && line_count > 1)
+ amount += ss;
return scm_from_double (amount);
}