afreechart/src/main/java/org/afree/chart/title/TextTitle.java
/**
     * Arranges the content for this title assuming a fixed width and no bounds
     * on the height, and returns the required size. This will reflect the fact
     * that a text title positioned on the left or right of a chart will be
     * rotated by 90 degrees.
     * 
     * @param canvas
     *            the graphics target.
     * @param w
     *            the width.
     * 
     * @return The content size.
     * 
     * @since JFreeChart 1.0.9
     */
Arranges the content for this title assuming a fixed width and no bounds
on the height, and returns the required size. This will reflect the fact
that a text title positioned on the left or right of a chart will be
rotated by 90 degrees.

@param canvas
the graphics target.
@param w
the width.

@return The content size.


Arranges the content for this title assuming a fixed width and no bounds on the height and returns the required size . This will reflect the fact that a text title positioned on the left or right of a chart will be rotated by 90 degrees . @param canvas the graphics target . @param w the width . @return The content size .
protected Size2D arrangeFN(Canvas canvas, double w) {
        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) w;
            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.MAX_VALUE;
            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 arrangeFN ( Canvas canvas , double w ) { 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 ) w ; 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 . MAX_VALUE ; 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." ) ; } }
Arranges the content for this title assuming a fixed width and no bounds
 on the height, and returns the required size.
Arranges the content for this title assuming a fixed width and no bounds on the height and returns the required size .
// transpose the dimensions, because the title is rotated