source file of the GNU LilyPond music typesetter
- (c) 2006--2007 Joe Neeman <joeneeman@gmail.com>
+ (c) 2006--2008 Joe Neeman <joeneeman@gmail.com>
*/
#include "constrained-breaking.hh"
bool last = j == breaks_.size () - 1;
bool ragged = ragged_right || (last && ragged_last);
+ /* As a special case, if there is only one line in the score and ragged-right
+ hasn't been specifically forbidden and the line is stretched, use
+ ragged spacing. */
+ if (last && i == 0
+ && lines_.at (i, j).force_ >= 0
+ && !scm_is_bool (pscore_->layout ()->c_variable ("ragged-right"))
+ && !scm_is_bool (pscore_->layout ()->c_variable ("ragged-last")))
+ ragged = true;
+
return get_line_configuration (line, line_dims[RIGHT] - line_dims[LEFT], line_dims[LEFT], ragged);
}
vector<Column_x_positions>
Constrained_breaking::best_solution (vsize start, vsize end)
{
- vsize min_systems = min_system_count (start, end);
+ vsize min_systems = min_system_count (start, end);
vsize max_systems = max_system_count (start, end);
Real best_demerits = infinity_f;
vector<Column_x_positions> best_so_far;
int
Constrained_breaking::max_system_count (vsize start, vsize end)
{
- vsize brk = (end >= start_.size ()) ? breaks_.size () : starting_breakpoints_[end];
+ vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : starting_breakpoints_[end];
return brk - starting_breakpoints_[start];
}
line.turn_permission_ = min_permission (line.page_permission_,
line.turn_permission_);
- line.extent_ = extent.is_empty () ? Interval (0, 0) : extent;
+ line.extent_ = (extent.is_empty ()
+ || isnan (extent[LEFT])
+ || isnan (extent[RIGHT]))
+ ? Interval (0, 0) : extent;
line.padding_ = padding;
line.space_ = space;
line.inverse_hooke_ = extent.length () + space;