]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/paper.scm
Introduce new handling for paper margin settings.
[lilypond.git] / scm / paper.scm
index d4a1f42f3f3949c6452cda7b1d0402fa2d9be124..1eb3b59a1a2ee57983af29ff46eb25eb4c9f381a 100644 (file)
@@ -1,17 +1,12 @@
 ;;;; 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
-                 '(after-title-space
-                   before-title-space
-                   between-system-padding
-                   between-system-space
-                   between-title-space
-                   blot-diameter
+                 '(blot-diameter
                    bottom-margin
                    cm
                    foot-separation
                    indent
                    ledger-line-thickness
                    left-margin
+                    left-margin-default
                    line-thickness
                    line-width
                    mm
-                   page-top-space
                    paper-height
                    paper-width
                    pt
                    right-margin
+                    right-margin-default
                    short-indent
                    staff-height
                    staff-space
                (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  
+    ;;  sync with feta
     (setm! 'ledger-line-thickness (+ (* 0.5 pt) (/ ss 10)))
 
-    ;;  sync with feta  
+    ;;  sync with feta
     (setm! 'blot-diameter (* 0.4 pt))
     ))
 
@@ -98,11 +91,11 @@ size. SZ is in points"
 
         ; 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")))
 
@@ -216,44 +209,38 @@ size. SZ is in points"
     ("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)
+     (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 paper size: ~a") name)))))
@@ -288,10 +275,10 @@ size. SZ is in points"
             (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))