Easiest way to get vertical text

Hi - I’m trying to render some vertically aligned characters like this:


And without the character rotation of an affine transform. Is there an easy way to do this?

I would say the most flexible method would be to make your own, perhaps based on Label. E.g., start with something like this:

[code]class VertLabel : public Label
VertLabel(String text)
: Label(text, text)

void paint(Graphics& g)
	if(isBeingEdited()) return;
	String text = getText();
	const Font& font = getFont();
	const float height = font.getHeight();
	float y = 0;
	for(int i = 0; i < text.length(); ++i)
		g.drawText(text.substring(i, i+1), 0, y, getWidth(), height, Justification::left, false);
		y += height;


Then you get all the behaviour of Label. Making the editibility work elegantly might be tricky but you could override setEditable() to prevent that. Positioning the text in the above example could be more like label (in that perhaps it should be vertically centred or better still based on the Justification of the Label). You could add methods to control the vertical line spacing here too.

Just stumbled upon drawMultiLineText(). Just set a width about half of font size, works like a charm, except I can’t seem to get it to make a new line if there is a ‘space’ character!

g.setFont (fontSize);
g.drawMultiLineText ("Vertical", x , fontSize, fontSize / 2, Justification::centred);