]> git.donarmstrong.com Git - lilypond.git/commitdiff
Account for title spacing in page breaking.
authorJoe Neeman <joeneeman@gmail.com>
Wed, 3 Nov 2010 02:11:48 +0000 (19:11 -0700)
committerJoe Neeman <joeneeman@gmail.com>
Fri, 5 Nov 2010 22:12:17 +0000 (15:12 -0700)
lily/constrained-breaking.cc
lily/include/constrained-breaking.hh
lily/page-spacing.cc

index ba3fc4d5cbecc0080ebdec48431a7ccf674d71ca..dcef2208e336e619396ab7103d255b52fd071289 100644 (file)
@@ -381,6 +381,7 @@ Constrained_breaking::initialize ()
   ragged_right_ = to_boolean (pscore_->layout ()->c_variable ("ragged-right"));
   ragged_last_ = to_boolean (pscore_->layout ()->c_variable ("ragged-last"));
   system_system_space_ = 0;
+  system_markup_space_ = 0;
   system_system_padding_ = 0;
   system_system_min_distance_ = 0;
   score_system_padding_ = 0;
@@ -401,6 +402,10 @@ Constrained_breaking::initialize ()
   Page_layout_problem::read_spacing_spec (page_breaking_spacing_spec,
                                          &system_system_space_,
                                          ly_symbol2scm ("space"));
+  Page_layout_problem::read_spacing_spec (title_spec,
+                                         &system_markup_space_,
+                                         ly_symbol2scm ("space"));
+
   Page_layout_problem::read_spacing_spec (spacing_spec,
                                          &system_system_padding_,
                                          ly_symbol2scm ("padding"));
@@ -413,6 +418,7 @@ Constrained_breaking::initialize ()
   Page_layout_problem::read_spacing_spec (title_spec,
                                          &score_markup_padding_,
                                          ly_symbol2scm ("padding"));
+
   Page_layout_problem::read_spacing_spec (between_scores_spec,
                                          &score_system_min_distance_,
                                          ly_symbol2scm ("minimum-distance"));
@@ -510,6 +516,7 @@ Constrained_breaking::fill_line_details (Line_details *const out, vsize start, v
   out->min_distance_ = last ? score_system_min_distance_ : system_system_min_distance_;
   out->title_min_distance_ = score_markup_min_distance_;
   out->space_ = system_system_space_;
+  out->title_space_ = system_markup_space_;
   out->inverse_hooke_ = out->full_height () + system_system_space_;
 
   out->refpoint_extent_ = sys->pure_refpoint_extent (start_rank, end_rank);
@@ -534,6 +541,10 @@ Line_details::Line_details (Prob *pb, Output_def *paper)
   title_padding_ = 0;
   min_distance_ = 0;
   title_min_distance_ = 0;
+  space_ = 0;
+  title_space_ = 0;
+  Page_layout_problem::read_spacing_spec (spec, &space_, ly_symbol2scm ("space"));
+  Page_layout_problem::read_spacing_spec (title_spec, &title_space_, ly_symbol2scm ("space"));
   Page_layout_problem::read_spacing_spec (spec, &padding_, ly_symbol2scm ("padding"));
   Page_layout_problem::read_spacing_spec (title_spec, &title_padding_, ly_symbol2scm ("padding"));
   Page_layout_problem::read_spacing_spec (spec, &min_distance_, ly_symbol2scm ("minimum-distance"));
@@ -545,7 +556,6 @@ Line_details::Line_details (Prob *pb, Output_def *paper)
   shape_ = Line_shape (stencil_extent, stencil_extent); // pretend it goes all the way across
   tallness_ = 0;
   bottom_padding_ = 0;
-  space_ = 0.0;
   inverse_hooke_ = 1.0;
   break_permission_ = ly_symbol2scm ("allow");
   page_permission_ = pb->get_property ("page-break-permission");
index 63d695dfe36b0a0c36ec012e81019e7e68b95922..4bfdde23fa598adf0c38e1e37590d1a281050bce 100644 (file)
@@ -58,6 +58,7 @@ struct Line_details {
   Real title_min_distance_;
   Real bottom_padding_;
   Real space_;    /* spring length */
+  Real title_space_;
   Real inverse_hooke_;
 
   SCM break_permission_;
@@ -90,6 +91,7 @@ struct Line_details {
     min_distance_ = 0;
     title_min_distance_ = 0;
     space_ = 0;
+    title_space_ = 0;
     inverse_hooke_ = 1;
     tight_spacing_ = false;
     break_permission_ = ly_symbol2scm ("allow");
@@ -164,6 +166,7 @@ private:
   Real system_system_min_distance_;
   Real system_system_padding_;
   Real system_system_space_;
+  Real system_markup_space_;
   Real score_system_min_distance_;
   Real score_system_padding_;
   Real score_markup_min_distance_;
index bb6b5063b9e885a1133c6f8923e840e9b59c3066..76ef484b14daf04c23f9e424b203ed186f935c2a 100644 (file)
@@ -63,7 +63,8 @@ Page_spacing::append_system (const Line_details &line)
   Real refpoint_dist = last_line_.tallness_
     + last_line_.refpoint_extent_[DOWN]
     - line.refpoint_extent_[UP];
-  spring_len_ += max (0.0, line.space_ - refpoint_dist);
+  Real space = line.title_ ? last_line_.title_space_ : last_line_.space_;
+  spring_len_ += max (0.0, space - refpoint_dist);
   inverse_spring_k_ += line.inverse_hooke_;
 
   last_line_ = line;
@@ -84,7 +85,8 @@ Page_spacing::prepend_system (const Line_details &line)
   Real refpoint_dist = line.tallness_
     + line.refpoint_extent_[DOWN]
     - first_line_.refpoint_extent_[UP];
-  spring_len_ += max (0.0, line.space_ - refpoint_dist);
+  Real space = first_line_.title_ ? line.title_space_ : line.space_;
+  spring_len_ += max (0.0, space - refpoint_dist);
   inverse_spring_k_ += line.inverse_hooke_;
 
   first_line_ = line;