Skip to content

Getting multiline_textbbox without an image #6655

Answered by nulano
awhitefox asked this question in Q&A
Discussion options

You must be logged in to vote

Using a dummy image object which works but feels hacky

This is currently the best option.

All multiline text operations, except for font.getsize_multiline (IIRC an exact duplicate of draw.multiline_textsize), are handled in ImageDraw which requires an Image. Moving the draw.multiline_text operation to ImageFont would require significant changes (either rewriting the function in C or taking a significant performance penalty), and draw.multiline_textbbox is quite long (~100 lines), too long to feel good about duplicating the code in ImageFont.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by awhitefox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants