]> git.donarmstrong.com Git - lilypond.git/commitdiff
(make-page-stencil): don't rely on extents of
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 21 Aug 2006 23:05:50 +0000 (23:05 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 21 Aug 2006 23:05:50 +0000 (23:05 +0000)
page-stencil. This fixes spurious space around .EPS files produced
with the EPS backend.

ChangeLog
input/regression/page-layout.ly
lily/stencil-scheme.cc
scm/page.scm

index f240c0534419c80f6c13d606d2f16c03a67243d9..1076287bea4b939e25df71c44637b95ed2654b07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
+2006-08-22  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * scm/page.scm (make-page-stencil): don't rely on extents of
+       page-stencil. This fixes spurious space around .EPS files produced
+       with the EPS backend.
+
 2006-08-21  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * lily/stencil-scheme.cc (LY_DEFINE): make extent arguments optional.
+
        * lily/hara-kiri-engraver.cc (process_music): remember
        keepAliveInterfaces after processing \set
 
index f999a0750adb06b3bb2b7b1e5de2337d2ab24926..5d2ecdff2a070fa89ffcd448a5f77891c551fffc 100644 (file)
@@ -37,7 +37,12 @@ This file is best viewed outside the collated files document.
     line-width = 15\cm
     %rigthmargin = 3\cm
     interscoreline = 3\cm
-}
+
+    annotate-spacing = ##t
+
+
+    
+  }
 
 
 \book {
index 66f182593186240567c0b34a38e71a71565fb075..2669e14808b2ad8f12def8efed9e8d8585008d77 100644 (file)
@@ -213,23 +213,37 @@ LY_DEFINE (ly_stencil_add, "ly:stencil-add",
 }
 
 LY_DEFINE (ly_make_stencil, "ly:make-stencil",
-          3, 0, 0, (SCM expr, SCM xext, SCM yext),
+          1, 2, 0, (SCM expr, SCM xext, SCM yext),
           " \n"
           "Stencils are a device independent output expressions."
           "They carry two pieces of information: \n\n"
           "1: a specification of how to print this object. "
           "This specification is processed by the output backends, "
           " for example @file{scm/output-ps.scm}.\n\n"
-          "2: the vertical and horizontal extents of the object.\n\n")
+          "2: the vertical and horizontal extents of the object.\n\n"
+          "If the extents are unspecified, they are taken  to be empty."
+          )
 {
   SCM_ASSERT_TYPE (!scm_is_pair (expr)
                   || is_stencil_head (scm_car (expr)),
                   expr, SCM_ARG1, __FUNCTION__, "registered stencil expression");
 
-  SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair");
-  SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");
 
-  Box b (ly_scm2interval (xext), ly_scm2interval (yext));
+  Interval x; 
+  if (xext != SCM_UNDEFINED)
+    {
+      SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair");
+      x = ly_scm2interval (xext);
+    }
+
+  Interval y; 
+  if (yext != SCM_UNDEFINED)
+    {
+      SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");
+      y = ly_scm2interval (yext);
+    }
+
+  Box b (x, y);
   Stencil s (b, expr);
   return s.smobbed_copy ();
 }
index 802c92ca17099a2969b19e59030ed73af12fba4d..83bcb40097d99ce941dae27a4a875b86c393b91b 100644 (file)
       )))
 
 (define (make-page-stencil page)
-  "Construct a stencil representing the page from LINES.
-
- Offsets is a list of increasing numbers. They must be negated to
-create offsets.
-"
-
+  "Construct a stencil representing the page from PAGE."
   
 
   (page-translate-systems page)
@@ -258,7 +253,6 @@ create offsets.
        (number (page-page-number page))
 
        ;; TODO: naming paper-height/paper-width not analogous to TeX.
-
        
        (system-xoffset (ly:output-def-lookup layout 'horizontal-shift 0.0))
        (system-separator-markup (ly:output-def-lookup layout 'systemSeparatorMarkup))
@@ -272,10 +266,7 @@ create offsets.
                        (interval-length (ly:stencil-extent (prop 'head-stencil) Y))
                        0.0))
 
-       (page-stencil (ly:make-stencil
-                     '()
-                     (cons (prop 'left-margin) (prop 'paper-width))
-                     (cons (- (prop 'top-margin)) 0)))
+       (page-stencil (ly:make-stencil '()))
 
        (last-system #f)
        (last-y 0.0)
@@ -286,7 +277,7 @@ create offsets.
                                                                  (cons
                                                                   (+ system-xoffset x)
                                                                   (- 0 head-height y (prop 'top-margin)))
-
+                                                                 
                                                                  )))))
        (add-system
        (lambda (system)
@@ -325,18 +316,18 @@ create offsets.
                    lines
                    (append (cdr lines) (list #f)))
          (paper-system-annotate-last (car (last-pair lines)) layout)))
-    
-    (set! page-stencil (ly:stencil-combine-at-edge
-                       page-stencil Y DOWN
-                       (if (and
-                            (ly:stencil? head)
-                            (not (ly:stencil-empty? head)))
-                           head
-                           (ly:make-stencil "" (cons 0 0) (cons 0 0)))
-                           0. 0.))
 
+    (if (and
+        (ly:stencil? head)
+        (not (ly:stencil-empty? head)))
+       
+       (set! page-stencil (ly:stencil-add page-stencil 
+                                          (ly:stencil-translate-axis head
+                                                                     (- 0 head-height (prop 'top-margin)) Y))))
+                                          
     (map add-system lines)
 
+
     (ly:prob-set-property! page 'bottom-system-edge
                           (car (ly:stencil-extent page-stencil Y)))
     (ly:prob-set-property! page 'space-left
@@ -371,6 +362,7 @@ create offsets.
            (ly:output-def-lookup layout 'annotate-page #f))
        (set! page-stencil (annotate-page layout page-stencil)))
 
+
     page-stencil))