From 3a5ba68c4200ce392683436b36e2e4ee493b78c3 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Mon, 24 Aug 2009 14:03:50 -0700 Subject: [PATCH] Use the full pure Y-extent for complete systems. For staves within a system, we split up the pure Y-extent into the Y-extent of the prefatory matter and the Y-extent of the rest (thereby emulating a crude skyline). Between systems, we use a single extent box. Before this commit, we were ignoring the Y-extent of the prefatory matter altogether; now the extent box is correct. --- lily/align-interface.cc | 16 +++++++++------- lily/axis-group-interface.cc | 9 +++++++++ lily/constrained-breaking.cc | 6 ++++++ lily/include/axis-group-interface.hh | 1 + 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 2931043303..3d68bce912 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -89,13 +89,6 @@ get_skylines (Grob *me, { assert (a == Y_AXIS); Interval extent = g->pure_height (g, start, end); - if (!extent.is_empty ()) - { - Box b; - b[a] = extent; - b[other_axis (a)] = Interval (0, infinity_f); - skylines.insert (b, 0, other_axis (a)); - } // 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 @@ -111,6 +104,7 @@ get_skylines (Grob *me, if (Axis_group_interface::has_interface (g) && !Hara_kiri_group_spanner::request_suicide (g, start, end)) { + extent = Axis_group_interface::rest_of_line_pure_height (g, start, end); Interval begin_of_line_extent = Axis_group_interface::begin_of_line_pure_height (g, start); if (!begin_of_line_extent.is_empty ()) { @@ -120,6 +114,14 @@ get_skylines (Grob *me, skylines.insert (b, 0, other_axis (a)); } } + + if (!extent.is_empty ()) + { + Box b; + b[a] = extent; + b[other_axis (a)] = Interval (0, infinity_f); + skylines.insert (b, 0, other_axis (a)); + } } if (skylines.is_empty ()) diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 00a8219ec0..396a95857c 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -77,6 +77,15 @@ Axis_group_interface::relative_group_extent (vector const &elts, Interval Axis_group_interface::cached_pure_height (Grob *me, int start, int end) +{ + Interval iv = begin_of_line_pure_height (me, start); + iv.unite (rest_of_line_pure_height (me, start, end)); + + return iv; +} + +Interval +Axis_group_interface::rest_of_line_pure_height (Grob *me, int start, int end) { SCM adjacent_pure_heights = me->get_property ("adjacent-pure-heights"); diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index 8fb24f1eab..98722c53db 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -387,6 +387,12 @@ Constrained_breaking::initialize () line.turn_permission_ = min_permission (line.page_permission_, line.turn_permission_); + // TODO: see the hack regarding begin_of_line and + // rest_of_line extents in align-interface. Perhaps we + // should do the same thing here so that the effect extends + // between systems as well as within systems. It isn't as + // crucial here, however, because the effect is largest when + // dealing with large systems. line.extent_ = (extent.is_empty () || isnan (extent[LEFT]) || isnan (extent[RIGHT])) diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 95aa9f3bc5..0e8aae57b0 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -34,6 +34,7 @@ struct Axis_group_interface static Interval combine_pure_heights (Grob *me, SCM, int, int); static Interval cached_pure_height (Grob *me, int, int); static Interval begin_of_line_pure_height (Grob *me, int); + static Interval rest_of_line_pure_height (Grob *me, int, int); static Grob *calc_pure_elts_and_common (Grob*); static Skyline_pair skyline_spacing (Grob *me, vector elements); -- 2.39.5