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.
|
byte[] |
getSNIContext()
Returns the SNI context data of 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 byte[] getSNIContext()
The SNI context can be used to call a native method with SNI. This allows to identify and to use a renderable string in the native world.
The data format is implementation specific.
Font.allocateRenderableStringSNIContext(char[], int, int)
public String getString()
public int getWidth()
This method has the same specifications as Font.stringWidth(String)
.