- energy_bound_f_ = pscore_l_->paper_l_->get_var ("gourlay_energybound");
- max_measures_i_ =int (rint (pscore_l_->paper_l_->get_var ("gourlay_maxmeasures")));
+ Real break_penalties = 0.0;
+ Grob * pc = this_one.cols_.top ();
+ if (pc->original_)
+ {
+ SCM pen = pc->get_property ("penalty");
+ if (ly_c_number_p (pen) && fabs (ly_scm2double (pen)) < 10000)
+ {
+ break_penalties += ly_scm2double (pen);
+ }
+ }
+
+ /*
+ Q: do we want globally non-cramped lines, or locally equally
+ cramped lines?
+
+ There used to be an example file input/test/uniform-breaking to
+ demonstrate problems with this approach. When music is gradually
+ becoming denser, the uniformity requirement makes lines go from
+ cramped to even more cramped (because going from cramped
+ 3meas/line to relatively loose 2meas/line is such a big step.
+
+ */
+
+ Real demerit = abs (this_one.force_) + abs (prev.force_ - this_one.force_)
+ + break_penalties;
+
+ if (!this_one.satisfies_constraints_)
+ {
+ /*
+ If it doesn't satisfy constraints, we make this one
+ really unattractive.
+
+ add 20000 to the demerits, so that a break penalty
+ of -10000 won't change the result */
+ demerit = (demerit + 20000) >? 2000;
+
+ demerit *= 10;
+ }
+
+ return demerit;