]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/framework-ps.scm
(dump-stencil-as-EPS): robustness: ensure
[lilypond.git] / scm / framework-ps.scm
index 2af732a818ffefb02d18a9238e4f2184161f4909..6968c06e3e180b6c19eb4f9c201ca08750741ad6 100644 (file)
 
 
 (define-public (dump-stencil-as-EPS paper dump-me filename load-fonts?)
+  (define (mm-to-bp-box mmbox)
+    (let*
+       ((scale  (ly:output-def-lookup paper 'outputscale))
+        (box (map 
+              (lambda (x)
+                (inexact->exact
+                 (round (* x scale mm-to-bigpoint)))) mmbox)))
+
+    (list (car box) (cadr box)
+         (max (1+ (car box)) (caddr box))
+         (max (1+ (cadr box)) (cadddr box)))))
+  
   (let*
       ((outputter (ly:make-paper-outputter (format "~a.eps" filename)
                                           "ps"))
        (port (ly:outputter-port outputter))
        (xext (ly:stencil-extent dump-me X))
        (yext (ly:stencil-extent dump-me Y))
-       (scale  (ly:output-def-lookup paper 'outputscale))
+       
        (bbox
        (map
         (lambda (x)
               0.0 x))
         (list (car xext) (car yext)
               (cdr xext) (cdr yext))))
-       (rounded-bbox
-       (map
-        (lambda (x)
-          (inexact->exact
-           (round (* x scale mm-to-bigpoint)))) bbox))
+       (rounded-bbox (mm-to-bp-box bbox))
        (port (ly:outputter-port outputter))
        (header (eps-header paper rounded-bbox load-fonts?)))