- Grob *g = elements[i];
- Skyline_pair skylines;
-
- if (!pure)
- {
- Skyline_pair *skys = Skyline_pair::unsmob (g->get_property (a == Y_AXIS
- ? "vertical-skylines"
- : "horizontal-skylines"));
- if (skys)
- skylines = *skys;
-
- /* This skyline was calculated relative to the grob g. In order to compare it to
- skylines belonging to other grobs, we need to shift it so that it is relative
- to the common reference. */
- Real offset = g->relative_coordinate (other_common, other_axis (a));
- skylines.shift (offset);
- }
- else if (!(*skip_elt)[i])
+ Skyline_pair *skys = unsmob<Skyline_pair> (g->get_property (a == Y_AXIS
+ ? "vertical-skylines"
+ : "horizontal-skylines"));
+ if (skys)
+ skylines = *skys;
+
+ /* This skyline was calculated relative to the grob g. In order to compare it to
+ skylines belonging to other grobs, we need to shift it so that it is relative
+ to the common reference. */
+ Real offset = g->relative_coordinate (other_common, other_axis (a));
+ skylines.shift (offset);
+ }
+ else if (Hara_kiri_group_spanner::request_suicide (g, start, end))
+ return skylines;
+ else
+ {
+ assert (a == Y_AXIS);
+ Interval extent = g->pure_y_extent (g, start, end);
+
+ // This is a hack to get better accuracy on the pure-height of VerticalAlignment.
+ // It's quite common for a treble clef to be the highest element of one system
+ // and for a low note (or lyrics) to be the lowest note on another. The two will
+ // never collide, but the pure-height stuff only works with bounding boxes, so it
+ // doesn't know that. The result is a significant over-estimation of the pure-height,
+ // especially on systems with many staves. To correct for this, we build a skyline
+ // in two parts: the part we did above contains most of the grobs (note-heads, etc.)
+ // while the bit we're about to do only contains the breakable grobs at the beginning
+ // of the system. This way, the tall treble clefs are only compared with the treble
+ // clefs of the other staff and they will be ignored if the staff above is, for example,
+ // lyrics.
+ if (has_interface<Axis_group_interface> (g))