;;;; source file of the GNU LilyPond music typesetter
;;;;
;;;; (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
-;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
(define-module (scm layout-page-layout)
#:use-module (srfi srfi-1)
(define (post-process-pages layout pages)
"If the write-page-layout paper variable is true, dumps page breaks
and tweaks."
- (if (ly:output-def-lookup layout 'write-page-layout #f)
- (write-page-breaks pages)))
+
+ (let*
+ ((parser (ly:modules-lookup (list (current-module)) 'parser))
+ (output-name (ly:parser-output-name parser))
+ )
+
+ (if (ly:output-def-lookup layout 'write-page-layout #f)
+ (write-page-breaks pages output-name))))
;;;
;;; Utilities for computing line distances and positions
"Minimum distance between `line' reference position and `next-line'
reference position. If next-line is #f, return #f."
(and next-line
- (max 0 (- (+ (interval-end (paper-system-extent next-line Y))
- (if ignore-padding 0 (line-next-padding line next-line layout)))
- (interval-start (paper-system-extent line Y))))))
+ (let ((non-skyline-distance (- (interval-end (paper-system-extent next-line Y))
+ (interval-start (paper-system-extent line Y)))))
+ (max 0 (+ (ly:prob-property next-line 'skyline-distance non-skyline-distance)
+ (if ignore-padding 0 (line-next-padding line next-line layout)))))))
(define (line-ideal-distance line next-line layout ignore-padding)
"Ideal distance between `line' reference position and `next-line'
(define (first-line-position line layout)
"Position of the first line on page"
- (max (+ (ly:output-def-lookup layout 'page-top-space)
+ (max (+ (if (ly:prob-property? line 'is-title)
+ ;; do not use page-top-space if first line is a title
+ 0.0
+ (ly:output-def-lookup layout 'page-top-space))
(interval-end (paper-system-staff-extents line)))
(interval-end (paper-system-extent line Y))))
(space-to-fill (page-maximum-space-to-fill
page lines paper))
(spacing (space-systems space-to-fill lines ragged paper #f)))
- (if (or (not (car spacing)) (inf? (car spacing)))
- (cdr (space-systems space-to-fill lines ragged paper #t))
+ (if (and (> (length lines) 1)
+ (or (not (car spacing)) (inf? (car spacing))))
+ (begin
+ (ly:warning (_ "Can't fit systems on page -- ignoring between-system-padding"))
+ (cdr (space-systems space-to-fill lines ragged paper #t)))
(cdr spacing))))))
(page-set-property! page 'configuration posns)
page))