]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/constrained-breaking.cc
Run astyle 2.02.
[lilypond.git] / lily / constrained-breaking.cc
index bff8e79df9dfee4e8e459da2fbe8876ea6f9d267..0a185bf39d00e3b1be3ef34647ace171f0a138aa 100644 (file)
@@ -436,10 +436,10 @@ Constrained_breaking::initialize ()
   breaks_ = pscore_->get_break_indices ();
   all_ = pscore_->root_system ()->used_columns ();
   lines_.resize (breaks_.size (), breaks_.size (), Line_details ());
-  vector<Real> forces = get_line_forces (all_,
-                                         other_lines.length (),
-                                         other_lines.length () - first_line.length (),
-                                         ragged_right_);
+  vector<Simple_spacer> spacers
+    = pscore_->root_system ()->get_simple_spacers (other_lines.length (),
+                                                   other_lines.length () - first_line.length (),
+                                                   ragged_right_);
   for (vsize i = 0; i + 1 < breaks_.size (); i++)
     {
       for (vsize j = i + 1; j < breaks_.size (); j++)
@@ -448,9 +448,18 @@ Constrained_breaking::initialize ()
           bool ragged = ragged_right_ || (last && ragged_last_);
           Line_details &line = lines_.at (j, i);
 
-          line.force_ = forces[i * breaks_.size () + j];
+          line.force_ = spacers[i * breaks_.size () + j].force_penalty (ragged_right_);
+          if (!spacers[i * breaks_.size () + j].fits ())
+            {
+              if (spacers[i * breaks_.size () + j].minimal_)
+                line.force_ = -200000;
+              else
+                line.force_ = infinity_f;
+            }
           if (ragged && last && !isinf (line.force_))
             line.force_ = (line.force_ < 0 && j > i + 1) ? infinity_f : 0;
+          if (!line.force_ && !spacers[i * breaks_.size () + j].line_len ())
+            line.force_ = infinity_f;
           if (isinf (line.force_))
             break;
 
@@ -517,7 +526,8 @@ Constrained_breaking::fill_line_details (Line_details *const out, vsize start, v
   out->title_space_ = system_markup_space_;
   out->inverse_hooke_ = out->full_height () + system_system_space_;
 
-  out->footnotes_ = sys->get_footnotes_in_range (start_rank, end_rank);
+  out->footnote_heights_ = sys->get_footnote_heights_in_range (start_rank, end_rank);
+  out->in_note_heights_ = sys->get_in_note_heights_in_range (start_rank, end_rank);
 
   out->refpoint_extent_ = sys->pure_refpoint_extent (start_rank, end_rank);
   if (out->refpoint_extent_.is_empty ())
@@ -554,7 +564,15 @@ Line_details::Line_details (Prob *pb, Output_def *paper)
 
   if (scm_is_pair (footnotes))
     for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s))
-      footnotes_.push_back (unsmob_stencil (scm_cadar (s)));
+      {
+        Stencil *sten = unsmob_stencil (scm_caddar (s));
+        if (!sten)
+          {
+            programming_error ("expecting stencil, got empty pointer");
+            continue;
+          }
+        footnote_heights_.push_back (sten->extent (Y_AXIS).length ());
+      }
 
   last_column_ = 0;
   force_ = 0;