Add outside-staff-padding.
Fix outside-staff positioning for grobs whose parent is System.
\include "mozart-hrn3-rondo.ily"
\paper {
- between-system-padding = 0.0
between-system-space = 20 \mm
}
return rank_1 < rank_2;
}
+static void
+add_boxes (Grob *me, Grob *x_common, Grob *y_common, vector<Box> *const boxes)
+{
+ if (Axis_group_interface::has_interface (me)
+ && Axis_group_interface::has_axis (me, Y_AXIS))
+ {
+ Grob_array *elements = unsmob_grob_array (me->get_object ("elements"));
+ if (elements)
+ for (vsize i = 0; i < elements->size (); i++)
+ add_boxes (elements->grob (i), x_common, y_common, boxes);
+ }
+ else
+ boxes->push_back (Box (me->extent (x_common, X_AXIS),
+ me->extent (y_common, Y_AXIS)));
+}
+
void
Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
{
for (i = 0; i < elements.size ()
&& !scm_is_number (elements[i]->get_property ("outside-staff-priority")); i++)
- boxes.push_back (Box (elements[i]->extent (x_common, X_AXIS),
- elements[i]->extent (y_common, Y_AXIS)));
-
+ add_boxes (elements[i], x_common, y_common, &boxes);
Drul_array<Skyline> skylines (Skyline (boxes, X_AXIS, DOWN),
Skyline (boxes, X_AXIS, UP));
Box b (elements[i]->extent (x_common, X_AXIS),
elements[i]->extent (y_common, Y_AXIS));
+ if (b[X_AXIS].is_empty () || b[Y_AXIS].is_empty ())
+ {
+ warning (_f ("outside-staff object %s has an empty extent", elements[i]->name ().c_str ()));
+ continue;
+ }
+
boxes.clear ();
boxes.push_back (b);
Skyline other = Skyline (boxes, X_AXIS, -dir);
- Real dist = skylines[dir].distance (other);
+ Real padding = robust_scm2double (elements[i]->get_property ("outside-staff-padding"), 0.5);
+ Real dist = skylines[dir].distance (other) + padding;
if (dist > 0)
{
(non-musical ,boolean? "True if the grob belongs in a NonMusicalPaperColumn.")
(number-type ,symbol? "Type of numbers to use in label. Choices
include @code{roman-lower}, @code{roman-upper}, and @code{arabic}.")
+ (outside-staff-padding ,number? "The padding to place between this grob and the staff when
+spacing according to outside-staff-priority.")
(outside-staff-priority ,number? "When set, the grob will be positioned outside the staff
in such a way as to avoid all collisions. In case of a potential collision, the grob with
the smaller outside-staff-priority will be closer to the staff.")
(minimum-space . 1.2)
(direction . ,DOWN)
(side-axis . ,Y)
+ (outside-staff-priority . 250)
(Y-extent . ,ly:axis-group-interface::height)
(X-extent . ,ly:axis-group-interface::width)
(meta . ((class . Spanner)
(avoid-slur . around)
(no-spacing-rods . #t)
(script-priority . 100)
+ (outside-staff-priority . 300)
(meta . ((class . Item)
(interfaces . (font-interface
text-interface
(dash-fraction . 0.3)
(edge-height . (0 . 1.2))
(direction . ,UP)
+ (outside-staff-priority . 400)
(meta . ((class . Spanner)
(interfaces . (ottava-bracket-interface
horizontal-bracket-interface
(break-visibility . ,end-of-line-invisible)
(break-align-symbol . staff-bar)
(padding . 0.8)
+ (outside-staff-priority . 1000)
(meta . ((class . Item)
(interfaces . (text-interface
side-position-interface
(SeparationItem
. (
(avoid-slur . inside)
- (skylines . ,ly:separation-item::calc-skylines)
(X-extent . ,ly:axis-group-interface::width)
(Y-extent . ,ly:axis-group-interface::height)
(meta . ((class . Item)
(stencil . ,ly:text-interface::print)
(direction . ,ly:script-interface::calc-direction)
+ (outside-staff-priority . 450)
(avoid-slur . around)
(slur-padding . 0.5)
(script-priority . 200)
(dash-period . 3.0)
(side-axis . ,Y)
(direction . ,UP)
+ (outside-staff-priority . 350)
(meta . ((class . Spanner)
(interfaces . (text-spanner-interface
line-spanner-interface
(direction . ,UP)
(Y-offset . ,ly:side-position-interface::y-aligned-side)
(side-axis . ,Y)
+ (outside-staff-priority . 50)
(meta . ((class . Spanner)
(interfaces . (text-spanner-interface
line-spanner-interface
(edge-height . (2.0 . 2.0)) ;; staff-space;
(minimum-space . 5)
(font-size . -4)
+ (outside-staff-priority . 100)
(meta . ((class . Spanner)
(interfaces . (volta-bracket-interface
horizontal-bracket-interface