From: David Kastrup Date: Mon, 17 Feb 2014 15:36:40 +0000 (+0100) Subject: Revert "note-spacing: let compressibility be uniform; issue 3304" X-Git-Tag: release/2.18.2-1~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=26f07e8c4704b03206e2ca6feb84fb9b4aee511f;p=lilypond.git Revert "note-spacing: let compressibility be uniform; issue 3304" This reverts commit f8c25dc32c249eda36f71463967e88d79d88556d. --- diff --git a/input/regression/baerenreiter-sarabande.ly b/input/regression/baerenreiter-sarabande.ly index 892359dfc2..426bbf4b18 100644 --- a/input/regression/baerenreiter-sarabande.ly +++ b/input/regression/baerenreiter-sarabande.ly @@ -1,6 +1,6 @@ \version "2.17.6" -forcedLastBreak = {} %% { \break } if needed to match original breaks +forcedLastBreak = { \break } %% We want this to perfectly match the Bärenreiter spacing. %% If we're not using 6 systems, there's definitely a problem. @@ -171,9 +171,10 @@ smallerPaper = \layout { ragged-bottom = ##t indent = 7. \mm line-width =183.5 \mm - system-system-spacing #'basic-distance = 14.22 % 25mm, in staff-spaces + obsolete-between-system-space = 25\mm + system-system-spacing #'basic-distance = #(/ obsolete-between-system-space staff-space) system-system-spacing #'padding = #0 - score-system-spacing #'basic-distance = #0 + score-system-spacing #'basic-distance = #(/ obsolete-between-system-space staff-space) score-system-spacing #'padding = #0 system-count = 6 diff --git a/input/regression/spanner-alignment.ly b/input/regression/spanner-alignment.ly index 2b4210841d..02e04ece7d 100644 --- a/input/regression/spanner-alignment.ly +++ b/input/regression/spanner-alignment.ly @@ -16,7 +16,7 @@ ignoring things like pedal marks. } \new Dynamics = "dynamics" { \repeat unfold 2 { - s1\cresc s1\f s1\dim s1\p \break + s1\cresc s1\f s1\dim s1\p } } \new Staff = "down" { diff --git a/lily/include/note-spacing.hh b/lily/include/note-spacing.hh index b8788f92ff..945362ab06 100644 --- a/lily/include/note-spacing.hh +++ b/lily/include/note-spacing.hh @@ -31,7 +31,7 @@ public: static Spring get_spacing (Grob *me, Item *, Spring, Real); static void stem_dir_correction (Grob *me, Item *next_col, Real incr, - Real *space); + Real *, Real *); }; #endif /* NOTE_SPACING_HH */ diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 4f5713c14a..e59aa6ec84 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -35,6 +35,10 @@ #include "stem.hh" #include "warn.hh" +/* + TODO: detect hshifts due to collisions, and account for them in + spacing? +*/ /* Adjust the ideal and minimum distance between note columns, based on the notehead size, skylines, and optical illusions. @@ -72,11 +76,16 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, The main factor that determines the amount of space is the width of the note head (or the rest). For example, a quarter rest gets almost 0.5 ss less horizontal space than a note. + + The other parts of a note column (eg. flags, accidentals, etc.) don't get + the full amount of space. We give them half the amount of space, but then + adjust things so there are no collisions. */ Real ideal = base.distance () - increment + left_head_end; Drul_array skys = Spacing_interface::skylines (me, right_col); Real distance = skys[LEFT].distance (skys[RIGHT], robust_scm2double (right_col->get_property ("skyline-vertical-padding"), 0.0)); Real min_dist = max (0.0, distance); + Real min_desired_space = (ideal + min_dist) / 2; base.set_min_distance (min_dist); /* If we have a NonMusical column on the right, we measure the ideal distance @@ -90,20 +99,20 @@ Note_spacing::get_spacing (Grob *me, Item *right_col, Bar_line::non_empty_barline); if (bar) - ideal -= bar->extent (right_col, X_AXIS)[LEFT]; - else { - /* Measure ideal distance to the right side of the NonMusical column - but keep at least half the gap we would have had to a note */ - Real min_desired_space = (ideal + min_dist) / 2.0; - ideal -= right_col->extent (right_col, X_AXIS)[RIGHT]; - ideal = max (ideal, min_desired_space); + Real shift = bar->extent (right_col, X_AXIS)[LEFT]; + ideal -= shift; + min_desired_space -= max (shift, 0.0); } + else + ideal -= right_col->extent (right_col, X_AXIS)[RIGHT]; } - stem_dir_correction (me, right_col, increment, &ideal); + ideal = max (ideal, min_desired_space); + stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space); base.set_distance (max (0.0, ideal)); + base.set_inverse_compress_strength (max (0.0, ideal - min_desired_space)); return base; } @@ -198,7 +207,7 @@ same_direction_correction (Grob *note_spacing, Drul_array head_posns) void Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn, Real increment, - Real *space) + Real *space, Real *fixed) { Drul_array stem_dirs (CENTER, CENTER); Drul_array stem_posns; @@ -302,6 +311,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn, && !acc_right) correction = same_direction_correction (me, head_posns); + *fixed += correction; *space += correction; /* there used to be a correction for bar_xextent () here, but