-;;;; paper.scm -- manipulate the paper and layout block.
+;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; source file of the GNU LilyPond music typesetter
+;;;; Copyright (C) 2004--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;;
-;;;; (c) 2004--2009 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
+;;;; the Free Software Foundation, either version 3 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; LilyPond is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
(define-public (set-paper-dimension-variables mod)
(module-define! mod 'dimension-variables
(setm! (lambda (sym val)
(module-define! module sym val))))
- (setm! 'text-font-size (* 12 factor))
+ ;; Synchronized with the `text-font-size'
+ ;; binding in add-pango-fonts (see font.scm).
+ (setm! 'text-font-size (* 11 factor))
(setm! 'output-scale ss)
(setm! 'fonts (make-century-schoolbook-tree factor))
;;; 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)
(let* ((var (module-variable old-scope 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))