From: Han-Wen Nienhuys Date: Sat, 12 Jun 2004 23:40:09 +0000 (+0000) Subject: * input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly (rondo): X-Git-Tag: release/2.3.4~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7be49f5570b9178144cc21cfd8cb7fae5f3c4e4f;p=lilypond.git * input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly (rondo): octavation compatibility fixes. Backportme. --- diff --git a/ChangeLog b/ChangeLog index f6bcc431d0..0e821dc1f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,15 @@ 2004-06-13 Han-Wen Nienhuys + * input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly (rondo): + octavation compatibility fixes. Backportme. + + * scm/page-breaking.scm (ly:optimal-page-breaks): allow overfull + pages. + (ly:optimal-page-breaks): combine-penalties: no shortcut for + negative. Now we handle negative penalties (ie. \pageBreak) + correctly. + * lily/system.cc (get_line): extract page-penalty from the left bound. diff --git a/input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly b/input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly index 55c896f42b..fcb41f772c 100644 --- a/input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly +++ b/input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly @@ -39,7 +39,7 @@ rondo = \notes \relative c' \rondotheme R2.*13 | - r8 r^\fermata d d[ e f] + r8 r^\fermata d' d[ e f] g[ ( e) c-.] d[( e) d-.] c4 c8 d[ e f] g[( e) c-.] d[( e) d-.] @@ -76,7 +76,7 @@ rondo = \notes \relative c' d[( g)] r r4 r8 R2.*1 \lipbreaker - c4 r8 c'[ d e] + c,,4 r8 c'[ d e] d4( g8) c,[ d e] d4 r8 r4 r8 R2. | @@ -123,7 +123,7 @@ rondo = \notes \relative c' \mark "E" R2.*9 | \lipbreaker - c8[ c' c] c4.~ + c,8[ c' c] c4.~ c8[ c d] e[ e fis] g4 r8 r4 r8 R2. diff --git a/input/test/page-breaks.ly b/input/test/page-breaks.ly index a8b751c934..ab8d98359b 100644 --- a/input/test/page-breaks.ly +++ b/input/test/page-breaks.ly @@ -17,12 +17,28 @@ piece = "Piece" } +pattern = { a b c d \break } \score { \context Staff \notes \relative c' { %% 16: ideally cramped %% 17: very bad without density - \repeat unfold 17 { a b c d \break } +% \repeat unfold 17 { a b c d \break } + + \pattern + \pattern + % \noPageBreak + \pattern + + % the following changes the location of the break. + % + % \pageBreak + + \pattern + \pattern + \pattern + \pattern + \repeat unfold 10 \pattern } \paper { #(set-default-paper-size "a6") diff --git a/lily/include/paper-line.hh b/lily/include/paper-line.hh index eec021ff08..a5279a0d6e 100644 --- a/lily/include/paper-line.hh +++ b/lily/include/paper-line.hh @@ -20,7 +20,7 @@ class Paper_line bool is_title_; public: - int penalty_; + Real penalty_; int number_; Paper_line (Stencil, bool); diff --git a/scm/page-breaking.scm b/scm/page-breaking.scm index 39f2a05f32..791fded38d 100644 --- a/scm/page-breaking.scm +++ b/scm/page-breaking.scm @@ -13,13 +13,10 @@ ;;; This is not optimal page breaking, this is optimal distribution of ;;; lines over pages; line breaks are a given. -;;; TODO: -;;; - user tweaking: -;;; + \pagebreak, \nopagebreak -;;; + #pages? -;;; - short circut SCORE=-1 (dismiss path) -;;; - density scoring - +; TODO: +; +; - density scoring +; (define-class () (prev #:init-value '() #:accessor node-prev #:init-keyword #:prev) @@ -64,13 +61,15 @@ unused, at the moment." ;; FIXME, simplistic (let* ((left (- available used)) ;; scale-independent - (relative-empty (/ left available))) + (relative (abs (/ left available)))) (if (negative? left) - ;; too full - MAXPENALTY + + ;; too full, penalise more + (* 10 (1+ relative) relative) + ;; Convexity: two half-empty pages is better than 1 completely ;; empty page - (* (1+ relative-empty) relative-empty)))) + (* (1+ relative) relative)))) (define (page-height page-number last?) (let ((h text-height)) @@ -90,10 +89,8 @@ is what have collected so far, and has ascending page numbers." (get-path (node-prev node) (cons node done)) done)) - (define (add-penalties . lst) - (if (find negative? lst) ;; todo: rm support for this - -1 - (apply + lst))) + (define (combine-penalties user page prev) + (+ prev page user)) (define (walk-paths done-lines best-paths current-lines last? current-best) "Return the best optimal-page-break-node that contains @@ -113,7 +110,7 @@ CURRENT-BEST is the best result sofar, or #f." (space-used (cumulative-height current-lines)) (this-page-penalty (height-penalty page-height space-used)) (user-penalty (ly:paper-line-break-penalty (car current-lines))) - (total-penalty (add-penalties + (total-penalty (combine-penalties user-penalty this-page-penalty prev-penalty)) (better? (or (not current-best) @@ -163,15 +160,12 @@ DONE." (let* ((best-break-node (walk-lines '() '() lines)) (break-nodes (get-path best-break-node '())) - (break-lines (map node-lines break-nodes)) - (break-numbers (map line-number break-nodes))) + (break-lines (map node-lines break-nodes))) (if (ly:get-option 'verbose) (begin - (format (current-error-port) "breaks: ~S\n" break-numbers) + (format (current-error-port) "breaks: ~S\n" (map line-number break-nodes)) (force-output (current-error-port)))) - ;; TODO: if solution is bad return no breaks and revert to - ;; ragged bottom break-lines))