creating a String Shape of specified size
posted 16 years ago
Given a rectangle of some arbitrary size, I need to create a Shape that represents a string that will fit inside the rectangle. I've read some things about TextLayout and GlyphVector which say that I can get a Shape object that represents the outline of my text. However, it seems to create these things, I need a Font. That leads to specifying a font size, and possibly to getting a FontRenderContext. But at the time I'm setting up the text, I don't have a Graphics2D object at my disposal, so all the stuff about LineMetrics and sizing is not available. Does anyone have an idea about how to do this? I think I'm in over my head.