@Environment(value=CLIENT) public class TextRenderer extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
int |
fontHeight |
private FontStorage |
fontStorage |
Random |
random |
private boolean |
rightToLeft |
private TextureManager |
textureManager |
Constructor and Description |
---|
TextRenderer(TextureManager textureManager,
FontStorage fontStorage) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
draw(String text,
float x,
float y,
int color) |
int |
draw(String text,
float x,
float y,
int color,
boolean shadow,
Matrix4f matrix,
VertexConsumerProvider vertexConsumerProvider,
boolean seeThrough,
int backgroundColor,
int light) |
private int |
draw(String text,
float x,
float y,
int color,
Matrix4f matrix,
boolean shadow) |
private void |
drawGlyph(GlyphRenderer glyphRenderer,
boolean bold,
boolean italic,
float weight,
float x,
float y,
Matrix4f matrix,
VertexConsumer vertexConsumer,
float red,
float green,
float blue,
float alpha,
int light) |
private int |
drawInternal(String text,
float x,
float y,
int color,
boolean shadow,
Matrix4f matrix,
VertexConsumerProvider vertexConsumerProvider,
boolean seeThrough,
int backgroundColor,
int light) |
private float |
drawLayer(String text,
float x,
float y,
int color,
boolean shadow,
Matrix4f matrix,
VertexConsumerProvider vertexConsumerProvider,
boolean seeThrough,
int underlineColor,
int light) |
void |
drawTrimmed(String text,
int x,
int y,
int maxWidth,
int color) |
int |
drawWithShadow(String text,
float x,
float y,
int color) |
private void |
drawWrapped(String text,
int x,
int y,
int maxWidth,
int color) |
int |
findWordEdge(String text,
int direction,
int position,
boolean skipWhitespaceToRightOfWord) |
int |
getCharacterCountForWidth(String text,
int offset) |
float |
getCharWidth(char character) |
int |
getStringBoundedHeight(String text,
int maxWidth) |
int |
getStringWidth(String text) |
boolean |
isRightToLeft() |
String |
mirror(String text) |
void |
setFonts(List<Font> fonts) |
void |
setRightToLeft(boolean rightToLeft) |
private String |
trimEndNewlines(String text) |
String |
trimToWidth(String text,
int width) |
String |
trimToWidth(String text,
int width,
boolean rightToLeft) |
String |
wrapStringToWidth(String text,
int width) |
List<String> |
wrapStringToWidthAsList(String text,
int width) |
public final int fontHeight
public final Random random
private final TextureManager textureManager
private final FontStorage fontStorage
private boolean rightToLeft
public TextRenderer(TextureManager textureManager, FontStorage fontStorage)
public void close()
close
in interface AutoCloseable
public int drawWithShadow(String text, float x, float y, int color)
public int draw(String text, float x, float y, int color)
public int draw(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int backgroundColor, int light)
private int drawInternal(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int backgroundColor, int light)
private float drawLayer(String text, float x, float y, int color, boolean shadow, Matrix4f matrix, VertexConsumerProvider vertexConsumerProvider, boolean seeThrough, int underlineColor, int light)
private void drawGlyph(GlyphRenderer glyphRenderer, boolean bold, boolean italic, float weight, float x, float y, Matrix4f matrix, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int light)
public int getStringWidth(String text)
public float getCharWidth(char character)
public void drawTrimmed(String text, int x, int y, int maxWidth, int color)
private void drawWrapped(String text, int x, int y, int maxWidth, int color)
public int getStringBoundedHeight(String text, int maxWidth)
public void setRightToLeft(boolean rightToLeft)
public int getCharacterCountForWidth(String text, int offset)
public int findWordEdge(String text, int direction, int position, boolean skipWhitespaceToRightOfWord)
public boolean isRightToLeft()