]> git.donarmstrong.com Git - lilypond.git/commitdiff
note-spacing: let compressibility be uniform; issue 3304
authorKeith OHara <k-ohara5a5a@oco.net>
Wed, 18 Dec 2013 01:20:22 +0000 (17:20 -0800)
committerKeith OHara <k-ohara5a5a@oco.net>
Sat, 4 Jan 2014 04:20:36 +0000 (20:20 -0800)
Comments implied that half the width of accidentals, etc., was added
to the ideal spacing between notes, but in fact only compressibility
was affected.  The non-uniform compressibility caused note-spacing
to become non-uniform when the lines were compressed.  For example
A sequence {\stemUp a a d a] would have the head of the D tuck under
the preceding A.

This commit keeps spacing uniform on compressed lines until objects
come within padding of each other.

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

index 426bbf4b180e21be52f415b9e271d3d101341038..892359dfc2a060ad5279d13405b85000597dc06c 100644 (file)
@@ -1,6 +1,6 @@
 \version "2.17.6"
 
-forcedLastBreak =  { \break }
+forcedLastBreak =  {} %%  { \break } if needed to match original breaks
 
 %% We want this to perfectly match the Bärenreiter spacing.
 %% If we're not using 6 systems, there's definitely a problem.
@@ -171,10 +171,9 @@ smallerPaper = \layout {
   ragged-bottom = ##t
   indent = 7. \mm
   line-width =183.5 \mm
-  obsolete-between-system-space = 25\mm
-  system-system-spacing #'basic-distance = #(/ obsolete-between-system-space staff-space)
+  system-system-spacing #'basic-distance = 14.22 % 25mm, in staff-spaces
   system-system-spacing #'padding = #0
-  score-system-spacing #'basic-distance = #(/ obsolete-between-system-space staff-space)
+  score-system-spacing #'basic-distance = #0
   score-system-spacing #'padding = #0
   system-count = 6
 
index 02e04ece7dddd98bf094e30c71f5efa10dc79e31..2b4210841d2c69aebbcf2f0958855e7189abd8cd 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
+          s1\cresc s1\f s1\dim s1\p \break
         }
       }
       \new Staff = "down" {
index 945362ab06583e37e03c07dffbeeee8113b07b3a..b8788f92ff42728c58bf405e1e2d237be6668a84 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 *, Real *);
+                                   Real *space);
 };
 
 #endif /* NOTE_SPACING_HH */
index e59aa6ec841f4660148a4e104759aeebae25afea..4f5713c14a1cc6d01567417fd215360492191906 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.
@@ -76,16 +72,11 @@ 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
@@ -99,20 +90,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
         {
-          Real shift = bar->extent (right_col, X_AXIS)[LEFT];
-          ideal -= shift;
-          min_desired_space -= max (shift, 0.0);
+          /* 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);
         }
-      else
-        ideal -= right_col->extent (right_col, X_AXIS)[RIGHT];
     }
 
-  ideal = max (ideal, min_desired_space);
-  stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
+  stem_dir_correction (me, right_col, increment, &ideal);
 
   base.set_distance (max (0.0, ideal));
-  base.set_inverse_compress_strength (max (0.0, ideal - min_desired_space));
   return base;
 }
 
@@ -207,7 +198,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 *fixed)
+                                   Real *space)
 {
   Drul_array<Direction> stem_dirs (CENTER, CENTER);
   Drul_array<Interval> stem_posns;
@@ -311,7 +302,6 @@ 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