package eu.greenlightning.hypercubepdf.text;

import java.io.IOException;

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;

public class HCPSideText extends HCPAbstractText {

	public HCPSideText(String text, HCPStyle style) {
		super(text, style);
	}

	@Override
	public float getWidth() throws IOException {
		return style.getHeight();
	}

	@Override
	public float getHeight() throws IOException {
		return style.getStringWidth(text);
	}

	@Override
	protected void paintText(PDPageContentStream content, float x, float y) throws IOException {
		content.beginText();
		style.apply(content);
		content.setTextRotation(Math.PI / 2, x + getWidth() + style.getDescent(), y);
		content.drawString(text);
		content.endText();
	}

}

@@ -132,59 +132,476 @@
 m;%0A%0A
-public class HCPSideText extends HCPAbstractText %7B%0A
+/**%0A * A text element which paints a single line of text rotated by 90%C2%B0 counterclockwise.%0A * %3Cp%3E%0A * This class is immutable.%0A * %0A * @author Green Lightning%0A */%0Apublic class HCPSideText extends HCPAbstractText %7B%0A%0A%09/**%0A%09 * Constructs a %7B@link HCPSideText%7D from a %7B@link String%7D and an %7B@link HCPStyle%7D.%0A%09 * %0A%09 * @param text not %7B@code null%7D; line breaks are ignored%0A%09 * @param style not %7B@code null%7D%0A%09 * @throws NullPointerException if text or style is %7B@code null%7D%0A%09 */
 %0A%09pu

Document HCPSideText.