]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix issue 3868: line-breaking makes short lines
authorKeith OHara <k-ohara5a5a@oco.net>
Sat, 8 Mar 2014 14:45:20 +0000 (15:45 +0100)
committerJanek Warchoł <lemniskata.bernoullego@gmail.com>
Sat, 8 Mar 2014 14:45:20 +0000 (15:45 +0100)
Two simple fixes:
1) Always have some stretchability between notes
2) If there _is_ a completely unstretchable line, shorter than the line-width,
   score it as a bad fit, not as a perfect fit (report large forces for stiff lines).

Either one would fix the problem; both seem to be good to have in the code.

lily/simple-spacer.cc
lily/spacing-basic.cc

index f3aee719970d079305e12a6e3eed8504f09fe797..2eb545756fd5538f20ce5a47e44c1c7582af3017 100644 (file)
@@ -193,7 +193,7 @@ Simple_spacer::expand_line ()
     inv_hooke += springs_[i].inverse_stretch_strength ();
 
   if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */
-    return 0.0;         /* anyway, then it makes no difference what the force is */
+    inv_hooke = 1e-6;   /* then report a very large stretching force */
 
   assert (cur_len <= line_len_);
   return (line_len_ - cur_len) / inv_hooke + force_;
index 97868f9bedeb21e9915ddaa0564ef6a5b6751b93..df9f9ecec8db19b4cbe8a61e2ae1c4f8587db8bc 100644 (file)
@@ -157,7 +157,7 @@ Spacing_spanner::note_spacing (Grob * /* me */,
       ret = Spring (fraction * len, fraction * min);
 
       // Stretch proportional to the space between canonical bare noteheads
-      ret.set_inverse_stretch_strength (fraction * max (0.0, (len - min)));
+      ret.set_inverse_stretch_strength (fraction * max (0.1, (len - min)));
     }
   else if (delta_t.grace_part_)
     {