public class MalisisFont
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected CharData[] |
charData
Data for each character
|
protected boolean |
drawingShadow
Whether the currently drawn text is the shadow part
|
protected java.awt.Font |
font
AWT font used
|
protected java.awt.font.FontRenderContext |
frc
Font render context
|
static MalisisFont |
minecraftFont |
protected FontGeneratorOptions |
options
Options for the font
|
protected int |
size
Size of the texture (width and height)
|
protected net.minecraft.util.ResourceLocation |
textureRl
ResourceLocation for the texture
|
| Constructor and Description |
|---|
MalisisFont(java.io.File fontFile) |
MalisisFont(java.io.File fontFile,
FontGeneratorOptions options) |
MalisisFont(java.awt.Font font) |
MalisisFont(java.awt.Font font,
FontGeneratorOptions options) |
MalisisFont(net.minecraft.util.ResourceLocation fontFile) |
MalisisFont(net.minecraft.util.ResourceLocation fontFile,
FontGeneratorOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clean(MalisisRenderer<?> renderer,
boolean isDrawing) |
protected void |
cleanLines(MalisisRenderer<?> renderer) |
protected void |
cleanShadow(MalisisRenderer<?> renderer) |
java.lang.String |
clipString(java.lang.String str,
int width)
Clips a string to fit in the specified width.
|
java.lang.String |
clipString(java.lang.String str,
int width,
FontRenderOptions fro)
Clips a string to fit in the specified width.
|
java.lang.String |
clipString(java.lang.String str,
int width,
FontRenderOptions fro,
boolean appendPeriods)
Clips a string to fit in the specified width.
|
protected void |
drawChar(CharData cd,
float offsetX,
float offsetY,
FontRenderOptions fro) |
protected void |
drawLineChar(CharData cd,
float offsetX,
float offsetY,
FontRenderOptions fro) |
protected void |
drawLines(java.lang.String text,
FontRenderOptions fro) |
protected void |
drawString(java.lang.String text,
FontRenderOptions fro) |
void |
generateTexture(boolean debug) |
CharData |
getCharData(char c) |
float |
getCharPosition(java.lang.String str,
FontRenderOptions fro,
int position,
int charOffset)
Determines the character for a given X coordinate.
|
float |
getCharWidth(char c)
Gets the rendering width of a char.
|
float |
getCharWidth(char c,
FontRenderOptions fro)
Gets the rendering width of a char with the specified fontScale.
|
float |
getMaxStringWidth(java.util.List<java.lang.String> strings)
Gets the max string width.
|
float |
getMaxStringWidth(java.util.List<java.lang.String> strings,
FontRenderOptions fro)
Gets max rendering width of an array of string.
|
net.minecraft.util.ResourceLocation |
getResourceLocation() |
Shape |
getShape(java.lang.String text,
float fontSize) |
float |
getStringHeight()
Gets the rendering height of strings.
|
float |
getStringHeight(FontRenderOptions fro)
Gets the rendering height of strings according to fontscale.
|
float |
getStringWidth(java.lang.String str)
Gets rendering width of a string.
|
float |
getStringWidth(java.lang.String str,
FontRenderOptions fro) |
float |
getStringWidth(java.lang.String str,
FontRenderOptions fro,
int start,
int end)
Gets rendering width of a string according to fontScale.
|
static java.awt.Font |
load(java.io.File file,
FontGeneratorOptions options) |
static java.awt.Font |
load(java.io.InputStream is,
FontGeneratorOptions options) |
static java.awt.Font |
load(net.minecraft.util.ResourceLocation rl,
FontGeneratorOptions options) |
protected void |
loadCharacterData() |
protected void |
loadTexture(boolean forceGenerate) |
protected void |
prepare(MalisisRenderer<?> renderer,
float x,
float y,
float z,
FontRenderOptions fro) |
protected void |
prepareLines(MalisisRenderer<?> renderer,
FontRenderOptions fro) |
protected void |
prepareShadow(MalisisRenderer<?> renderer) |
java.lang.String |
processString(java.lang.String str,
FontRenderOptions fro)
Processes the passed string by translating it and replacing spacing characters and new lines.
|
protected java.awt.image.BufferedImage |
readTextureFile(java.io.File textureFile) |
protected void |
readUVFile(java.io.File uvFile) |
void |
render(MalisisRenderer<?> renderer,
java.lang.String text,
float x,
float y,
float z,
FontRenderOptions fro) |
protected int |
roundUp(int n) |
java.util.List<java.lang.String> |
wrapText(java.lang.String text,
int maxWidth)
Splits the string in multiple lines to fit in the specified maxWidth.
|
java.util.List<java.lang.String> |
wrapText(java.lang.String str,
int maxWidth,
FontRenderOptions fro)
Splits the string in multiple lines to fit in the specified maxWidth using the specified fontScale.
|
public static MalisisFont minecraftFont
protected java.awt.Font font
protected java.awt.font.FontRenderContext frc
protected FontGeneratorOptions options
protected CharData[] charData
protected net.minecraft.util.ResourceLocation textureRl
protected int size
protected boolean drawingShadow
public MalisisFont(java.io.File fontFile)
public MalisisFont(java.io.File fontFile,
FontGeneratorOptions options)
public MalisisFont(net.minecraft.util.ResourceLocation fontFile)
public MalisisFont(net.minecraft.util.ResourceLocation fontFile,
FontGeneratorOptions options)
public MalisisFont(java.awt.Font font)
public MalisisFont(java.awt.Font font,
FontGeneratorOptions options)
public net.minecraft.util.ResourceLocation getResourceLocation()
public void generateTexture(boolean debug)
public CharData getCharData(char c)
public Shape getShape(java.lang.String text, float fontSize)
protected void prepare(MalisisRenderer<?> renderer, float x, float y, float z, FontRenderOptions fro)
protected void clean(MalisisRenderer<?> renderer, boolean isDrawing)
protected void prepareShadow(MalisisRenderer<?> renderer)
protected void cleanShadow(MalisisRenderer<?> renderer)
protected void prepareLines(MalisisRenderer<?> renderer, FontRenderOptions fro)
protected void cleanLines(MalisisRenderer<?> renderer)
public void render(MalisisRenderer<?> renderer, java.lang.String text, float x, float y, float z, FontRenderOptions fro)
protected void drawString(java.lang.String text,
FontRenderOptions fro)
protected void drawChar(CharData cd, float offsetX, float offsetY, FontRenderOptions fro)
protected void drawLines(java.lang.String text,
FontRenderOptions fro)
protected void drawLineChar(CharData cd, float offsetX, float offsetY, FontRenderOptions fro)
public java.lang.String processString(java.lang.String str,
FontRenderOptions fro)
str - the strpublic java.lang.String clipString(java.lang.String str,
int width)
str - the strwidth - the widthpublic java.lang.String clipString(java.lang.String str,
int width,
FontRenderOptions fro)
str - the strwidth - the widthfro - the fropublic java.lang.String clipString(java.lang.String str,
int width,
FontRenderOptions fro,
boolean appendPeriods)
str - the strwidth - the widthfro - the froappendPeriods - the append periodspublic float getStringWidth(java.lang.String str)
str - the strpublic float getStringWidth(java.lang.String str,
FontRenderOptions fro,
int start,
int end)
str - the strfro - the frostart - the startend - the endpublic float getStringWidth(java.lang.String str,
FontRenderOptions fro)
public float getStringHeight()
public float getStringHeight(FontRenderOptions fro)
fro - the fropublic float getMaxStringWidth(java.util.List<java.lang.String> strings)
strings - the stringspublic float getMaxStringWidth(java.util.List<java.lang.String> strings,
FontRenderOptions fro)
strings - the stringsfro - the fropublic float getCharWidth(char c)
c - the cpublic float getCharWidth(char c,
FontRenderOptions fro)
c - the cfro - the fropublic float getCharPosition(java.lang.String str,
FontRenderOptions fro,
int position,
int charOffset)
str - the strfro - the froposition - the positioncharOffset - the char offsetpublic java.util.List<java.lang.String> wrapText(java.lang.String text,
int maxWidth)
text - the textmaxWidth - the max widthpublic java.util.List<java.lang.String> wrapText(java.lang.String str,
int maxWidth,
FontRenderOptions fro)
str - the strmaxWidth - the max widthfro - the froprotected void loadCharacterData()
protected int roundUp(int n)
protected void loadTexture(boolean forceGenerate)
protected java.awt.image.BufferedImage readTextureFile(java.io.File textureFile)
protected void readUVFile(java.io.File uvFile)
public static java.awt.Font load(net.minecraft.util.ResourceLocation rl,
FontGeneratorOptions options)
public static java.awt.Font load(java.io.File file,
FontGeneratorOptions options)
public static java.awt.Font load(java.io.InputStream is,
FontGeneratorOptions options)