]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/simple-spacer.cc (get_line_forces): test for non-fitting
authorJoe Neeman <joeneeman@gmail.com>
Wed, 18 Oct 2006 18:21:39 +0000 (18:21 +0000)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 18 Oct 2006 18:21:39 +0000 (18:21 +0000)
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_

ChangeLog
Documentation/user/page.itely
lily/constrained-breaking.cc
lily/include/constrained-breaking.hh
lily/optimal-page-breaking.cc
lily/page-turn-page-breaking.cc
lily/simple-spacer.cc

index 5bd5063b73527a7fcb28f2818f4422537c8fe42d..a08deedacf1a57b917160d8b2e078dbc751213da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 4f0b45175501d206a25a83b816519b3927b7bee7..5fe418b596bb8e9dc2df8df92015b185e0aba24d 100644 (file)
@@ -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
index b8253ac4e93ce5b0a3970393c29b991938745071..40d4c1177f508e70c523e3fe92c72340024cc4db 100644 (file)
@@ -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;
        }
     }
 
index 56c673705de4e6e79b049e45d9af149db767d9f5..e1401f161479ef65436ee4bfb9d244b381d29d5f 100644 (file)
@@ -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");
index 03d72629a01ea7c080345614e2a44cb5a09440cf..21fb841d6635b80477f8dc863ec50b24f5b70931 100644 (file)
@@ -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;
 }
index e60ccfe03396e246026675b90fc23c3b19e20a16..81cfab9cac70f8263e78036fe9d86d33d2d0d1b2 100644 (file)
@@ -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_;
index bb4104678a0aae8d0da4c868f30da383157bce94..3aa4bc001cf50547673ad349d29e7cfa813718d5 100644 (file)
@@ -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;