diff --git a/drracket/drracket/private/language.rkt b/drracket/drracket/private/language.rkt index f186c5eb6..c586a3c07 100644 --- a/drracket/drracket/private/language.rkt +++ b/drracket/drracket/private/language.rkt @@ -405,21 +405,23 @@ (dyn pict-ascent) (dyn pict-descent) (dyn draw-pict) - + (dyn convert-bounds-padding) + (define (mk-pict-snip convertible) + (define-values (l-pad t-pad r-pad b-pad) (apply values (convert-bounds-padding))) (define pict (pict-convert convertible)) (define w (pict-width pict)) - (define aw (abs w)) + (define aw (+ (abs w) l-pad r-pad)) (define h (pict-height pict)) - (define ah (abs h)) - (define a (pict-ascent pict)) - (define d (pict-descent pict)) + (define ah (+ (abs h) t-pad b-pad)) + (define a (+ (pict-ascent pict) t-pad)) + (define d (+ (pict-descent pict) b-pad)) (define rdc (new record-dc%)) (send rdc set-smoothing 'aligned) (send rdc set-clipping-rect 0 0 aw ah) (draw-pict pict rdc - (if (< w 0) aw 0) - (if (< h 0) ah 0)) + (+ (if (< w 0) aw 0) l-pad) + (+ (if (< h 0) ah 0) t-pad)) (define recorded-datum (send rdc get-recorded-datum)) (new pict-snip:pict-snip% [w aw] [h ah] [d d] [a a] [recorded-datum recorded-datum])) diff --git a/drracket/scribblings/drracket/languages.scrbl b/drracket/scribblings/drracket/languages.scrbl index 1448debf3..8efc8f697 100644 --- a/drracket/scribblings/drracket/languages.scrbl +++ b/drracket/scribblings/drracket/languages.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require "common.rkt" (for-label errortrace/errortrace-lib compiler/cm planet/config - racket/pretty drracket/tool drracket/tool-lib)) + racket/pretty drracket/tool drracket/tool-lib pict)) @title[#:tag "languages" #:style 'toc]{Languages} @@ -25,7 +25,7 @@ More generally, when using this mode, the ...)]; aside from comments, the @tech{definitions window} must contain exactly one module. -@subsection{Initial Environment} +@subsection[#:tag "Initial Environment"]{Initial Environment} DrRacket initializes the environment before it starts running the program in ways slightly different than the @tt{racket} command-line binary does to reflect @@ -37,7 +37,8 @@ in the next subsection. DrRacket initializes the @racket[pretty-print-size-hook] and @racket[pretty-print-print-hook] to specially recognize @itemize[@item{@racket[snip%]s, which it just inserts into the editor} - @item{convertible values from @racketmodname[pict/convert]} + @item{convertible values from @racketmodname[pict/convert], which are rendered + with padding specified by @racket[convert-bounds-padding] around the bounding box to reduce edge effects} @item{convertible values from @racketmodname[file/convertible] (which it converts to png images)} @item{numbers that are @racket[exact?] and @racket[real?], but not @racket[integer?], diff --git a/drracket/scribblings/drracket/printing.scrbl b/drracket/scribblings/drracket/printing.scrbl index ad4385556..79347b671 100644 --- a/drracket/scribblings/drracket/printing.scrbl +++ b/drracket/scribblings/drracket/printing.scrbl @@ -89,6 +89,7 @@ the booleans, it determines if there is a @litchar{#} prefix and for the empty list, determines if it prints as @racket[empty] or @racket['()]. For any of the output styles, DrRacket sets the -@racket[global-port-print-handler] so that the @racket[print] +@racket[global-port-print-handler] (as described in @secref["Initial Environment"]) +so that the @racket[print] procedure produces output as selected.