org.jfree.report.layout
Interface SizeCalculator

All Known Implementing Classes:
DefaultSizeCalculator

public interface SizeCalculator

The interface for an class that is able to calculate the width of a given string, and the height of a line of text. The calculations rely on state information (e.g. font size, graphics device, etc) maintained by the calculator.

Every LayoutSupport can create an instance of a class that implements this interface, via the LayoutSupport.createTextSizeCalculator(org.jfree.report.style.FontDefinition) method.

Author:
Thomas Morgner

Field Summary
static java.lang.String CLIP_TEXT
           
static java.lang.String USE_MAX_CHAR_SIZE
           
 
Method Summary
 float getLineHeight()
          Returns the line height.
 float getStringWidth(java.lang.String text, int lineStartPos, int endPos)
          Calculates the width of a String in the current Graphics context.
 

Field Detail

USE_MAX_CHAR_SIZE

public static final java.lang.String USE_MAX_CHAR_SIZE

CLIP_TEXT

public static final java.lang.String CLIP_TEXT
Method Detail

getStringWidth

public float getStringWidth(java.lang.String text,
                            int lineStartPos,
                            int endPos)
Calculates the width of a String in the current Graphics context.
Parameters:
text - the text.
lineStartPos - the start position of the substring to be measured.
endPos - the position of the last character to be measured.
Returns:
the width of the string in Java2D units.

getLineHeight

public float getLineHeight()
Returns the line height. This includes the font's ascent, descent and leading.
Returns:
the line height.