source file of the GNU LilyPond music typesetter
- (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include <math.h> // rint
#include "gourlay-breaking.hh"
#include "column-x-positions.hh"
-#include "debug.hh"
+#include "warn.hh"
+#include "main.hh"
#include "paper-column.hh"
#include "paper-score.hh"
#include "paper-def.hh"
#include "simple-spacer.hh"
-#include "line-of-score.hh"
+#include "system.hh"
/// How often to print operator pacification marks?
const int HAPPY_DOTS_I = 3;
Real worst_force = 0.0;
- for ( int break_idx=1; break_idx< breaks.size (); break_idx++)
+ for (int break_idx=1; break_idx< breaks.size (); break_idx++)
{
/*
start with a short line, add measures. At some point
Real minimal_demerits = infinity_f;
+ bool ragged = to_boolean (pscore_l_->paper_l_->get_scmvar ("raggedright"));
+
for (int start_idx = break_idx; start_idx--;)
{
Link_array<Grob> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
Interval line_dims
= pscore_l_->paper_l_->line_dimensions_int (optimal_paths[start_idx].line_i_);
Simple_spacer * sp = generate_spacing_problem (line, line_dims);
- sp->solve (&cp);
+ sp->solve (&cp, ragged);
delete sp;
if (fabs (cp.force_f_) > worst_force)
/*
TODO: uniformity parameter to control rel. importance of spacing differences.
+
+ TODO:
+
+ mixing break penalties and constraint-failing solutions is confusing.
*/
Real
Gourlay_breaking::combine_demerits (Column_x_positions const &prev,
if (pc->original_l_)
{
SCM pen = pc->get_grob_property ("penalty");
- if (gh_number_p (pen))
+ if (gh_number_p (pen) && fabs (gh_scm2double (pen)) < 10000)
{
break_penalties += gh_scm2double (pen);
}
}
- Real demerit = abs (this_one.force_f_) + abs (prev.force_f_ - this_one.force_f_)
+#if 1
+ /*
+ Q: do want globally non-cramped lines, or locally equally cramped lines.
+ */
+ Real demerit = abs (this_one.force_f_) + 0.1 *abs (prev.force_f_ - this_one.force_f_)
+ break_penalties;
-
+#else
+ Real demerit = abs (this_one.force_f_) + break_penalties;
+#endif
if (!this_one.satisfies_constraints_b_)
{
/*
If it doesn't satisfy constraints, we make this one
really unattractive.
- */
- demerit += 10;
- demerit *= 100;
+
+ 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;