From 37af1c8ef0e9a0b7ef3bf25c43ba3e4f4fb8361e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 27 Jun 2014 16:48:19 +0100 Subject: [PATCH] file/convertible: add 'pfd-bytes+bounds8 and many more The 'pfd-bytes+bounds8 format can add extra padding around the image, and the result reports the amount of added padding. This padding can be used to include image output that it outside of the conceptual bounding box, such as an italic glyph that extends beyond its character's width. --- .../file/scribblings/convertible.scrbl | 61 ++++++++++++++++--- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/pkgs/racket-pkgs/racket-doc/file/scribblings/convertible.scrbl b/pkgs/racket-pkgs/racket-doc/file/scribblings/convertible.scrbl index be7f5e2a03..623f8131b2 100644 --- a/pkgs/racket-pkgs/racket-doc/file/scribblings/convertible.scrbl +++ b/pkgs/racket-pkgs/racket-doc/file/scribblings/convertible.scrbl @@ -22,18 +22,46 @@ should be considered standard: @item{@racket['text] --- a string for human-readable text} @item{@racket['gif-bytes] --- a byte string containing a GIF image encoding} @item{@racket['png-bytes] --- a byte string containing a PNG image encoding} - @item{@racket['png@2x-bytes] --- like @racket['png-bytes], but intended drawing at @racket[1/2] scale} + @item{@racket['png-bytes+bounds] --- a list containing a byte string and four numbers; + the byte string contains a PNG document, and the four numbers + are sizing information for the image: the width, height, + descent (included in the height), and extra vertical top space + (included in the height), in that order} + @item{@racket['png-bytes+bounds8] --- a list containing a byte string + and eight numbers; like @racket['png-bytes+bounds], but where + the image encoded that is in the byte string can be padded in + each direction (to allow the drawn region to extend beyond + it's ``bounding box''), where the extra four numbers in the + list specify the amount of padding that was added to the + image: left, right, top, and bottom} + @item{@racket['png@2x-bytes] --- like @racket['png-bytes], but for an + image that is intended for drawing at @racket[1/2] scale} + @item{@racket['png@2x-bytes+bounds] --- like + @racket['png-bytes+bounds], but for an image that is intended + for drawing at @racket[1/2] scale, where the numbers in the result + list are already scaled (e.g, the byte string encodes an image that + is twice as wide as the first number in the resulting list)} + @item{@racket['png@2x-bytes+bounds8] --- like @racket['png-bytes+bounds8], + but but for an image that is intended for drawing at + @racket[1/2] scale, and where the numbers in the result + list are already scaled} @item{@racket['svg-bytes] --- a byte string containing a SVG image encoding} + @item{@racket['svg-bytes+bounds] --- like @racket['png-bytes+bounds], but + for an SVG image} + @item{@racket['svg-bytes+bounds8] --- like @racket['png-bytes+bounds8], but + for an SVG image} @item{@racket['ps-bytes] --- a byte string containing a PostScript document} - @item{@racket['eps-bytes] --- a byte string containing an Encapsulated PostScript document} - @item{@racket['eps-bytes+bounds] --- a list containing a byte string and four numbers; - the byte string contains an Encapsulated PostScript document and the four numbers - are sizing information for the PostScript document, namely the width, height, ascent - and descent in that order} + @item{@racket['eps-bytes] --- a byte string containing an Encapsulated PostScript + document} + @item{@racket['eps-bytes+bounds] --- like @racket['png-bytes+bounds], but, + but for an Encapsulated PostScript document} + @item{@racket['eps-bytes+bounds8] --- like @racket['png-bytes+bounds8], but, + but for an Encapsulated PostScript document} @item{@racket['pdf-bytes] --- a byte string containing a PDF document} - @item{@racket['pdf-bytes+bounds] --- a list containing a byte string and four numbers; - the byte string contains a PDF document and the four numbers are sizing information - for the PDF document, namely the width, height, ascent and descent in that order} + @item{@racket['pdf-bytes+bounds] --- like @racket['png-bytes+bounds], but, + but for an PDF document} + @item{@racket['pdf-bytes+bounds8] --- like @racket['png-bytes+bounds8], but, + but for an PDF document} ] @defthing[prop:convertible struct-type-property?]{ @@ -57,13 +85,26 @@ Returns @racket[#t] if @racket[v] supports the conversion protocol, [(gif-bytes png-bytes png@2x-bytes ps-bytes eps-bytes pdf-bytes svg-bytes) (or/c bytes? (λ (x) (eq? x default)))] - [(eps-bytes+bounds pdf-bytes+bounds) + [(png-bytes+bounds png@2x-bytes+bounds + eps-bytes+bounds pdf-bytes+bounds) (or/c (list/c bytes? (and/c real? (not/c negative?)) (and/c real? (not/c negative?)) (and/c real? (not/c negative?)) (and/c real? (not/c negative?))) (λ (x) (eq? x default)))] + [(png-bytes+bounds8 png@2x-bytes+bounds8 + eps-bytes+bounds8 pdf-bytes+bounds8) + (or/c (list/c bytes? + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?)) + (and/c real? (not/c negative?))) + (λ (x) (eq? x default)))] [else any/c])]{ Requests a data conversion from @racket[v], where @racket[request]