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()
SFMLNativeObject
nativeCreate
in class SFMLNativeObject
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class SFMLNativeObject
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SFMLNativeObject
public 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)
ConstFont
getGlyph
in interface ConstFont
unicode
- 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)
ConstFont
getKerning
in interface ConstFont
first
- 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)
ConstFont
getLineSpacing
in interface ConstFont
characterSize
- the character size in question.public ConstTexture getTexture(int characterSize)
ConstFont
getTexture
in interface ConstFont
characterSize
- the character size in question.