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 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.
@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
line.extent_ = extent;
line.padding_ = padding;
line.space_ = space;
- line.inverse_hooke_ = 1;
+ line.inverse_hooke_ = extent.length () + space;
}
}
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");
/* 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_;
}
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;
}
{
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_;
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)
force[b * breaks.size () + c] = infinity_f;
break;
}
+ if (end < cols.size () && cols[end].break_permission_ == force_break)
+ break;
}
}
return force;