Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Matthias Felleisen
> On Jul 22, 2017, at 1:34 PM, kay wrote: > > When using 2htdp/image to create a text image, is this possible to specify a > "bounding box" for the image, so that the text could be wrapped to fit that > box? > > E.g., below line: > > (text "This wide, sharp telescopic view reveals galaxies

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Neil Van Dyke
Notes on text wrapping/layout for anyone interested... There are a lot of approaches just for wrapping lines of text (even before you get into interacting with other aspects of page layout). The simplest is to assume a fixed-pitch font and a known max character width per line, and just scan t

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread WarGrey Gyoudmon Ju
Yes, but you must implement it yourself. This simplest one works for fixed-width font (implemented with pict-lib, you get the idea): (define desc (lambda [txt size width #:head [head (blank 0 0)] #:style [fstyle null]] (define {desc0 txt size width fstyle} (call-with-current-continuat

Re: [racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread Robby Findler
This is a function that you'd have to implement yourself. You could break the string up on spaces and then put them beside or above each other, as appropriate. (A real word processing program uses a more complex algorithm that involves adjusting the spaces between words (and possibly elsewhere, I a

[racket-users] Wrap long text in 2htdp/image

2017-07-22 Thread kay
When using 2htdp/image to create a text image, is this possible to specify a "bounding box" for the image, so that the text could be wrapped to fit that box? E.g., below line: (text "This wide, sharp telescopic view reveals galaxies scattered beyond the stars of the Milky Way at the northern