org.jfree.text
Class G2TextMeasurer

java.lang.Object
  extended by org.jfree.text.G2TextMeasurer
All Implemented Interfaces:
TextMeasurer

public class G2TextMeasurer
extends java.lang.Object
implements TextMeasurer

A TextMeasurer based on a Graphics2D.

Author:
David Gilbert

Constructor Summary
G2TextMeasurer(java.awt.Graphics2D g2)
          Creates a new text measurer.
 
Method Summary
 float getStringWidth(java.lang.String text, int start, int end)
          Returns the string width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

G2TextMeasurer

public G2TextMeasurer(java.awt.Graphics2D g2)
Creates a new text measurer.

Parameters:
g2 - the graphics device.
Method Detail

getStringWidth

public float getStringWidth(java.lang.String text,
                            int start,
                            int end)
Returns the string width.

Specified by:
getStringWidth in interface TextMeasurer
Parameters:
text - the text.
start - the index of the first character to measure.
end - the index of the last character to measure.
Returns:
The string width.