;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 2004--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;; Copyright (C) 2004--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; You should have received a copy of the GNU General Public License
;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
(define-public (set-paper-dimension-variables mod)
(module-define! mod 'dimension-variables
'(blot-diameter
bottom-margin
cm
- foot-separation
- head-separation
+ footnote-footer-padding
+ footnote-padding
horizontal-shift
in
indent
(setm! (lambda (sym val)
(module-define! module sym val))))
+ ;; Synchronized with the `text-font-size'
+ ;; binding in add-pango-fonts (see font.scm).
(setm! 'text-font-size (* 11 factor))
(setm! 'output-scale ss)
))
(define-public (layout-set-absolute-staff-size sz)
- "Function to be called inside a \\layout{} block to set the staff
-size. SZ is in points"
+ "Set the absolute staff size inside of a @code{\\layout@{@}} block.
+@var{sz} is in points."
(layout-set-absolute-staff-size-in-module (current-module) sz))
(define-public (layout-set-staff-size sz)
- "Function to be called inside a \\layout{} block to set the staff
-size. SZ is in points"
+ "Set the staff size inside of a @code{\\layout@{@}} block.
+@var{sz} is in points."
(layout-set-absolute-staff-size (* (eval 'pt (current-module)) sz)))
;; don't use decimals.
;; ISO 216 has a tolerance of +- 2mm
+ ;; TODO Autogenerate the following list so it appears under the
+ ;; 'Predefined paper sizes' node in notation-appendices.itely
+ ;; currently the list below has been copied and formatted manually.
+ ;; Therefore, please add any new entries to the *itely file as well.
+
'(("a10" . (cons (* 26 mm) (* 37 mm)))
("a9" . (cons (* 37 mm) (* 52 mm)))
("a8" . (cons (* 52 mm) (* 74 mm)))
("c1" . (cons (* 648 mm) (* 917 mm)))
("c0" . (cons (* 917 mm) (* 1297 mm)))
;; Below are North American paper sizes
+ ("junior-legal" . (cons (* 8.0 in) (* 5.0 in)))
("legal" . (cons (* 8.5 in) (* 14.0 in)))
("letter" . (cons (* 8.5 in) (* 11.0 in)))
;; Ledger (17x11) is a 90 degree rotation of Tabloid
+ ("17x11" . (cons (* 17.0 in) (* 11.0 in)))
+ ("ledger" . (cons (* 17.0 in) (* 11.0 in)))
+ ;; Tabloid (11x17)
("11x17" . (cons (* 11.0 in) (* 17.0 in)))
+ ("tabloid" . (cons (* 11.0 in) (* 17.0 in)))
;; government-letter by IEEE Printer Working Group, for children's writing
("government-letter" . (cons (* 8 in) (* 10.5 in)))
("government-legal" . (cons (* 8.5 in) (* 13.0 in)))
("pa10" . (cons (* 26 mm) (* 35 mm)))
;; F4 used in southeast Asia and Australia
("f4" . (cons (* 210 mm) (* 330 mm)))
+ ;; Used for very small @lilypond examples in the Documentation
+ ;; based on a8 size but landscape not portrait
+ ("a8landscape" . (cons (* 74 mm) (* 52 mm)))
))
;; todo: take dimension arguments.
(("binding-offset" . ,w) . '())
(("top-margin" . ,h) . '())
(("bottom-margin" . ,h) . '())
- (("head-separation" . ,h) . '())
- (("foot-separation" . ,h) . '())
(("indent" . ,w) . '())
(("short-indent" . ,w) . '())))
(scaled-values
;;; that in parse-scm.cc
(ly:warning (_ "Must use #(set-paper-size .. ) within \\paper { ... }"))))
-(define-public (scale-layout pap scale)
- (let* ((new-pap (ly:output-def-clone pap))
- (dim-vars (ly:output-def-lookup pap 'dimension-variables))
- (old-scope (ly:output-def-scope pap))
- (scope (ly:output-def-scope new-pap)))
+(define-public (scale-layout paper scale)
+ "Return a clone of the paper, scaled by the given scale factor."
+ (let* ((new-paper (ly:output-def-clone paper))
+ (dim-vars (ly:output-def-lookup paper 'dimension-variables))
+ (old-scope (ly:output-def-scope paper))
+ (scope (ly:output-def-scope new-paper)))
(for-each
(lambda (v)
(val (if (variable? var) (variable-ref var) #f)))
(if (number? val)
- (module-define! scope v
- (/ val scale))
-
- ;; spurious warnings, eg. for paper-width, paper-height.
- ;; (ly:warning (_ "not a number, ~S = ~S " v val))
+ (module-define! scope v (/ val scale))
+ ;; Cannot warn for non-numbers, eg. for paper-width, paper-height.
)))
-
dim-vars)
-
- new-pap))
+ ;; Mark the clone.
+ (ly:output-def-set-variable! new-paper 'cloned #t)
+ new-paper))