From 9c08d5a772049794eac7210558670e43f9e349ff Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Tue, 2 Nov 2010 19:11:48 -0700 Subject: [PATCH] Account for title spacing in page breaking. --- lily/constrained-breaking.cc | 12 +++++++++++- lily/include/constrained-breaking.hh | 3 +++ lily/page-spacing.cc | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index ba3fc4d5cb..dcef2208e3 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -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"); diff --git a/lily/include/constrained-breaking.hh b/lily/include/constrained-breaking.hh index 63d695dfe3..4bfdde23fa 100644 --- a/lily/include/constrained-breaking.hh +++ b/lily/include/constrained-breaking.hh @@ -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_; diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index bb6b5063b9..76ef484b14 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -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; -- 2.39.2