]> git.donarmstrong.com Git - lilypond.git/commitdiff
Revert "note-spacing: let compressibility be uniform; issue 3304"
authorDavid Kastrup <dak@gnu.org>
Mon, 17 Feb 2014 15:36:40 +0000 (16:36 +0100)
committerDavid Kastrup <dak@gnu.org>
Mon, 17 Feb 2014 15:36:40 +0000 (16:36 +0100)
This reverts commit f8c25dc32c249eda36f71463967e88d79d88556d.

input/regression/baerenreiter-sarabande.ly
input/regression/spanner-alignment.ly
lily/include/note-spacing.hh
lily/note-spacing.cc

index 892359dfc2a060ad5279d13405b85000597dc06c..426bbf4b180e21be52f415b9e271d3d101341038 100644 (file)
@@ -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
 
index 2b4210841d2c69aebbcf2f0958855e7189abd8cd..02e04ece7dddd98bf094e30c71f5efa10dc79e31 100644 (file)
@@ -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" {
index b8788f92ff42728c58bf405e1e2d237be6668a84..945362ab06583e37e03c07dffbeeee8113b07b3a 100644 (file)
@@ -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 */
index 4f5713c14a1cc6d01567417fd215360492191906..e59aa6ec841f4660148a4e104759aeebae25afea 100644 (file)
 #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<Skyline> 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<Interval> head_posns)
 void
 Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
                                    Real increment,
-                                   Real *space)
+                                   Real *space, Real *fixed)
 {
   Drul_array<Direction> stem_dirs (CENTER, CENTER);
   Drul_array<Interval> 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