+Line_details::Line_details (Prob *pb, Output_def *paper)
+{
+ SCM spec = paper->c_variable ("markup-system-spacing");
+ SCM title_spec = paper->c_variable ("markup-markup-spacing");
+ padding_ = 0;
+ 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 ("basic-distance"));
+ Page_layout_problem::read_spacing_spec (title_spec, &title_space_, ly_symbol2scm ("basic-distance"));
+ 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"));
+ Page_layout_problem::read_spacing_spec (title_spec, &title_min_distance_, ly_symbol2scm ("minimum-distance"));
+
+ SCM footnotes = pb->get_property ("footnotes");
+
+ if (scm_is_pair (footnotes))
+ for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s))
+ {
+ Stencil *sten = unsmob_stencil (scm_caddar (s));
+ if (!sten)
+ {
+ programming_error ("expecting stencil, got empty pointer");
+ continue;
+ }
+ footnote_heights_.push_back (sten->extent (Y_AXIS).length ());
+ }
+
+ last_column_ = 0;
+ force_ = 0;
+ Interval stencil_extent = unsmob_stencil (pb->get_property ("stencil"))->extent (Y_AXIS);
+ shape_ = Line_shape (stencil_extent, stencil_extent); // pretend it goes all the way across
+ tallness_ = 0;
+ bottom_padding_ = 0;
+ inverse_hooke_ = 1.0;
+ break_permission_ = ly_symbol2scm ("allow");
+ page_permission_ = pb->get_property ("page-break-permission");
+ turn_permission_ = pb->get_property ("page-turn-permission");
+ break_penalty_ = 0;
+ page_penalty_ = robust_scm2double (pb->get_property ("page-break-penalty"), 0);
+ turn_penalty_ = robust_scm2double (pb->get_property ("page-turn-penalty"), 0);
+ title_ = to_boolean (pb->get_property ("is-title"));
+ compressed_lines_count_ = 1;
+ compressed_nontitle_lines_count_ = title_ ? 0 : 1;
+ SCM last_scm = pb->get_property ("last-markup-line");
+ 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"));
+ refpoint_extent_ = Interval (0, 0);
+}
+
+Real
+Line_details::full_height () const
+{
+ Interval ret;
+ ret.unite (shape_.begin_);
+ ret.unite (shape_.rest_);
+ return ret.length ();
+}
+
+Real
+Line_details::tallness () const
+{
+ return tallness_;
+}
+
+Real
+Line_details::spring_length (Line_details const &next_line) const
+{
+ // space_ measures the spring which goes from the bottom refpoint
+ // of this to the top refpoint of next_line. We want to return
+ // the stretchable space between the bottom of this's extent to
+ // the top of next_line's extent.
+ Real refpoint_dist = tallness_ + refpoint_extent_[DOWN] - next_line.refpoint_extent_[UP];
+ Real space = next_line.title_ ? title_space_ : space_;
+ return max (0.0, space - refpoint_dist);
+}
+
+Line_shape::Line_shape (Interval begin, Interval rest)
+{
+ begin_ = begin;
+ rest_ = rest;
+}
+
+Line_shape
+Line_shape::piggyback (Line_shape mount, Real padding) const
+{
+ Real elevation = max (begin_[UP] - mount.begin_[DOWN], rest_[UP] - mount.rest_[DOWN]);
+ Interval begin = Interval (begin_[DOWN], elevation + mount.begin_[UP] + padding);
+ Interval rest = Interval (rest_[DOWN], elevation + mount.rest_[UP] + padding);
+ return Line_shape (begin, rest);
+}