-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Description
many people have written scripts to do this and it's relatively easy with the library's getsize func but I feel like it really should be a built-in feature.
i think there should be a draw_text_box or similar function which has these properties on top of the existing draw_multiline_text:
- you can specify a max width in pixels and Pillow will automatically insert line breaks to keep the text's width under the max width
- I think there should be an option to only break at word boundaries unless the word exceeds the max width, like the CSS word-break property
- you can specify a max height in pixels with one of two behaviors:
- when reaching the max height, the text box is clipped and doesn't draw any more.
- when reaching the max height, the font size is gradually reduced until the text fits inside
- I think a min font size property would be useful here
- also an option to find the biggest font size that fits within the text box
- a max font size property would be useful here
I'm not very experienced with the library internals or C in general so for now I won't make a pull, I just want to throw the idea out there to the devs
jantman, gatienduboc, weisserd, Andrew-Shay, laggron42 and 3 more