public class RenderableString extends 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(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.
|
String |
getString()
Returns the string associated with this renderable string.
|
int |
getWidth()
Returns the width of the graphical bounds of this renderable string.
|
public char[] getCharArray()
Same array is always returned, contrary to renderableString.getString().toCharArray().
. By
consequence its content must not be modified.
String.toCharArray()
public Font getFont()
public int getHeight()
This method has the same specifications as Font.getHeight()
.
public int[] getIndices()
Same array is always returned; by consequence its content must not be modified.
public String getString()
public int getWidth()
This method has the same specifications as Font.stringWidth(String)
.