public class Font extends SFMLNativeObject implements ConstFont
| Constructor and Description |
|---|
Font()
Constructs a new font.
|
| Modifier and Type | Method and Description |
|---|---|
Glyph |
getGlyph(int unicode,
int characterSize,
boolean bold)
Gets a glyph information structure from the font.
|
int |
getKerning(int first,
int second,
int characterSize)
Gets the kerning offset between two glyphs.
|
int |
getLineSpacing(int characterSize)
Gets the line spacing of the font.
|
ConstTexture |
getTexture(int characterSize)
Retrieves the texture containing the font's glyphs.
|
void |
loadFromFile(Path path)
Attempts to load the texture from a file.
|
void |
loadFromStream(InputStream in)
Fully loads all available bytes from an
InputStream
and attempts to load the texture from it. |
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
finalize@Deprecated protected long nativeCreate()
SFMLNativeObjectnativeCreate in class SFMLNativeObject@Deprecated protected void nativeSetExPtr()
SFMLNativeObjectnativeSetExPtr in class SFMLNativeObject@Deprecated protected void nativeDelete()
SFMLNativeObjectnativeDelete in class SFMLNativeObjectpublic void loadFromStream(InputStream in) throws IOException
InputStream
and attempts to load the texture from it.in - the input stream to read from.IOException - in case an I/O error occurs.public void loadFromFile(Path path) throws IOException
path - the path to the file to load the texture from.IOException - in case an I/O error occurs.public Glyph getGlyph(int unicode, int characterSize, boolean bold)
ConstFontgetGlyph in interface ConstFontunicode - the unicode (UTF-32) of the character to retrieve the glyph for.characterSize - the character size in question.bold - true if the bold glyph version should be returned,
false for the regular version.Glyph representing the given unicode character.public int getKerning(int first,
int second,
int characterSize)
ConstFontgetKerning in interface ConstFontfirst - the unicode (UTF-32) of the first character.second - the unicode (UTF-32) of the second character.characterSize - the character size in question.public int getLineSpacing(int characterSize)
ConstFontgetLineSpacing in interface ConstFontcharacterSize - the character size in question.public ConstTexture getTexture(int characterSize)
ConstFontgetTexture in interface ConstFontcharacterSize - the character size in question.