summaryrefslogtreecommitdiff
path: root/lily
diff options
context:
space:
mode:
authorJoe Neeman <joeneeman@gmail.com>2006-10-18 18:21:39 +0000
committerJoe Neeman <joeneeman@gmail.com>2006-10-18 18:21:39 +0000
commitb28e9210357c348c1007ad793422b322e70d80f8 (patch)
treeda4e795b2250c36e2f9f9718cfa4330583c48ee5 /lily
parenteed800bef73fc595e1d74e1fd5f0f5eda600ff66 (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_
Diffstat (limited to 'lily')
-rw-r--r--lily/constrained-breaking.cc2
-rw-r--r--lily/include/constrained-breaking.hh1
-rw-r--r--lily/optimal-page-breaking.cc12
-rw-r--r--lily/page-turn-page-breaking.cc2
-rw-r--r--lily/simple-spacer.cc4
5 files changed, 15 insertions, 6 deletions
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;