From 34b520c618ed0009f553539bda09093fc154a380 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Sat, 8 Mar 2014 15:45:20 +0100 Subject: [PATCH] Fix issue 3868: line-breaking makes short lines 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 | 2 +- lily/spacing-basic.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index f3aee71997..2eb545756f 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -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_; diff --git a/lily/spacing-basic.cc b/lily/spacing-basic.cc index 97868f9bed..df9f9ecec8 100644 --- a/lily/spacing-basic.cc +++ b/lily/spacing-basic.cc @@ -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_) { -- 2.39.5