public class TTFont
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private com.badlogic.gdx.graphics.g2d.BitmapFont |
BMFont
A core BitMapFont object that the class encapsulates
The class simply serves to take .TTF files and convert them into Bitmap fonts, which can then be rendered in-game
This is the object that can be returned to any other class that desires a BitmapFont
|
private com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator |
TTFGenerator
The internal generator that exists to convert TrueType fonts into Bitmap fonts
|
private com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter |
TTFStyle
The visual parameters that the aforementioned font-generator will acknowledge when generating fonts
|
Constructor and Description |
---|
TTFont(com.badlogic.gdx.files.FileHandle fontFile)
Overloaded TTFont constructor that ignores border/shadow parameters and produces white text of size 16
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
com.badlogic.gdx.graphics.Color color)
Overloaded TTFont constructor that ignores border/shadow parameters and produces coloured text of size 16
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size)
Overloaded TTFont constructor that ignores border/shadow parameters and produces white text
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
com.badlogic.gdx.graphics.Color color)
Overloaded TTFont constructor that ignores border parameters and shadow parameters
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
com.badlogic.gdx.graphics.Color color,
float borderWidth,
com.badlogic.gdx.graphics.Color borderColor,
boolean borderStraight)
Overloaded TTFont constructor that ignores shadow parameters
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
com.badlogic.gdx.graphics.Color color,
float borderWidth,
com.badlogic.gdx.graphics.Color borderColor,
boolean borderStraight,
int shadowOffsetX,
int shadowOffsetY,
com.badlogic.gdx.graphics.Color shadowColor)
Constructor that automatically creates a BitmapFont object from a given .TTF file during the construction of
the TTFont object itself.
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
com.badlogic.gdx.graphics.Color color,
int shadowOffsetX,
int shadowOffsetY,
com.badlogic.gdx.graphics.Color shadowColor)
Overloaded TTFont constructor that ignores border parameters
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
float borderWidth,
com.badlogic.gdx.graphics.Color borderColor,
boolean borderStraight)
Overloaded TTFont constructor that ignores shadow parameters and produces white text
|
TTFont(com.badlogic.gdx.files.FileHandle fontFile,
int size,
int shadowOffsetX,
int shadowOffsetY,
com.badlogic.gdx.graphics.Color shadowColor)
Overloaded TTFont constructor that ignores border parameters and produces white characters
|
Modifier and Type | Method and Description |
---|---|
com.badlogic.gdx.graphics.Color |
borderColor()
Returns the (consistent) colour of the borders around the internal BitmapFont's characters
|
float |
borderWidth()
Returns the (consistent) width of the borders around the internal BitmapFont's characters
|
void |
dispose()
Clears the object's internal font from memory
|
com.badlogic.gdx.graphics.g2d.BitmapFont |
font()
Returns the core BitmapFont generated by the object's font-generator
|
void |
removeBorder()
Removes the borders around the internal BitmapFont's characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the border removal
|
void |
removeShadow()
Removes the shadows beneath the internal BitmapFont's characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the shadow removal
|
void |
setBorder(float borderWidth,
com.badlogic.gdx.graphics.Color borderColor)
Changes the properties of the borders around the internal BitmapFont's characters
This overloaded method produces rounded borders around the resultant BitmapFont's characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the border change
|
void |
setBorder(float borderWidth,
com.badlogic.gdx.graphics.Color borderColor,
boolean borderStraight)
Changes the properties of the borders around the internal BitmapFont's characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the border change
|
void |
setFont(com.badlogic.gdx.files.FileHandle fontFile)
Changes the object to encode a new font from a provided file
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the .TTF file change
|
void |
setShadow(int shadowOffsetX,
int shadowOffsetY,
com.badlogic.gdx.graphics.Color shadowColor)
Changes the properties of the shadows beneath the internal BitmapFont's characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the shadow change
|
void |
setSize(int size)
Changes the (consistent) size of the internal BitmapFont's encoded characters
Internal FreeTypeFontGenerator re-generates the encapsulate BitmapFont following the size change
|
com.badlogic.gdx.graphics.Color |
shadowColor()
Returns the (consistent) colour of the shadows beneath the internal BitmapFont's characters
|
int |
size()
Returns the (consistent) size of the internal BitmapFont's characters
|
private com.badlogic.gdx.graphics.g2d.BitmapFont BMFont
private com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator TTFGenerator
private com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter TTFStyle
public TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, com.badlogic.gdx.graphics.Color color, float borderWidth, com.badlogic.gdx.graphics.Color borderColor, boolean borderStraight, int shadowOffsetX, int shadowOffsetY, com.badlogic.gdx.graphics.Color shadowColor)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontcolor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)borderWidth
- The width of the border encoded by the resulting BitmapFont: a value of 0 disables the borderborderColor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)borderStraight
- Determines whether the border encoded by the resulting BitmapFont is straight or roundedshadowOffsetX
- Determines the X-offset of the shadows beneath all characters in the resulting BitmapFontshadowOffsetY
- Determines the Y-offset of the shadows beneath all characters in the resulting BitmapFontshadowColor
- Determines the colour of the shadows beneath all characters in the resulting BitmapFontpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, com.badlogic.gdx.graphics.Color color, int shadowOffsetX, int shadowOffsetY, com.badlogic.gdx.graphics.Color shadowColor)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontcolor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)shadowOffsetX
- Determines the X-offset of the shadows beneath all characters in the resulting BitmapFontshadowOffsetY
- Determines the Y-offset of the shadows beneath all characters in the resulting BitmapFontshadowColor
- Determines the colour of the shadows beneath all characters in the resulting BitmapFontpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, int shadowOffsetX, int shadowOffsetY, com.badlogic.gdx.graphics.Color shadowColor)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontshadowOffsetX
- Determines the X-offset of the shadows beneath all characters in the resulting BitmapFontshadowOffsetY
- Determines the Y-offset of the shadows beneath all characters in the resulting BitmapFontshadowColor
- Determines the colour of the shadows beneath all characters in the resulting BitmapFontpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, com.badlogic.gdx.graphics.Color color, float borderWidth, com.badlogic.gdx.graphics.Color borderColor, boolean borderStraight)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontcolor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)borderWidth
- The width of the border encoded by the resulting BitmapFont: a value of 0 disables the borderborderColor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)borderStraight
- Determines whether the border encoded by the resulting BitmapFont is straight or roundedpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, float borderWidth, com.badlogic.gdx.graphics.Color borderColor, boolean borderStraight)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontborderWidth
- The width of the border encoded by the resulting BitmapFont: a value of 0 disables the borderborderColor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)borderStraight
- Determines whether the border encoded by the resulting BitmapFont is straight or roundedpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size, com.badlogic.gdx.graphics.Color color)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontcolor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)public TTFont(com.badlogic.gdx.files.FileHandle fontFile, int size)
fontFile
- An address to the font-file to be imported and convertedsize
- The size of the resulting BitmapFontpublic TTFont(com.badlogic.gdx.files.FileHandle fontFile, com.badlogic.gdx.graphics.Color color)
fontFile
- An address to the font-file to be imported and convertedcolor
- The colour of the border encoded by the resulting BitmapFont (if one is configured to exist)public TTFont(com.badlogic.gdx.files.FileHandle fontFile)
fontFile
- An address to the font-file to be imported and convertedpublic void setFont(com.badlogic.gdx.files.FileHandle fontFile)
fontFile
- An address to the new font-file to be imported and convertedpublic com.badlogic.gdx.graphics.g2d.BitmapFont font()
public void setSize(int size)
size
- The new size of the internal BitmapFont's characterspublic int size()
public void setBorder(float borderWidth, com.badlogic.gdx.graphics.Color borderColor)
borderWidth
- The new (consistent) width of the borders around the internal BitmapFont's charactersborderColor
- The new (consistent) colour of the borders around the internal BitmapFont's characterspublic void setBorder(float borderWidth, com.badlogic.gdx.graphics.Color borderColor, boolean borderStraight)
borderWidth
- The new (consistent) width of the borders around the internal BitmapFont's charactersborderColor
- The new (consistent) colour of the borders around the internal BitmapFont's charactersborderStraight
- Determines whether the new borders around the font's characters are straight or roundedpublic float borderWidth()
public com.badlogic.gdx.graphics.Color borderColor()
public void removeBorder()
public void setShadow(int shadowOffsetX, int shadowOffsetY, com.badlogic.gdx.graphics.Color shadowColor)
shadowOffsetX
- The (consistent) X-offset of the shadows beneath all characters in the new BitmapFontshadowOffsetY
- The (consistent) Y-offset of the shadows beneath all characters in the new BitmapFontshadowColor
- The (consistent) colour of the shadows beneath all characters in the new BitmapFontpublic com.badlogic.gdx.graphics.Color shadowColor()
public void removeShadow()
public void dispose()