]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-layout-problem.cc
Fix page-count with systems-per-page.
[lilypond.git] / lily / page-layout-problem.cc
index 4f035d72794617ba3bd144f8cf187046392b41db..673278f69c6fc9490ab118d406610531064b6d9e 100644 (file)
@@ -310,13 +310,20 @@ Page_layout_problem::solve_rod_spring_problem (bool ragged)
 
   if (!spacer.fits ())
     {
-      Real overflow = spacer.configuration_length (spacer.force ()) - page_height_;
-      vsize space_count = solution_.size ();
-      for (vsize i = 0; i < space_count; i++)
-       solution_[i] -= (i + 1) * overflow / space_count;
-      warning (_f ("couldn't fit music on page: overflow is %f",
-                   overflow));
-      warning (_ ("compressing music to fit"));
+      Real overflow = spacer.configuration_length (spacer.force ())
+                     - page_height_;
+      if (ragged && overflow < 1e-6)
+       warning (_ ("couldn't fit music on page: ragged-spacing was requested, but page was compressed"));
+      else
+       {
+         warning (_f ("couldn't fit music on page: overflow is %f",
+                      overflow));
+         warning (_ ("compressing music to fit"));
+         vsize space_count = solution_.size ();
+         Real spacing_increment = overflow / (space_count - 2);
+         for (vsize i = 2; i < space_count; i++)
+           solution_[i] -= (i-1) * spacing_increment;
+       }
     }
 }
 
@@ -650,7 +657,7 @@ Page_layout_problem::get_fixed_spacing (Grob *before, Grob *after, int spaceable
   Real stretchability = 0;
   if (Page_layout_problem::read_spacing_spec (spec, &stretchability, ly_symbol2scm ("stretchability"))
       && stretchability == 0)
-    Page_layout_problem::read_spacing_spec (spec, &ret, ly_symbol2scm ("space"));
+    Page_layout_problem::read_spacing_spec (spec, &ret, ly_symbol2scm ("basic-distance"));
 
   // If we're pure, then paper-columns have not had their systems set,
   // and so elts[i]->get_system () is unreliable.
@@ -750,7 +757,7 @@ Page_layout_problem::alter_spring_from_spacing_spec (SCM spec, Spring* spring)
   Real space;
   Real stretch;
   Real min_dist;
-  if (read_spacing_spec (spec, &space, ly_symbol2scm ("space")))
+  if (read_spacing_spec (spec, &space, ly_symbol2scm ("basic-distance")))
     spring->set_distance (space);
   if (read_spacing_spec (spec, &min_dist, ly_symbol2scm ("minimum-distance")))
     spring->set_min_distance (min_dist);