com.jrefinery.report.targets.base.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(com.jrefinery.report.targets.FontDefinition) method.

Author:
Thomas Morgner

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.
 

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.