package eu.greenlightning.hypercubepdf.text;

import java.io.IOException;

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

public class HCPNormalText extends HCPAbstractText {
	
	public HCPNormalText(String text, HCPStyle style) {
		super(text, style);
	}

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

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

	@Override
	protected void paintText(PDPageContentStream content, float x, float y) throws IOException {
		content.beginText();
		style.apply(content);
		content.setTextTranslation(x, y - style.getDescent());
		content.drawString(text);
		content.endText();
	}

}

@@ -132,62 +132,457 @@
 m;%0A%0A
-public class HCPNormalText extends HCPAbstractText %7B%0A%09
+/**%0A * A simple text element, which paints a single line of text.%0A * %3Cp%3E%0A * This class is immutable.%0A * %0A * @author Green Lightning%0A */%0Apublic class HCPNormalText extends HCPAbstractText %7B%0A%09%0A%09/**%0A%09 * Constructs a %7B@link HCPNormalText%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 HCPNormalText.