Hi,

Here is a patch that fixes the space-left page property computing, for
use in two-pass vertical spacing. The footer height is taken into
account.

Also, when computing system stretching, it's nice to know how much space
other music systems take, in order to determine what part of the left
space this system can consume. The patch adds a music-system-heights
property to the page layout output.

Then, a simple implementation of spacingTweaks could be:

spacingTweaks = 
#(define-music-function (parser location props) (list?)
   (let* ((space-left (cdr (assoc 'page-space-left props)))
          (music-size (apply + (cdr (assoc 'music-system-heights props))))
          (system-size (* -1 (cadr (assoc 'system-Y-extent props))))
          (extra-space (/ (* system-size space-left) music-size)))
     #{
       \overrideProperty #"Score.NonMusicalPaperColumn"
        #'line-break-system-details
        #$(list (cons 'alignment-extra-space extra-space))
     #}))

nicolas

Index: ChangeLog
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ChangeLog,v
retrieving revision 1.4693
diff -u -r1.4693 ChangeLog
--- ChangeLog	26 Feb 2006 11:03:52 -0000	1.4693
+++ ChangeLog	26 Feb 2006 12:51:00 -0000
@@ -1,5 +1,13 @@
 2006-02-26  Nicolas Sceaux  <[EMAIL PROTECTED]>
 
+	* scm/layout-page-layout.scm (write-page-breaks): add a
+	music-system-heights property to the page layout output.
+
+	* scm/page.scm (make-page-stencil): take footer into account when
+	computing the 'space-left page property
+	(annotate-space-left): take footer into account when annonating
+	space left.
+
 	* scm/framework-ps.scm: 	
 	* scm/lily-library.scm (nan?, inf?): Move guile 1.6 compatibility
 	layer for inf? and nan? from framework-ps to lily-library.
Index: scm/layout-page-layout.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/layout-page-layout.scm,v
retrieving revision 1.15
diff -u -r1.15 layout-page-layout.scm
--- scm/layout-page-layout.scm	16 Feb 2006 02:17:51 -0000	1.15
+++ scm/layout-page-layout.scm	26 Feb 2006 12:51:02 -0000
@@ -106,6 +106,12 @@
 
   (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)
@@ -113,6 +119,7 @@
 		     . ((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))))
Index: scm/page.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/page.scm,v
retrieving revision 1.9
diff -u -r1.9 page.scm
--- scm/page.scm	19 Feb 2006 12:38:02 -0000	1.9
+++ scm/page.scm	26 Feb 2006 12:51:02 -0000
@@ -124,7 +124,13 @@
        (layout (ly:paper-book-paper p-book))
        (arrow (annotate-y-interval layout
 				   "space left"
-				   (cons (- (page-property page 'bottom-edge))
+				   (cons (- 0.0
+					    (page-property page 'bottom-edge)
+					    (let ((foot (page-property page 'foot-stencil)))
+					      (if (and (ly:stencil? foot)
+						       (not (ly:stencil-empty? foot)))
+						  (car (ly:stencil-extent foot Y))
+						  0.0)))
 					 (page-property page  'bottom-system-edge))
 				   #t)))
 
@@ -336,7 +342,12 @@
     (ly:prob-set-property! page 'bottom-system-edge
 			   (car (ly:stencil-extent page-stencil Y)))
     (ly:prob-set-property! page 'space-left
-			   (car (ly:stencil-extent page-stencil Y)))
+			   (+ (prop 'bottom-edge)
+			      (prop 'bottom-system-edge)
+			      (if (and (ly:stencil? foot)
+				       (not (ly:stencil-empty? foot)))
+				  (car (ly:stencil-extent foot Y))
+				  0.0)))
 
     (if (annotate? layout)
 	(set! page-stencil
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to