]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix tight spacing for markuplines spread over several pages.
authorBoris Shingarov <b1@shingarov.com>
Sun, 13 Jun 2010 14:42:32 +0000 (15:42 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Sun, 13 Jun 2010 14:59:58 +0000 (15:59 +0100)
lily/constrained-breaking.cc
lily/include/constrained-breaking.hh
lily/page-breaking.cc
lily/page-spacing.cc

index a22e105e4d5715e0277d057d2a85ee58404384cf..8e08d1fc87dc25d81924b53c6d92692b1612da51 100644 (file)
@@ -531,6 +531,7 @@ Line_details::Line_details (Prob *pb, Output_def *paper)
   last_markup_line_  = to_boolean (last_scm);
   SCM first_scm = pb->get_property ("first-markup-line");
   first_markup_line_ = to_boolean (first_scm);
+  tight_spacing_ = to_boolean (pb->get_property ("tight-spacing"));
 }
 
 Real
index ff848537490f29c8365a5d79ad43116ec35197bd..fbe12eb05be5e6a81f018a9844911649a30326e2 100644 (file)
@@ -71,6 +71,7 @@ struct Line_details {
   int compressed_nontitle_lines_count_;
   bool last_markup_line_;
   bool first_markup_line_;
+  bool tight_spacing_;
 
   Line_details ()
   {
@@ -81,6 +82,7 @@ struct Line_details {
     bottom_padding_ = 0;
     space_ = 0;
     inverse_hooke_ = 1;
+    tight_spacing_ = false;
     break_permission_ = ly_symbol2scm ("allow");
     page_permission_ = ly_symbol2scm ("allow");
     turn_permission_ = ly_symbol2scm ("allow");
index 2251e50bc19a5848dea569f315fc4c858d4d06f4..cf483bdcb3488e49fe22c1335dbc41a611feace1 100644 (file)
@@ -99,7 +99,16 @@ compress_lines (const vector<Line_details> &orig)
        {
          Line_details const &old = ret.back ();
          Line_details compressed = orig[i];
-         Real padding = orig[i].title_ ? old.title_padding_ : old.padding_;
+         /*
+           "padding" is the padding below the current line.  The padding below
+           "old" (taking into account whether "old" is a title) is already
+           accounted for in the extent of the compressed line.  The padding
+           below the compressed line, therefore, should depend on whether its
+           bottom-most line is a title or not.
+         */
+         Real padding = 0;
+         if (!orig[i].tight_spacing_)
+           padding = orig[i].title_ ? old.title_padding_ : old.padding_;
 
          compressed.shape_ = old.shape_.piggyback (orig[i].shape_, padding);
          compressed.space_ += old.space_;
@@ -879,9 +888,10 @@ Page_breaking::min_page_count (vsize configuration, vsize first_page_num)
       Real ext_len;
       if (cur_rod_height > 0)
         {
-          padding = cached_line_details_[i].title_ ?
-            cached_line_details_[i-1].title_padding_ :
-            cached_line_details_[i-1].padding_;
+          if (!cached_line_details_[i].tight_spacing_)
+            padding = (cached_line_details_[i].title_
+                      ? cached_line_details_[i - 1].title_padding_
+                      : cached_line_details_[i - 1].padding_);
           ext_len = cached_line_details_[i].tallness_;
         }
       else
index ee9fbb3ee10b3748ea95e238c02809296d020467..4120afb514116df57c7ecd5450f2a11ee4680120 100644 (file)
@@ -56,7 +56,8 @@ Page_spacing::append_system (const Line_details &line)
       rod_height_ += line.full_height ();
       first_line_ = line;
     }
-  rod_height_ += line.title_ ? last_line_.title_padding_ : last_line_.padding_;
+  if (!line.tight_spacing_)
+    rod_height_ += line.title_ ? last_line_.title_padding_ : last_line_.padding_;
   spring_len_ += line.space_;
   inverse_spring_k_ += line.inverse_hooke_;
 
@@ -68,7 +69,7 @@ Page_spacing::append_system (const Line_details &line)
 void
 Page_spacing::prepend_system (const Line_details &line)
 {
-  if (rod_height_)
+  if (rod_height_ && !first_line_.tight_spacing_)
     rod_height_ += first_line_.title_ ? line.title_padding_ : line.padding_;
   else
     last_line_ = line;