public class G2TextMeasurer extends java.lang.Object implements TextMeasurer
TextMeasurer
based on a Graphics2D
.Constructor and Description |
---|
G2TextMeasurer(java.awt.Graphics2D g2)
Creates a new text measurer.
|
Modifier and Type | Method and Description |
---|---|
float |
getStringWidth(java.lang.String text,
int start,
int end)
Returns the string width.
|
public G2TextMeasurer(java.awt.Graphics2D g2)
g2
- the graphics device.public float getStringWidth(java.lang.String text, int start, int end)
getStringWidth
in interface TextMeasurer
text
- the text.start
- the index of the first character to measure.end
- the index of the last character to measure.