;;;; paper.scm -- manipulate the paper and layout block.
;;;;
;;;; source file of the GNU LilyPond music typesetter
-;;;;
-;;;; (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;;
+;;;; (c) 2004--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
(define-public (set-paper-dimension-variables mod)
(module-define! mod 'dimension-variables
- '(pt mm cm in staff-height staff-space
- page-top-space
- between-system-space between-system-padding
- line-width indent short-indent paper-width paper-height horizontal-shift
- staff-space line-thickness ledgerline-thickness
- blot-diameter left-margin right-margin)))
+ '(blot-diameter
+ bottom-margin
+ cm
+ foot-separation
+ head-separation
+ horizontal-shift
+ in
+ indent
+ ledger-line-thickness
+ left-margin
+ left-margin-default
+ line-thickness
+ line-width
+ mm
+ paper-height
+ paper-width
+ pt
+ right-margin
+ right-margin-default
+ short-indent
+ staff-height
+ staff-space
+ top-margin)))
(define (calc-line-thickness staff-space pt)
;; linear interpolation.
(module-define! module sym val))))
(setm! 'text-font-size (* 12 factor))
-
+
(setm! 'output-scale ss)
- (setm! 'fonts
- (if tex-backend?
- (make-cmr-tree factor)
- (make-century-schoolbook-tree factor)))
+ (setm! 'fonts (make-century-schoolbook-tree factor))
(setm! 'staff-height staff-height)
(setm! 'staff-space ss)
(setm! 'line-thickness (calc-line-thickness ss pt))
- ;; sync with feta
- (setm! 'ledgerline-thickness (+ (* 0.5 pt) (/ ss 10)))
+ ;; sync with feta
+ (setm! 'ledger-line-thickness (+ (* 0.5 pt) (/ ss 10)))
- ;; sync with feta
+ ;; sync with feta
(setm! 'blot-diameter (* 0.4 pt))
))
; maybe not necessary.
; but let's be paranoid. Maybe someone still refers to the
- ; old one.
+ ; old one.
(new-paper (ly:output-def-clone pap))
-
+
(new-scope (ly:output-def-scope new-paper)))
-
+
(if in-layout?
(ly:warning (_ "set-global-staff-size: not in toplevel scope")))
("f4" . (cons (* 210 mm) (* 330 mm)))
))
-;; todo: take dimension arguments.
+; todo: take dimension arguments.
(define (set-paper-dimensions m w h)
"M is a module (i.e. layout->scope_ )"
- (let* ((mm (eval 'mm m)))
+ (begin
+ ;; page layout - what to do with (printer specific!) margin settings?
(module-define! m 'paper-width w)
(module-define! m 'paper-height h)
- (module-define! m 'line-width (- w
- (ly:modules-lookup (list m) 'left-margin (* 10 mm))
- (ly:modules-lookup (list m) 'right-margin (* 10 mm))))
-
(module-define! m 'indent (/ w 14))
- (module-define! m 'short-indent 0)
-
- ;; page layout - what to do with (printer specific!) margin settings?
-
- ))
+ (module-define! m 'short-indent 0))
+ (module-remove! m 'line-width))
(define (internal-set-paper-size module name landscape?)
(define (swap x)
(cons (cdr x) (car x)))
-
- (let* ((entry (assoc name paper-alist))
+
+ (let* ((entry (assoc-get name paper-alist))
(is-paper? (module-defined? module 'is-paper))
(mm (eval 'mm module)))
-
+
(cond
((not is-paper?)
- (ly:warning (_ "This is not a \\layout {} object, ~S" module)))
- ((pair? entry)
+ (ly:warning (_ "This is not a \\layout {} object, ~S") module))
+ (entry
- (set! entry (eval (cdr entry) module))
+ (set! entry (eval entry module))
(if landscape?
(set! entry (swap entry)))
(set-paper-dimensions module (car entry) (cdr entry))
(module-define! module 'papersizename name)
- (module-define! module 'landscape
+ (module-define! module 'landscape
(if landscape? #t #f)))
(else
- (ly:warning (_ "Unknown papersize: ~a" name))))))
+ (ly:warning (_ "Unknown paper size: ~a") name)))))
(define-safe-public (set-default-paper-size name . rest)
(internal-set-paper-size
(module-define! scope v
(/ val scale))
- ;; spurious warnings, eg. for paper-width, paper-height.
+ ;; spurious warnings, eg. for paper-width, paper-height.
;; (ly:warning (_ "not a number, ~S = ~S " v val))
)))
-
+
dim-vars)
-
+
new-pap))