From 28be0c6e8938426668937add84c53647790aa736 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 15 Mar 2011 08:52:22 -0500 Subject: [PATCH] adjust the size calculation of picts in the file/convertible connection to take into account the current-ps-setup's scale --- collects/scribble/latex-render.rkt | 12 ++++++------ collects/texpict/private/mrpict-extra.rkt | 13 ++++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 9fc955a379..9a993519b2 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -10,7 +10,8 @@ scheme/string scheme/list setup/main-collects - file/convertible) + file/convertible + racket/draw) (provide render-mixin) (define current-table-mode (make-parameter #f)) @@ -249,12 +250,11 @@ (image-element-scale e) fn))] [(and (convertible? e) (not (disable-images)) - (let ([ftag (lambda (v suffix) (and v (list v suffix)))] - [xlist (lambda (v) (and v (list v #f #f #f #f)))]) + (let ([ftag (lambda (v suffix) (and v (list v suffix)))]) (or (ftag (convert e 'pdf-bytes+bounds) ".pdf") - (ftag (xlist (convert e 'pdf-bytes)) ".pdf") - (ftag (xlist (convert e 'eps-bytes)) ".ps") - (ftag (xlist (convert e 'png-bytes)) ".png")))) + (ftag (list (convert e 'pdf-bytes) #f #f #f #f) ".pdf") + (ftag (list (convert e 'eps-bytes) #f #f #f #f) ".ps") + (ftag (list (convert e 'png-bytes) #f #f #f #f) ".png")))) => (lambda (bstr+info+suffix) (let* ([bstr (list-ref (list-ref bstr+info+suffix 0) 0)] [suffix (list-ref bstr+info+suffix 1)] diff --git a/collects/texpict/private/mrpict-extra.rkt b/collects/texpict/private/mrpict-extra.rkt index b9aaed66aa..734d86590a 100644 --- a/collects/texpict/private/mrpict-extra.rkt +++ b/collects/texpict/private/mrpict-extra.rkt @@ -448,11 +448,14 @@ (define (convert-pict p format default) (if (eq? format 'pdf-bytes+bounds) - (list (convert-pict/bytes p 'pdf-bytes default) - (pict-width p) - (pict-height p) - (pict-descent p) - 0) + (let ([xscale (box 1.0)] + [yscale (box 1.0)]) + (send (current-ps-setup) get-scaling xscale yscale) + (list (convert-pict/bytes p 'pdf-bytes default) + (* (unbox xscale) (pict-width p)) + (* (unbox yscale) (pict-height p)) + (* (unbox yscale) (pict-descent p)) + 0)) (convert-pict/bytes p format default))) (define (convert-pict/bytes p format default)