texidoc = "In polyphonic situations, rests are moved according
to their @code{direction} even if there is no opposite note or rest.
-The amount is two @code{staff-space}s. "
+The amount in @code{staff-position}s is set by @code{voiced-position}."
}
\new Staff \relative c' {
<< { r8 g''4 g8 r g4 g8 } \\
{ d,4 r \stemUp b r } >>
+ \override Staff.Rest.voiced-position = 2
+ << { r8 g''4 g8 r g4 g8 } \\
+ { d,4 r \stemUp b r } >>
}
return pos;
}
- pos = 4 * dir;
+ Real vpos = dir * robust_scm2int (me->get_property ("voiced-position"), 0);
+ pos = vpos;
if (duration_log > 1)
/* Only half notes or longer want alignment with staff lines */
return pos;
-
+
/*
We need a staff symbol for actually aligning anything
*/
if (linepos.empty ())
return pos;
-
+
std::sort (linepos.begin (), linepos.end ());
-
+
if (duration_log == 0)
{
/*
make a semibreve rest hang from the next available line,
except when there is none.
*/
-
+
std::vector<Real>::const_iterator it
= std::upper_bound (linepos.begin (), linepos.end (), pos);
if (it != linepos.end ())
return pos;
/* If we have a voiced position, make sure that it's on the
- proper side of neutral before using it. If it isn't, we fall
- back to a constant offset from neutral position.
+ proper side of neutral before using it.
*/
Real neutral = staff_position_internal (me, duration_log, 0);
if (dir * (pos - neutral) > 0)
return pos;
-
- return neutral + 4 * dir;
+ else
+ return neutral + vpos;
}
/* A rest might lie under a beam, in which case it should be cross-staff if
"direction "
"minimum-distance "
"style "
+ "voiced-position "
);
;;;
(vertical-skylines ,ly:skyline-pair? "Two skylines, one above and
one below this grob.")
+ (voiced-position ,number? "The staff-position of a voiced
+@code{Rest}, negative if the rest has @code{direction} @code{DOWN}.")
;;;
;;; w
(thick-thickness . 6.6)
;; See Wanske pp. 125
(usable-duration-logs . ,(iota 4 -3))
+ (voiced-position . 4)
(Y-extent . ,(ly:make-unpure-pure-container ly:multi-measure-rest::height))
(Y-offset . ,staff-symbol-referencer::callback)
(meta . ((class . Spanner)
(duration-log . ,stem::calc-duration-log)
(minimum-distance . 0.25)
(stencil . ,ly:rest::print)
+ (voiced-position . 4)
(X-extent . ,ly:rest::width)
(Y-extent . ,(ly:make-unpure-pure-container ly:rest::height ly:rest::pure-height))
(Y-offset . ,(ly:make-unpure-pure-container ly:rest::y-offset-callback))