double tl = getTextDocument().getText().length();
if (tl > 0) {
// TODO calculate the real values
Point p = calculateAlignmentPoint();
bounds.addToBounds(p);
double h = getHeight();
double w = tl * h * 0.6;
if (this.isBackward()) {
w = -1 * w;
}
// we set the horizontal width
switch (this.align) {
case 0:
bounds.addToBounds(p.getX() + w, p.getY(), p.getZ());
break;
case 1:
bounds.addToBounds(p.getX() + (w / 2), p.getY(), p.getZ());
bounds.addToBounds(p.getX() - (w / 2), p.getY(), p.getZ());
break;
case 2:
bounds.addToBounds(p.getX() - w, p.getY(), p.getZ());
break;
case 3:
bounds.addToBounds(p.getX() - w, p.getY(), p.getZ());
break;
case 4:
bounds.addToBounds(p.getX() + (w / 2), p.getY(), p.getZ());
bounds.addToBounds(p.getX() - (w / 2), p.getY(), p.getZ());
break;
case 5:
bounds.addToBounds(p.getX() + (w / 2), p.getY(), p.getZ());
bounds.addToBounds(p.getX() - (w / 2), p.getY(), p.getZ());
break;
}
// set the vertical height
switch (this.valign) {
case VALIGN_BASELINE:
bounds.addToBounds(p.getX(), p.getY() + (h * 0.75), p.getZ());
break;
case VALIGN_BOTTOM:
bounds.addToBounds(p.getX(), p.getY() + h, p.getZ());
break;
case VALIGN_CENTER:
bounds.addToBounds(p.getX(), p.getY() + (h * 0.5), p.getZ());
bounds.addToBounds(p.getX(), p.getY() - (h * 0.5), p.getZ());
break;
case VALIGN_TOP:
bounds.addToBounds(p.getX(), p.getY() - h, p.getZ());
break;
}
} else {
bounds.setValid(false);