public abstract class TextureTextRenderer extends java.lang.Object implements TextRenderer
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_ANTIALIASING |
static java.awt.Font |
DEFAULT_FONT |
static int |
DEFAULT_SIZE |
Constructor and Description |
---|
TextureTextRenderer(int preferredWidth,
int preferredHeight,
int maxDimension) |
TextureTextRenderer(int preferredWidth,
int preferredHeight,
int maxDimension,
boolean antialiasing) |
Modifier and Type | Method and Description |
---|---|
void |
begin()
Prepare a queue for optimized rendering of characters
|
float |
drawText(java.awt.Font font,
java.lang.String text,
float[] loc,
float emsize)
Renders text with a given font at a provided baseline location.
|
void |
end() |
void |
flush()
Draw characters to screen now
|
java.awt.Font |
getFont() |
int |
getHeight() |
TextImageStore |
getImageStore() |
java.awt.geom.Rectangle2D |
getTextBounds(java.awt.Font font,
java.lang.String text,
float size)
Bounding rectangle.
|
int |
getWidth() |
boolean |
isAntialiasing()
Whether or not antialiasing is enabled
|
void |
setAntialiasing(boolean set)
Enable or disable antialiasing in the backing image store
|
void |
setFont(java.awt.Font font)
Default font to use for methods in which the font
is not specified
|
void |
setPreferredSize(int width,
int height) |
public static boolean DEFAULT_ANTIALIASING
public static java.awt.Font DEFAULT_FONT
public static int DEFAULT_SIZE
public TextureTextRenderer(int preferredWidth, int preferredHeight, int maxDimension)
public TextureTextRenderer(int preferredWidth, int preferredHeight, int maxDimension, boolean antialiasing)
public TextImageStore getImageStore()
public int getWidth()
public int getHeight()
public void setAntialiasing(boolean set)
public boolean isAntialiasing()
public void setFont(java.awt.Font font)
font
- default fontpublic java.awt.Font getFont()
public void begin()
public float drawText(java.awt.Font font, java.lang.String text, float[] loc, float emsize)
drawText
in interface TextRenderer
font
- font to use. Note that the font's size controls the
resolution of the glyphs in the backing texture. The final drawn
font size can be controlled using emsize
. Rendering
might not take place immediately. This class creates a queue
to minimize the number of required changes to a backing texture.
To force a render, use flush()
.text
- text to drawloc
- baseline location to start drawingemsize
- size of an 'em' unitpublic void flush()
public void end()
public java.awt.geom.Rectangle2D getTextBounds(java.awt.Font font, java.lang.String text, float size)
TextRenderer
getTextBounds
in interface TextRenderer
font
- font used for sizingtext
- text to boundsize
- 'em' unit sizepublic void setPreferredSize(int width, int height)