]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly (rondo):
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 12 Jun 2004 23:40:09 +0000 (23:40 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 12 Jun 2004 23:40:09 +0000 (23:40 +0000)
octavation compatibility fixes. Backportme.

ChangeLog
input/mutopia/W.A.Mozart/mozart-hrn3-rondo.ly
input/test/page-breaks.ly
lily/include/paper-line.hh
scm/page-breaking.scm

index f6bcc431d00c7b009df23d54c2b075b4635ca7ab..0e821dc1f1c211906d0a0fa8defadd47b0bb994e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,15 @@
 
 2004-06-13  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * 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.
 
index 55c896f42b8172e554b8ebf89a290f7a74a7dc85..fcb41f772c8ec2db87088c19432f3389f97fe359 100644 (file)
@@ -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.
index a8b751c934c2fbd8d8d3d804e9ad1b03af7d8450..ab8d98359b1bcd3de2b6ef586d9717d85d70ec1b 100644 (file)
     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")
index eec021ff0807815881441d5386040f637fe9d96b..a5279a0d6e47450ce3f3120c4f7976445e5db9a0 100644 (file)
@@ -20,7 +20,7 @@ class Paper_line
   bool is_title_;
   
 public:
-  int penalty_;
+  Real penalty_;
   int number_;
 
   Paper_line (Stencil, bool);
index 39f2a05f32f633a41a17ed3056a2c36183ed12a3..791fded38d16e964c46e84695151f2a1462c3174 100644 (file)
 ;;; 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 <optimally-broken-page-node> ()
   (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))