+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
}
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 ();
}
)))
(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)
(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))
(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)
(cons
(+ system-xoffset x)
(- 0 head-height y (prop 'top-margin)))
-
+
)))))
(add-system
(lambda (system)
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
(ly:output-def-lookup layout 'annotate-page #f))
(set! page-stencil (annotate-page layout page-stencil)))
+
page-stencil))