]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/page-layout.scm (ly:optimal-page-breaks): don't compute
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Oct 2004 18:12:36 +0000 (18:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Oct 2004 18:12:36 +0000 (18:12 +0000)
force twice.

* lily/simple-spacer.cc (LY_DEFINE): if line too long in ragged
mode, return #f.

* scm/page-layout.scm (ly:optimal-page-breaks): set force = 0.0
for last page if raggedlast.

ChangeLog
Documentation/topdocs/NEWS.texi
lily/simple-spacer.cc
scm/page-layout.scm

index 85599b45308d22be6df9aab7cd3ead9713164d45..b656158af18981ac5c7df94ea83300c1a8e1aefd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2004-10-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/page-layout.scm (ly:optimal-page-breaks): don't compute
+       force twice.
+
+       * lily/simple-spacer.cc (LY_DEFINE): if line too long in ragged
+       mode, return #f.        
+
+       * scm/page-layout.scm (ly:optimal-page-breaks): set force = 0.0
+       for last page if raggedlast. 
+
        * lily/parser.yy (Prefix_composite_music): untransposable is for
        FiguredBass, not ChordNames
 
index 4e3b05d4c545367abca9e690bb33378bb12a13c7..238d845fb163ebad2588510a2e6096654e911b1f 100644 (file)
@@ -7,6 +7,10 @@
 @unnumbered New features in 2.3 since 2.2
 
 @itemize @bullet
+@item @code{\bookpaper} and @code{\paper} have been renamed to
+@code{\paper} and @code{\layout} respectively, to better match their
+function.
+
 @item Parts that use @code{\quote} can now be transposed.
 
 @item LilyPond does not try to produce output for files that
@@ -63,7 +67,7 @@ string that is dumped as verbatim PostScript in the output.
 melody by setting the @code{associatedVoice} property.
 
 @item The @code{\lyricsto} keyword now automatically switches on
-@code{\lyrics} mode.
+lyrics mode.
 
 @item The LilyPond binary  now supports output options
 @code{--dvi} @code{--png} @code{--ps} @code{--pdf} and
index 74ed5f0fb2bb1af22a0a77ee3cd41e4699f025dd..7ad8eb3795a7d79b7dbee5b9126226a4bb643644 100644 (file)
    Perhaps this is not a bad thing, because the 1st looks better anyway.  */
 
 
+/*
+
+  positive force = expanding, negative force = compressing.
+  
+*/
+
 Simple_spacer::Simple_spacer ()
 {
   /*
@@ -297,13 +303,21 @@ LY_DEFINE(ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem",
       posns.push (posns.top() + l);
     }
 
+
+    
   SCM force_return = SCM_BOOL_F;
   if (!isinf (spacer.force_)
       && spacer.is_active ())
     {
       force_return = scm_from_double (spacer.force_);
     }
-  
+
+  if (is_ragged
+      && posns.top () > spacer.line_len_)
+    {
+      force_return = SCM_BOOL_F;
+    }
+
   SCM retval= SCM_EOL;
   for (int i = posns.size(); i--;)
     {
index 90a02c838c9457e9bbcfc3515bc0ab0176f82db6..7c7ec3ff4ff18ec58d77ff852977836068d5ca5c 100644 (file)
             (ly:output-def-lookup layout 'topmargin)
             (ly:output-def-lookup layout 'bottommargin)))
        (head (page-headfoot layout scopes number 'make-header 'headsep UP last?))
-       (foot (page-headfoot layout scopes number 'make-footer 'footsep DOWN last?)))
-    (- h (if (ly:stencil? head)
-            (interval-length (ly:stencil-extent head Y))
-            0)
-       (if (ly:stencil? foot)
-          (interval-length (ly:stencil-extent foot Y))
-          0))
-    ))
-
+       (foot (page-headfoot layout scopes number 'make-footer 'footsep DOWN last?))
+       (available 
+       (- h (if (ly:stencil? head)
+                (interval-length (ly:stencil-extent head Y))
+                0)
+          (if (ly:stencil? foot)
+              (interval-length (ly:stencil-extent foot Y))
+              0))))
+    
+;    (display (list "\n available" available head foot))
+    available))
 
 (define-public (default-page-make-stencil
                 lines offsets layout scopes number last? )
@@ -283,7 +285,7 @@ is what have collected so far, and has ascending page numbers."
                        '()) 
                    )))
         (no-systems (vector-length real-extents))
-        (topskip (cdr (vector-ref real-extents 0)))
+        (topskip (interval-end (vector-ref real-extents 0)))
         (space-left (- page-height
                        (apply + (map interval-length (vector->list real-extents)))
 
@@ -291,7 +293,7 @@ is what have collected so far, and has ascending page numbers."
                     
         (space (- page-height
                   topskip
-                  (-  (car (vector-ref real-extents (1- no-systems))))
+                  (-  (interval-start (vector-ref real-extents (1- no-systems))))
                   ))
 
         (fixed-dist (ly:output-def-lookup paper 'betweensystempadding))
@@ -300,9 +302,9 @@ is what have collected so far, and has ascending page numbers."
            (let*
                ((this-system-ext (vector-ref staff-extents idx))
                 (next-system-ext (vector-ref staff-extents (1+ idx)))
-                (fixed (max 0  (- (+ (cdr next-system-ext)
+                (fixed (max 0  (- (+ (interval-end next-system-ext)
                                      fixed-dist)
-                                  (car this-system-ext))))
+                                  (interval-start this-system-ext))))
                 (title1? (and (vector-ref system-vector idx)
                               (ly:paper-system-title? (vector-ref system-vector idx))))
                 (title2? (and
@@ -329,9 +331,9 @@ is what have collected so far, and has ascending page numbers."
            (let*
                ((this-system-ext (vector-ref real-extents idx))
                 (next-system-ext (vector-ref real-extents (1+ idx)))
-                (distance (max  (- (+ (cdr next-system-ext)
+                (distance (max  (- (+ (interval-end next-system-ext)
                                 fixed-dist)
-                                   (car this-system-ext)
+                                   (interval-start this-system-ext)
                                    ) 0)) 
                 (entry (list idx (1+ idx) distance)))
              entry)))
@@ -343,8 +345,7 @@ is what have collected so far, and has ascending page numbers."
                  springs rods space
                  ragged?))
 
-        (force (car (ly:solve-spring-rod-problem
-                     springs rods space #f)))
+        (force (car result))
         (positions
          (map (lambda (y)
                       (+ y topskip)) 
@@ -357,7 +358,6 @@ is what have collected so far, and has ascending page numbers."
                          "\nreal-ext" real-extents "\nstaff-ext" staff-extents
                          "\ninterscore" inter-system-space
                          "\nspace-letf" space-left
-                         "\npage empty" page-very-empty?
                          "\nspring,rod" springs rods
                          "\ntopskip " topskip
                          " space " space
@@ -381,14 +381,19 @@ CURRENT-BEST is the best result sofar, or #f."
                               (ly:output-def-lookup paper 'firstpagenumber)
                               (1+ (node-page-number (car best-paths)))))
 
-          
-          (ragged? (or (eq? #t (ly:output-def-lookup paper 'raggedbottom))
-                       (and (eq? #t (ly:output-def-lookup paper 'raggedlastbottom))
+          (ragged-all? (eq? #t (ly:output-def-lookup paper 'raggedbottom)))
+          (ragged-last? (eq? #t (ly:output-def-lookup paper 'raggedlastbottom)))
+          (ragged? (or ragged-all? 
+                       (and ragged-last?
                             last?)))
            (page-height (page-height this-page-num last?))
           (vertical-spacing (space-systems page-height current-lines ragged?))
           (satisfied-constraints (car vertical-spacing))
-           (force (if satisfied-constraints satisfied-constraints 10000))
+           (force (if satisfied-constraints
+                     (if (and last? ragged-last?)
+                         0.0
+                         satisfied-constraints)
+                     10000))
           (positions (cdr vertical-spacing))
            (user-penalty (ly:paper-system-break-penalty (car current-lines)))
            (total-penalty (combine-penalties