I create png Images from short pieces of text to be used as floating labels, prompts, speechbubbles, etc in a 3D graphics application. Occasionally some of my text needs to be rotated. Unfortunately the 3D application does not provide rotation for this kind of image. I have it fully working for both rotated and non-rotated text, and even the rotated images are drawn correctly if the text is short, but if I use a longer string, it gets cut off because the BufferedImage is not sized to handle it. Do I need to use trigonometry to size it? I know I could always use a huge rectangle in the BufferedImage, but that seems inelegant.
Note that I only ever create single lines of text. If I need multiple lines occasionally, I use multiple images and stack them, it just works better for me that way.