afreechart/src/main/java/org/afree/chart/text/TextLine.java
/**
     * Calculates the width and height of the text line.
     * 
     * @param canvas
     *            the graphics device.
     * 
     * @return The width and height.
     */
Calculates the width and height of the text line.

@param canvas
the graphics device.

@return The width and height.
Calculates the width and height of the text line . @param canvas the graphics device . @return The width and height .
public Size2D calculateDimensions(final Canvas canvas) {
        double width = 0.0;
        double height = 0.0;
        final Iterator iterator = this.fragments.iterator();
        while (iterator.hasNext()) {
            final TextFragment fragment = (TextFragment) iterator.next();
            final Size2D dimension = fragment.calculateDimensions(canvas);
            width = width + dimension.getWidth();
            height = Math.max(height, dimension.getHeight());
        }
        return new Size2D(width, height);
    }
public Size2D calculateDimensions ( final Canvas canvas ) { double width = 0.0 ; double height = 0.0 ; final Iterator iterator = this . fragments . iterator ( ) ; while ( iterator . hasNext ( ) ) { final TextFragment fragment = ( TextFragment ) iterator . next ( ) ; final Size2D dimension = fragment . calculateDimensions ( canvas ) ; width = width + dimension . getWidth ( ) ; height = Math . max ( height , dimension . getHeight ( ) ) ; } return new Size2D ( width , height ) ; }
Calculates the width and height of the text line.
Calculates the width and height of the text line .