I have a requirement to draw text in a vertical fashion on a Canvas (or JComponent). I thought that it would be easy and a
common requirement but apparently not so.
The Font class includes a deriveFont() method that has as a parameter of an AffineTransform instance. I used a 90degree rotate transform as follows:
Font vFont = hFont.deriveFont(AffineTransform.getRotateInstance(Math.PI / 2))
The effect is to rotate the WRITING DIRECTION not the CHARACTER ORIENTATION. I need both so this isn't very useful.
I have also tried creating from a string a GlyphVector and rotating each glyph. The result is similar to deriving fonts.
I have one solution and that is to convert each character to an image and rotate the image and paint one character at a time, but in the application that I have that is not a very practical solution. I need to end up with an image of an entire character string with each character rotated 90deg counter clockwise and the entire image rotated 90deg clockwise.
Any suggestions would be greatly appreciated.
common requirement but apparently not so.
The Font class includes a deriveFont() method that has as a parameter of an AffineTransform instance. I used a 90degree rotate transform as follows:
Font vFont = hFont.deriveFont(AffineTransform.getRotateInstance(Math.PI / 2))
The effect is to rotate the WRITING DIRECTION not the CHARACTER ORIENTATION. I need both so this isn't very useful.
I have also tried creating from a string a GlyphVector and rotating each glyph. The result is similar to deriving fonts.
I have one solution and that is to convert each character to an image and rotate the image and paint one character at a time, but in the application that I have that is not a very practical solution. I need to end up with an image of an entire character string with each character rotated 90deg counter clockwise and the entire image rotated 90deg clockwise.
Any suggestions would be greatly appreciated.