diff options
author | Joe Neeman <joeneeman@gmail.com> | 2006-10-18 18:21:39 +0000 |
---|---|---|
committer | Joe Neeman <joeneeman@gmail.com> | 2006-10-18 18:21:39 +0000 |
commit | b28e9210357c348c1007ad793422b322e70d80f8 (patch) | |
tree | da4e795b2250c36e2f9f9718cfa4330583c48ee5 | |
parent | eed800bef73fc595e1d74e1fd5f0f5eda600ff66 (diff) |
* lily/simple-spacer.cc (get_line_forces): test for non-fitting
line even if we precede a forced break.
* lily/optimal-page-breaking.cc (try_page_spacing): square line
forces too. Make page-spacing weight default to 10 because the
changes to vertical springs decreased the page force/line force
proportions. Also, take the average of line force and page force
instead of just the sum.
* lily/constrained-breaking.cc (initialize): make the stiffness
of the vertical springs depend on the height of the system. This
prevents pages with only a few large systems from getting huge
forces
* Documentation/user/page.itely (Page formatting): document the
change in default page-spacing-weight
* lily/include/constrained-breaking.hh: initialise bottom_padding_
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | Documentation/user/page.itely | 2 | ||||
-rw-r--r-- | lily/constrained-breaking.cc | 2 | ||||
-rw-r--r-- | lily/include/constrained-breaking.hh | 1 | ||||
-rw-r--r-- | lily/optimal-page-breaking.cc | 12 | ||||
-rw-r--r-- | lily/page-turn-page-breaking.cc | 2 | ||||
-rw-r--r-- | lily/simple-spacer.cc | 4 |
7 files changed, 37 insertions, 7 deletions
@@ -1,3 +1,24 @@ +2006-10-18 Joe Neeman <joeneeman@gmail.com> + + * lily/simple-spacer.cc (get_line_forces): test for non-fitting + line even if we precede a forced break. + + * lily/optimal-page-breaking.cc (try_page_spacing): square line + forces too. Make page-spacing weight default to 10 because the + changes to vertical springs decreased the page force/line force + proportions. Also, take the average of line force and page force + instead of just the sum. + + * lily/constrained-breaking.cc (initialize): make the stiffness + of the vertical springs depend on the height of the system. This + prevents pages with only a few large systems from getting huge + forces + + * Documentation/user/page.itely (Page formatting): document the + change in default page-spacing-weight + + * lily/include/constrained-breaking.hh: initialise bottom_padding_ + 2006-10-18 Han-Wen Nienhuys <hanwen@lilypond.org> * input/typography-demo.ly (melody): remove superfluous slur. diff --git a/Documentation/user/page.itely b/Documentation/user/page.itely index 4f0b451755..5fe418b596 100644 --- a/Documentation/user/page.itely +++ b/Documentation/user/page.itely @@ -267,7 +267,7 @@ Default value is 0. @item page-spacing-weight The relative importance of page (vertical) spacing and line (horizontal) spacing. High values will make page spacing more important. Default -value is 1. +value is 10. @funindex auto-first-page-number @item auto-first-page-number diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index b8253ac4e9..40d4c1177f 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -365,7 +365,7 @@ Constrained_breaking::initialize () line.extent_ = extent; line.padding_ = padding; line.space_ = space; - line.inverse_hooke_ = 1; + line.inverse_hooke_ = extent.length () + space; } } diff --git a/lily/include/constrained-breaking.hh b/lily/include/constrained-breaking.hh index 56c673705d..e1401f1614 100644 --- a/lily/include/constrained-breaking.hh +++ b/lily/include/constrained-breaking.hh @@ -49,6 +49,7 @@ struct Line_details { force_ = 0; extent_ = unsmob_stencil (pb->get_property ("stencil")) ->extent (Y_AXIS); padding_ = 0; + bottom_padding_ = 0; space_ = 1.0; inverse_hooke_ = 1.0; break_permission_ = ly_symbol2scm ("allow"); diff --git a/lily/optimal-page-breaking.cc b/lily/optimal-page-breaking.cc index 03d72629a0..21fb841d66 100644 --- a/lily/optimal-page-breaking.cc +++ b/lily/optimal-page-breaking.cc @@ -50,11 +50,11 @@ Optimal_page_breaking::try_page_spacing (Line_division const &line_count) /* add in the line penalties */ Real line_force = 0; Real line_penalty = 0; - Real page_weighting = robust_scm2double (book_->paper_->c_variable ("page-spacing-weight"), 1); + Real page_weighting = robust_scm2double (book_->paper_->c_variable ("page-spacing-weight"), 10); for (vsize i = 0; i < lines.size (); i++) { - line_force += fabs (lines[i].force_); + line_force += lines[i].force_ * lines[i].force_; line_penalty += lines[i].break_penalty_; } @@ -65,6 +65,14 @@ Optimal_page_breaking::try_page_spacing (Line_division const &line_count) ret.demerits_ += (ret.force_[i] * ret.force_[i] + uniformity * uniformity) * page_weighting; } + + /* If ragged_last is true, the last page will have + zero force no matter what. In this case, we exclude it from the average or + we will become biased towards scores with less pages (because the force + of zero will affect the average more when there are fewer pages) */ + if (!ragged_last || ret.force_.size () > 1) + ret.demerits_ /= ret.force_.size () - (ragged_last ? 1 : 0); + line_force /= lines.size (); ret.demerits_ += line_force + line_penalty; return ret; } diff --git a/lily/page-turn-page-breaking.cc b/lily/page-turn-page-breaking.cc index e60ccfe033..81cfab9cac 100644 --- a/lily/page-turn-page-breaking.cc +++ b/lily/page-turn-page-breaking.cc @@ -38,7 +38,7 @@ Page_turn_page_breaking::calc_demerits (const Break_node &me) { Real prev_f = 0; Real prev_dem = 0; - Real page_weighting = robust_scm2double (book_->paper_->c_variable ("page-spacing-weight"), 1); + Real page_weighting = robust_scm2double (book_->paper_->c_variable ("page-spacing-weight"), 10); if (me.prev_ != VPOS) { prev_f = state_[me.prev_].force_; diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index bb4104678a..3aa4bc001c 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -479,8 +479,6 @@ get_line_forces (vector<Grob*> const &columns, Real f = spacer.force (); force[b * breaks.size () + c] = f - (f < 0 ? f*f*f*f*4 : 0); - if (end < cols.size () && cols[end].break_permission_ == force_break) - break; if (!spacer.fits ()) { if (c == b + 1) @@ -489,6 +487,8 @@ get_line_forces (vector<Grob*> const &columns, force[b * breaks.size () + c] = infinity_f; break; } + if (end < cols.size () && cols[end].break_permission_ == force_break) + break; } } return force; |