afreechart/src/main/java/org/afree/chart/title/TextTitle.java
/**
     * Returns the content size for the title. This will reflect the fact that a
     * text title positioned on the left or right of a chart will be rotated 90
     * degrees.
     * 
     * @param canvas
     *            the graphics device.
     * @param widthRange
     *            the width range.
     * @param heightRange
     *            the height range.
     * 
     * @return The content size.
     */
Returns the content size for the title. This will reflect the fact that a
text title positioned on the left or right of a chart will be rotated 90
degrees.

@param canvas
the graphics device.
@param widthRange
the width range.
@param heightRange
the height range.

@return The content size.
Returns the content size for the title . This will reflect the fact that a text title positioned on the left or right of a chart will be rotated 90 degrees . @param canvas the graphics device . @param widthRange the width range . @param heightRange the height range . @return The content size .
protected Size2D arrangeRR(Canvas canvas, Range widthRange, Range heightRange) {
        RectangleEdge position = getPosition();
        Paint paint = PaintUtility.createPaint(Paint.ANTI_ALIAS_FLAG, this.paintType, this.font);
        if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {
            float maxWidth = (float) widthRange.getUpperBound();
            this.content = TextUtilities.createTextBlock(this.text, this.font,
                    this.paintType, maxWidth, this.maximumLinesToDisplay,
                    new G2TextMeasurer(paint));
            this.content.setLineAlignment(this.textAlignment);
            Size2D contentSize = this.content.calculateDimensions(canvas);
            if (this.expandToFitSpace) {
                return new Size2D(maxWidth, contentSize.getHeight());
            } else {
                return contentSize;
            }
        } else if (position == RectangleEdge.LEFT
                || position == RectangleEdge.RIGHT) {
            float maxWidth = (float) heightRange.getUpperBound();
            this.content = TextUtilities.createTextBlock(this.text, this.font,
                    this.paintType, maxWidth, this.maximumLinesToDisplay,
                    new G2TextMeasurer(paint));
            this.content.setLineAlignment(this.textAlignment);
            Size2D contentSize = this.content.calculateDimensions(canvas);
            if (this.expandToFitSpace) {
                return new Size2D(contentSize.getHeight(), maxWidth);
            } else {
                return new Size2D(contentSize.height, contentSize.width);
            }
        } else {
            throw new RuntimeException("Unrecognised exception.");
        }
    }
protected Size2D arrangeRR ( Canvas canvas , Range widthRange , Range heightRange ) { RectangleEdge position = getPosition ( ) ; Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , this . paintType , this . font ) ; if ( position == RectangleEdge . TOP || position == RectangleEdge . BOTTOM ) { float maxWidth = ( float ) widthRange . getUpperBound ( ) ; this . content = TextUtilities . createTextBlock ( this . text , this . font , this . paintType , maxWidth , this . maximumLinesToDisplay , new G2TextMeasurer ( paint ) ) ; this . content . setLineAlignment ( this . textAlignment ) ; Size2D contentSize = this . content . calculateDimensions ( canvas ) ; if ( this . expandToFitSpace ) { return new Size2D ( maxWidth , contentSize . getHeight ( ) ) ; } else { return contentSize ; } } else if ( position == RectangleEdge . LEFT || position == RectangleEdge . RIGHT ) { float maxWidth = ( float ) heightRange . getUpperBound ( ) ; this . content = TextUtilities . createTextBlock ( this . text , this . font , this . paintType , maxWidth , this . maximumLinesToDisplay , new G2TextMeasurer ( paint ) ) ; this . content . setLineAlignment ( this . textAlignment ) ; Size2D contentSize = this . content . calculateDimensions ( canvas ) ; if ( this . expandToFitSpace ) { return new Size2D ( contentSize . getHeight ( ) , maxWidth ) ; } else { return new Size2D ( contentSize . height , contentSize . width ) ; } } else { throw new RuntimeException ( "Unrecognised exception." ) ; } }
Returns the content size for the title.
Returns the content size for the title .
// canvas.setFont(this.font); // canvas.setFont(this.font); // transpose the dimensions, because the title is rotated