summaryrefslogtreecommitdiff
path: root/lily/simple-spacer.cc
diff options
context:
space:
mode:
authorJoe Neeman <joeneeman@gmail.com>2006-07-24 11:50:27 +0000
committerJoe Neeman <joeneeman@gmail.com>2006-07-24 11:50:27 +0000
commita732d02103df02d413b35dae436c38db538e9fd1 (patch)
treea02f4d32cb4baca368a31aa87524524680a486aa /lily/simple-spacer.cc
parente648ca6f329b1c11a5f8fda5f93950fffc6a63cf (diff)
* scm/define-grobs.scm (all-grob-descriptions): make NonMusicalPaperColumn
page-breakable by default * scm/layout-page-layout.scm (space-systems): fix bug where the force isn't correctly calculated for a single-system page * scm/lily-library.scm (interval-sane?): check that the first number is no bigger than the second number * lily/simple-spacer.cc (solve): allow compression even when ragged (but we acknowledge that we aren't satisfying constraints) * lily/hara-kiri-group-spanner.cc (request_suicide): give equal treatment to non-Items * lily/grob.cc (pure_height): add minimum-Y-extent * lily/gourlay-breaking.cc (solve): don't ignore a compression force, even if we're ragged * lily/constrained-breaking.cc: convert code to use new Matrix class (get_best_solution): new function * scm/page.scm (make-page-stencil): don't crash if we annotate-layout when there is a page with no systems
Diffstat (limited to 'lily/simple-spacer.cc')
-rw-r--r--lily/simple-spacer.cc28
1 files changed, 15 insertions, 13 deletions
diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc
index 3532c03606..3b3eaed3ba 100644
--- a/lily/simple-spacer.cc
+++ b/lily/simple-spacer.cc
@@ -147,18 +147,13 @@ Simple_spacer::solve (Real line_len, bool ragged)
ragged_ = ragged;
line_len_ = line_len;
- if (ragged)
- {
- force_ = 0;
- fits_ = configuration_length (force_) <= line_len_;
- /* we need to calculate a force here to prevent a bunch of short lines */
- if (fits_)
- force_ = expand_line ();
- }
- else if (conf < line_len_)
+ if (conf < line_len_)
force_ = expand_line ();
else if (conf > line_len_)
force_ = compress_line ();
+
+ if (ragged && force_ < 0)
+ fits_ = false;
}
Real
@@ -248,7 +243,7 @@ Simple_spacer::spring_positions () const
ret.push_back (0.);
for (vsize i = 0; i < springs_.size (); i++)
- ret.push_back (ret.back () + springs_[i].length (ragged_ ? 0.0 : force_));
+ ret.push_back (ret.back () + springs_[i].length (ragged_ && force_ > 0 ? 0.0 : force_));
return ret;
}
@@ -456,7 +451,7 @@ get_line_forces (vector<Grob*> const &icols, vector<vsize> breaks,
if (!is_loose (icols[i]))
cols.push_back (get_column_description (icols, i, false));
}
- breaks.back () = cols.size () - 1;
+ breaks.back () = cols.size ();
for (vsize b = 0; b < breaks.size () - 1; b++)
{
@@ -488,9 +483,16 @@ get_line_forces (vector<Grob*> const &icols, vector<vsize> breaks,
}
}
spacer.solve ((b == 0) ? line_len - indent : line_len, ragged);
- force[b * breaks.size () + c] = spacer.force ();
- if (cols[end].break_permission_ == force_break)
+ /* add a (convex) penalty for compression. We do this _only_ in get_line_forces,
+ not get_line_configuration. This is temporary, for backwards compatibility;
+ the old line/page-breaking stuff ignores page breaks when it calculates line
+ breaks, so compression penalties can result in scores (eg. wtk-fugue) blowing
+ up to too many pages. */
+ Real f = spacer.force ();
+ force[b * breaks.size () + c] = f - (f < 0 ? f*f*6 : 0);
+
+ if (end < cols.size () && cols[end].break_permission_ == force_break)
break;
if (!spacer.fits ())
{