From: Han-Wen Nienhuys Date: Fri, 26 Jan 2007 15:45:32 +0000 (+0100) Subject: eps inclusion: clip correctly, and strip binary data before examining. X-Git-Tag: release/2.11.15-1~36 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f4f77f7d6fedbe9283a253214710996f7e6c657c;p=lilypond.git eps inclusion: clip correctly, and strip binary data before examining. --- diff --git a/scm/stencil.scm b/scm/stencil.scm index 283f04fe2d..32a64fdede 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -274,14 +274,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 @@ -293,9 +300,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