(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))))
(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
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?)
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)
"\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")))