From a7d058d67feb06da25298c3df77e0740f8069d62 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Sun, 13 Jun 2010 15:42:32 +0100 Subject: [PATCH] Fix tight spacing for markuplines spread over several pages. --- lily/constrained-breaking.cc | 1 + lily/include/constrained-breaking.hh | 2 ++ lily/page-breaking.cc | 18 ++++++++++++++---- lily/page-spacing.cc | 5 +++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index a22e105e4d..8e08d1fc87 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -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 diff --git a/lily/include/constrained-breaking.hh b/lily/include/constrained-breaking.hh index ff84853749..fbe12eb05b 100644 --- a/lily/include/constrained-breaking.hh +++ b/lily/include/constrained-breaking.hh @@ -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"); diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 2251e50bc1..cf483bdcb3 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -99,7 +99,16 @@ compress_lines (const vector &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 diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index ee9fbb3ee1..4120afb514 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -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; -- 2.39.2