X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fpaper.scm;h=ccbfe50176a11866589e8ef5ab9a83fc7b1bfac2;hb=66a7c3e925cbc1a34eaad04f80d4bc42ad9834ac;hp=8b877024f6f03eef5c709203cb399c6dbce9041d;hpb=1c846b2c2348b4e0ca4a3c2e8fb267047ba2d203;p=lilypond.git diff --git a/scm/paper.scm b/scm/paper.scm index 8b877024f6..ccbfe50176 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2011 Han-Wen Nienhuys +;;;; Copyright (C) 2004--2012 Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -15,11 +15,16 @@ ;;;; You should have received a copy of the GNU General Public License ;;;; along with LilyPond. If not, see . +; 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 + footnote-footer-padding + footnote-padding horizontal-shift in indent @@ -86,13 +91,13 @@ )) (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))) @@ -123,6 +128,11 @@ size. SZ is in points" ;; 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))) @@ -161,10 +171,15 @@ size. SZ is in points" ("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))) @@ -284,23 +299,32 @@ size. SZ is in points" scaled-values))) (define (internal-set-paper-size module name landscape?) - (define (swap x) - (cons (cdr x) (car x))) - - (let* ((entry (assoc-get name paper-alist)) + (let* ((entry-name name) + (swapped? + (cond ((string-suffix? "landscape" name) + (set! entry-name + (string-trim-right (string-drop-right name 9))) + #t) + ((string-suffix? "portrait" name) + (set! entry-name + (string-trim-right (string-drop-right name 8))) + #f) + (else landscape?))) + (entry (assoc-get entry-name paper-alist)) (is-paper? (module-defined? module 'is-paper)) (mm (eval 'mm module))) + (define (swap x) + (cons (cdr x) (car x))) (cond ((not is-paper?) (ly:warning (_ "This is not a \\layout {} object, ~S") module)) (entry - (set! entry (eval entry module)) - (if landscape? + (if swapped? (set! entry (swap entry))) (set-paper-dimensions module (car entry) (cdr entry)) - + (module-define! module 'papersizename name) (module-define! module 'landscape (if landscape? #t #f)))