]> git.donarmstrong.com Git - lilypond.git/commitdiff
eps inclusion: clip correctly, and strip binary data before examining.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 15:45:32 +0000 (16:45 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 21:35:42 +0000 (22:35 +0100)
scm/stencil.scm

index b2d425e6ead5c7061d7e327c0d08934b9a92dbe4..320b54ee734058cda2f493d5ffb359bd78bbbadc 100644 (file)
@@ -236,14 +236,21 @@ encloses the contents.
 (define-public (eps-file->stencil axis size file-name)
   (let*
       ((contents (ly:gulp-file file-name))
-       (bbox (get-postscript-bbox contents))
+       (bbox (get-postscript-bbox (car (string-split contents #\nul))))
        (bbox-size (if (= axis X)
                      (- (list-ref bbox 2) (list-ref bbox 0))
                      (- (list-ref bbox 3) (list-ref bbox 1))
                      ))
        (factor (exact->inexact (/ size bbox-size)))
        (scaled-bbox
-       (map (lambda (x) (* factor x)) bbox)))
+       (map (lambda (x) (* factor x)) bbox))
+       (clip-rect-string (format
+                         "~a ~a ~a ~a rectclip"
+                         (list-ref bbox 0) 
+                         (list-ref bbox 1) 
+                         (- (list-ref bbox 2) (list-ref bbox 0))
+                         (- (list-ref bbox 3) (list-ref bbox 1)))))
+    
 
     (if bbox
        (ly:make-stencil
@@ -255,9 +262,11 @@ encloses the contents.
 gsave
 currentpoint translate
 BeginEPSF
-~a ~a scale
+~a dup scale
+~a 
 %%BeginDocument: ~a
-"         factor factor
+"         factor clip-rect-string
+
           file-name
           )
           contents