public class MalisisFont
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected CharData[] |
charData
Data for each character
|
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 |
|---|---|
java.lang.String |
clipString(java.lang.String text,
int width)
Clips a string to fit in the specified width.
|
java.lang.String |
clipString(java.lang.String text,
int width,
float fontScale)
Clips a string to fit in the specified width with the fontScale.
|
java.lang.String |
clipString(java.lang.String text,
int width,
float fontScale,
boolean appendPeriods) |
protected void |
drawLineChar(CharData cd,
float offsetX,
float offsetY,
float factor) |
void |
generateTexture(boolean debug) |
float |
getCharWidth(char c)
Gets the rendering width of a char.
|
float |
getCharWidth(char c,
float fontScale)
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,
float fontScale)
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(float fontScale)
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,
float fontScale)
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) |
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 text,
int maxWidth,
float fontScale)
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
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 Shape getShape(java.lang.String text, float fontSize)
public void render(MalisisRenderer renderer, java.lang.String text, float x, float y, float z, FontRenderOptions fro)
protected void drawLineChar(CharData cd, float offsetX, float offsetY, float factor)
public java.lang.String processString(java.lang.String str,
FontRenderOptions fro)
str - the strpublic java.lang.String clipString(java.lang.String text,
int width)
text - the textwidth - the widthpublic java.lang.String clipString(java.lang.String text,
int width,
float fontScale)
text - the textwidth - the widthfontScale - the font scalepublic java.lang.String clipString(java.lang.String text,
int width,
float fontScale,
boolean appendPeriods)
public float getStringWidth(java.lang.String str)
str - the strpublic float getStringWidth(java.lang.String str,
float fontScale)
str - the strfontScale - the font scalepublic float getStringHeight()
public float getStringHeight(float fontScale)
fontScale - the font scalepublic float getMaxStringWidth(java.util.List<java.lang.String> strings)
strings - the stringspublic float getMaxStringWidth(java.util.List<java.lang.String> strings,
float fontScale)
strings - the stringsfontScale - the font scalepublic float getCharWidth(char c)
c - the cpublic float getCharWidth(char c,
float fontScale)
c - the cfontScale - the font scalepublic 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 text,
int maxWidth,
float fontScale)
text - the textmaxWidth - the max widthfontScale - the font scaleprotected 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)