public class RenderableString
extends java.lang.Object
Drawing a renderable string is faster than drawing a regular string. This optimization is done by caching the index
within the font of every character of the string as soon as the renderable string is created. However a
RenderableString consumes significant heap memory.
| Constructor and Description |
|---|
RenderableString(java.lang.String string,
Font font)
Creates a renderable string.
|
| Modifier and Type | Method and Description |
|---|---|
char[] |
getCharArray()
Returns the characters array associated with this renderable string.
|
Font |
getFont()
Returns the font associated with this renderable string.
|
int |
getHeight()
Returns the height of the graphical bounds of this renderable string.
|
int[] |
getIndices()
Returns the array of characters indices associated with this renderable string.
|
java.lang.String |
getString()
Returns the string associated with this renderable string.
|
int |
getWidth()
Returns the width of the graphical bounds of this renderable string.
|
public RenderableString(java.lang.String string,
Font font)
string - the string to draw.font - the font to use in order to draw the string.public java.lang.String getString()
public char[] getCharArray()
Same array is always returned, contrary to renderableString.getString().toCharArray().. By
consequence its content must not be modified.
String.toCharArray()public int[] getIndices()
Same array is always returned; by consequence its content must not be modified.
public Font getFont()
public int getWidth()
This method has the same specifications as Font.stringWidth(String).
public int getHeight()
This method has the same specifications as Font.getHeight().