From: Joe Neeman Date: Wed, 27 Jun 2007 04:26:25 +0000 (+0300) Subject: fix spacing regressions up to spacing-folded-clef X-Git-Tag: release/2.11.28-1~21^2~22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=05c3c270b564b93c70ac320a20e2a671db527f7f;p=lilypond.git fix spacing regressions up to spacing-folded-clef --- diff --git a/lily/include/spacing-interface.hh b/lily/include/spacing-interface.hh index e670d8a0fa..14b8c2bf03 100644 --- a/lily/include/spacing-interface.hh +++ b/lily/include/spacing-interface.hh @@ -18,6 +18,7 @@ struct Spacing_interface static vector left_note_columns (Grob *me); static Item* right_column (Grob *me); static Item* left_column (Grob *me); + static Drul_array skylines (Grob *me, Grob *right_col); DECLARE_GROB_INTERFACE(); }; diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 6577fa7085..61af354f4c 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -65,8 +65,16 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, the full amount of space. We give them half the amount of space, but then adjust things so there are no collisions. */ - Real min_dist = Spacing_interface::minimum_distance (me, right_col); + Drul_array skys = Spacing_interface::skylines (me, right_col); + Real min_dist = max (0.0, skys[LEFT].distance (skys[RIGHT])); Real min_desired_space = left_head_end + (min_dist - left_head_end) / 2; + + /* if the right object sticks out a lot, include a bit of extra space. + But only for non-musical-columns; this shouldn't apply to accidentals */ + if (!Paper_column::is_musical (right_col)) + min_desired_space = max (min_desired_space, + left_head_end + LEFT * skys[RIGHT].max_height ()); + Real ideal = base_space - increment + min_desired_space; stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space); diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index 4b30033601..8e0722438e 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -81,7 +81,7 @@ Real Simple_spacer::rod_force (int l, int r, Real dist) { Real d = range_ideal_len (l, r); - Real c = range_stiffness (l, r, d > dist); + Real c = range_stiffness (l, r, dist > d); Real block_stretch = dist - d; return c * block_stretch; } diff --git a/lily/spacing-interface.cc b/lily/spacing-interface.cc index 6b0964df1e..dbfe4e43c6 100644 --- a/lily/spacing-interface.cc +++ b/lily/spacing-interface.cc @@ -18,10 +18,11 @@ #include "separation-item.hh" #include "skyline.hh" -/* return the minimum distance between the left-items and the right-items of - this spacing object */ -Real -Spacing_interface::minimum_distance (Grob *me, Grob *right_col) +/* return the right-pointing skyline of the left-items and the left-pointing + skyline of the right-items (with the skyline of the left-items in + ret[LEFT]) */ +Drul_array +Spacing_interface::skylines (Grob *me, Grob *right_col) { /* the logic here is a little convoluted. A {Staff,Note}_spacing doesn't copy left-items when it clones, @@ -65,6 +66,14 @@ Spacing_interface::minimum_distance (Grob *me, Grob *right_col) } while (flip (&d) != LEFT); + return skylines; +} + +Real +Spacing_interface::minimum_distance (Grob *me, Grob *right) +{ + Drul_array skylines = Spacing_interface::skylines (me, right); + return max (0.0, skylines[LEFT].distance (skylines[RIGHT])); }