]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/layout-page-layout.scm
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / scm / layout-page-layout.scm
index 8970bc1e3b092b894eb56d9fbca9bfd64330b653..8a7628af857519d7c1dc0ec0bb8c718db029ab27 100644 (file)
 
   (define (handle-page page)
     (define index 0)
+    (define music-system-heights
+      (map-in-order (lambda (sys)
+                     (* -1 (car (paper-system-extent sys Y))))
+                   (remove (lambda (sys)
+                             (ly:prob-property? sys 'is-title))
+                           (page-lines page))))
     (define (handle-system sys)
       (let*
          ((props `((line-break . #t)
                     . ((system-Y-extent . ,(paper-system-extent sys Y))
                        (system-refpoint-Y-extent . ,(paper-system-staff-extents sys))
                        (system-index . ,index)
+                       (music-system-heights . ,music-system-heights)
                        (page-system-count . ,(length (page-lines page)))
                        (page-printable-height . ,(page-printable-height page)) 
                        (page-space-left . ,(page-property page 'space-left))))
@@ -311,7 +318,7 @@ is what have collected so far, and has ascending page numbers."
 
       (cons force positions)))
 
-  (define (walk-paths done-lines best-paths current-lines  last? current-best)
+  (define (walk-paths done-lines best-paths current-lines last? current-best)
     "Return the best optimal-page-break-node that contains
 CURRENT-LINES.  DONE-LINES.reversed ++ CURRENT-LINES is a consecutive
 ascending range of lines, and BEST-PATHS contains the optimal breaks
@@ -336,6 +343,7 @@ CURRENT-BEST is the best result sofar, or #f."
                             last?)))
            (height (page-printable-height this-page))
           (vertical-spacing (space-systems height current-lines ragged?))
+          
           (satisfied-constraints (car vertical-spacing))
            (force (if satisfied-constraints
                      (if (and last? ragged-last?)
@@ -359,10 +367,12 @@ CURRENT-BEST is the best result sofar, or #f."
                            force user-penalty
                           best-paths))
 
-           (better? (or
-                     (not current-best)
-                     (< total-penalty (page-penalty current-best))))
-           (new-best (if better?
+           (is-better (or
+                      (not current-best)
+                      (and
+                       satisfied-constraints
+                       (< total-penalty (page-penalty current-best)))))
+           (new-best (if is-better
                         (begin
                           (map
                            (lambda (x)
@@ -387,7 +397,7 @@ CURRENT-BEST is the best result sofar, or #f."
             "\nuser pen " user-penalty
            "\nsatisfied-constraints" satisfied-constraints
            "\nlast? " last? "ragged?" ragged?
-            "\nbetter? " better? " total-penalty " total-penalty "\n"
+            "\nis-better " is-better " total-penalty " total-penalty "\n"
            "\nconfig " positions
             "\nforce " force
            "\nlines: " current-lines "\n")))