public class TextWidthUtils
extends java.lang.Object
| Constructor and Description |
|---|
TextWidthUtils() |
| Modifier and Type | Method and Description |
|---|---|
static float |
getCharWidth(char c,
float boldOffset,
boolean bold)
Get the width of a char using the default widths.
|
static float[] |
getCharWidths()
Get the default char widths array.
|
static float |
getComponentWidth(ATextComponent component)
Calculate the width of a component using the default widths.
|
static float |
getComponentWidth(ATextComponent component,
float[] widths)
Calculate the width of a component using the given widths array.
|
static float |
getComponentWidth(ATextComponent component,
float[] widths,
float boldOffset)
Calculate the width of a component using the given widths array.
|
public static float[] getCharWidths()
charwidths.bin resource.java.lang.IllegalStateException - If the charwidths.bin resource could not be foundjava.lang.RuntimeException - If the charwidths.bin resource could not be readpublic static float getCharWidth(char c,
float boldOffset,
boolean bold)
charwidths.bin resource.c - The char to calculate the width ofboldOffset - The bold offsetbold - If the char is boldjava.lang.IllegalStateException - If the charwidths.bin resource could not be foundjava.lang.RuntimeException - If the charwidths.bin resource could not be readpublic static float getComponentWidth(ATextComponent component)
charwidths.bin resource.component - The component to calculate the width ofjava.lang.IllegalStateException - If the charwidths.bin resource could not be foundjava.lang.RuntimeException - If the charwidths.bin resource could not be readpublic static float getComponentWidth(ATextComponent component, float[] widths)
component - The component to calculate the width ofwidths - The char widths arraypublic static float getComponentWidth(ATextComponent component, float[] widths, float boldOffset)
component - The component to calculate the width ofwidths - The char widths arrayboldOffset - The bold offset