|| (position == RectangleEdge.BOTTOM)) {
final float maxWidth = (float) widthRange.getUpperBound();
g2.setFont(this.font);
this.content = TextUtilities.createTextBlock(this.text, this.font,
this.paint, maxWidth, this.maximumLinesToDisplay,
new G2TextMeasurer(g2));
this.content.setLineAlignment(this.textAlignment);
final Size2D contentSize = this.content.calculateDimensions(g2);
if (this.expandToFitSpace) {
return new Size2D(maxWidth, contentSize.getHeight());
} else {
return contentSize;
}
} else if ((position == RectangleEdge.LEFT)
|| (position == RectangleEdge.RIGHT)) {
final float maxWidth = (float) heightRange.getUpperBound();
g2.setFont(this.font);
this.content = TextUtilities.createTextBlock(this.text, this.font,
this.paint, maxWidth, this.maximumLinesToDisplay,
new G2TextMeasurer(g2));
this.content.setLineAlignment(this.textAlignment);
final Size2D contentSize = this.content.calculateDimensions(g2);
// transpose the dimensions, because the title is rotated
if (this.expandToFitSpace) {