From 970b040d172af1f0a7a1533c455bb9d0f2ff8fa3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 27 Jun 2014 11:05:28 +0100 Subject: [PATCH] racket/draw: fix bounding box in `post-script-dc%` EPS output Write the requested size instead of the actual bounding box of the drawn image. --- .../draw-lib/racket/draw/private/post-script-dc.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/draw-pkgs/draw-lib/racket/draw/private/post-script-dc.rkt b/pkgs/draw-pkgs/draw-lib/racket/draw/private/post-script-dc.rkt index 7a70506a78..ea22e3aa13 100644 --- a/pkgs/draw-pkgs/draw-lib/racket/draw/private/post-script-dc.rkt +++ b/pkgs/draw-pkgs/draw-lib/racket/draw/private/post-script-dc.rkt @@ -123,7 +123,12 @@ (unless pdf? (when (and s as-eps) - (cairo_ps_surface_set_eps s #t)) + (cairo_ps_surface_set_eps s #t) + ;; Cairo writes a %%BoundingBox that covers only the drawn points, + ;; which arguably matches the EPS spec, but that isn't what we want. + ;; Fortunately, Cairo will suppress its own %%BoundingBox if we + ;; write one: + (cairo_ps_surface_dsc_comment s (format "%%BoundingBox: ~a ~a ~a ~a" 0 0 width height))) (when (and s landscape?) (cairo_ps_surface_dsc_comment s "%%Orientation: Landscape")))