}
}
/* if we get to here, just put everything on one line */
- warning (_ ("cannot find line breaking that satisfies constraints"));
- ret.push_back (space_line (0, end_brk));
+ if (sys_count > 0) {
+ warning (_ ("cannot find line breaking that satisfies constraints"));
+ ret.push_back (space_line (0, end_brk));
+ }
return ret;
}
}
/* if we get to here, just put everything on one line */
- Line_details details;
- fill_line_details (&details, 0, end_brk);
- ret.push_back (details);
+ if (sys_count > 0) {
+ Line_details details;
+ fill_line_details (&details, 0, end_brk);
+ ret.push_back (details);
+ }
return ret;
}
LY_ASSERT_TYPE (unsmob_global_context, ctx, 2);
Music *music = unsmob_music (mus);
- if (!music
- || !music->get_length ().to_bool ())
+ if (!music)
{
warning (_ ("no music found in score"));
return SCM_BOOL_F;
best = space_systems_on_best_pages (0, first_page_num);
page_count = best.systems_per_page_.size ();
- min_sys_count = ideal_sys_count - best.systems_per_page_.back ();
+ if (page_count == 0)
+ {
+ min_sys_count = 0;
+ }
+ else
+ {
+ min_sys_count = ideal_sys_count - best.systems_per_page_.back ();
- if (page_count > 1 && best.systems_per_page_[page_count - 2] > 1)
- min_sys_count -= best.systems_per_page_[page_count - 2];
+ if (page_count > 1 && best.systems_per_page_[page_count - 2] > 1)
+ min_sys_count -= best.systems_per_page_[page_count - 2];
- min_sys_count = max (min_sys_count, (vsize)1);
+ min_sys_count = max (min_sys_count, (vsize)1);
+ }
}
else
{
if (page_count == 1)
message (_ ("Fitting music on 1 page..."));
- else if (scm_is_integer (forced_page_count))
+ else if (scm_is_integer (forced_page_count) || page_count == 0)
message (_f ("Fitting music on %d pages...", (int)page_count));
else
message (_f ("Fitting music on %d or %d pages...", (int)page_count - 1, (int)page_count));
}
Page_spacing_result ret;
+ if (simple_state_.empty ())
+ return ret;
+
ret.penalty_ = simple_state_.back ().penalty_
+ lines_.back ().page_penalty_ + lines_.back ().turn_penalty_;
ret.system_count_status_ = simple_state_.back ().system_count_status_;
if (next_col)
description.spring_ = Spaceable_grob::get_spring (col, next_col);
- Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
- if (end_col)
- description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
+ if (col_index + 1 < cols.size ())
+ {
+ Grob *end_col = dynamic_cast<Item *> (cols[col_index + 1])->find_prebroken_piece (LEFT);
+ if (end_col)
+ description.end_spring_ = Spaceable_grob::get_spring (col, end_col);
+ }
for (SCM s = Spaceable_grob::get_minimum_distances (col);
scm_is_pair (s); s = scm_cdr (s))