When placing a loose line (e.g. Lyrics) at the top or bottom of a
system, include as a constraint the padding to the neighboring
system or markup. Fix 1654.
\score {
<<
\chords { s1 \break d1 }
\score {
<<
\chords { s1 \break d1 }
+ \new Staff = "s" { c1 c1 }
+ \addlyrics { \set alignAboveContext = "s" _ up }
Prob *prob;
vector<Grob*> staves;
vector<Real> min_offsets;
Prob *prob;
vector<Grob*> staves;
vector<Real> min_offsets;
+ // Store the appropriate '*-*-spacing 'padding,
+ // for spacing any adjacent loose line
+ Real padding;
- Element (vector<Grob*> const& a, vector<Real> const& o)
+ Element (vector<Grob*> const& a, vector<Real> const& o, Real p)
{
staves = a;
min_offsets = o;
{
staves = a;
min_offsets = o;
+ Element (Prob *p, Real pad)
springs_.push_back (spring_copy);
bottom_skyline_ = down_skyline;
springs_.push_back (spring_copy);
bottom_skyline_ = down_skyline;
- elements_.push_back (Element (elts, minimum_offsets));
+ elements_.push_back (Element (elts, minimum_offsets, padding));
// Add the springs for the VerticalAxisGroups in this system.
// Add the springs for the VerticalAxisGroups in this system.
spring_copy.ensure_min_distance (minimum_distance + padding);
springs_.push_back (spring_copy);
spring_copy.ensure_min_distance (minimum_distance + padding);
springs_.push_back (spring_copy);
- elements_.push_back (Element (prob));
+ elements_.push_back (Element (prob, padding));
if (loose_lines.size ())
{
Interval loose_extent = loose_lines.back ()->extent (loose_lines.back (), Y_AXIS);
if (loose_lines.size ())
{
Interval loose_extent = loose_lines.back ()->extent (loose_lines.back (), Y_AXIS);
- Real min_distance = -loose_extent[DOWN] + prob_extent[UP]; // TODO: include padding/minimum-distance
+ Real min_distance = (-loose_extent[DOWN] + prob_extent[UP]
+ + elements_[i].padding);
loose_line_min_distances.push_back (min_distance);
loose_lines.push_back (0);
loose_line_min_distances.push_back (min_distance);
loose_lines.push_back (0);
// the last one.
if (loose_lines.size ())
{
// the last one.
if (loose_lines.size ())
{
- loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
+ if (staff_idx)
+ loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
+ else
+ loose_line_min_distances.push_back (elements_[i].padding - min_offsets[staff_idx]);
loose_lines.push_back (staff);
distribute_loose_lines (loose_lines, loose_line_min_distances,
loose_lines.push_back (staff);
distribute_loose_lines (loose_lines, loose_line_min_distances,
if (staff_idx)
loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
else
if (staff_idx)
loose_line_min_distances.push_back (min_offsets[staff_idx-1] - min_offsets[staff_idx]);
else
+ { // this is the first line in a system
Real min_dist = 0;
if (loose_lines.back ())
Real min_dist = 0;
if (loose_lines.back ())
- min_dist = Axis_group_interface::minimum_distance (loose_lines.back (),
- staff,
- Y_AXIS);
+ // distance to the final line in the preceding system,
+ // including 'system-system-spacing 'padding
+ min_dist = (Axis_group_interface::minimum_distance (loose_lines.back (),
+ staff,
+ Y_AXIS)
+ + elements_[i].padding);
else if (!last_title_extent.is_empty ())
else if (!last_title_extent.is_empty ())
- { // distance to the preceding title
- // TODO: add options for controlling the space between a loose line
- // and a title/markup preceding it.
- min_dist = staff->extent (staff, Y_AXIS)[UP] - last_title_extent[DOWN];
- }
+ // distance to the preceding title,
+ // including 'markup-system-spacing 'padding
+ min_dist = (staff->extent (staff, Y_AXIS)[UP] - last_title_extent[DOWN]
+ + elements_[i].padding);
else // distance to the top margin
min_dist = header_padding_ + header_height_ + staff->extent (staff, Y_AXIS)[UP];
else // distance to the top margin
min_dist = header_padding_ + header_height_ + staff->extent (staff, Y_AXIS)[UP];