Package fonts
Class Font
java.lang.Object
fonts.Font
This class contains a font texture for drawing text.
A lot of credit for the base of this file goes to @SilverTiger on GitHub, his base has been heavily modified to work in Azurite.
- Author:
- Heiko Brumme (SilverTiger) {@link https://github.com/SilverTiger/lwjgl3-tutorial}, Asher Haun
-
Constructor Summary
ConstructorDescriptionFont()
Creates a default antialiased font with monospaced glyphs and default size 16.Font
(boolean antiAlias) Creates a default font with monospaced glyphs and default size 16.Font
(int size) Creates a default antialiased font with monospaced glyphs and specified size.Font
(int size, boolean antiAlias) Creates a default font with monospaced glyphs and specified size.Creates a antialiased font from an AWT Font.Creates a font from an AWT Font.Font
(InputStream in, int size) Creates a antialiased Font from an input stream.Font
(InputStream in, int size, boolean antiAlias) Creates a Font from an input stream.Creates a Font from an input stream. -
Method Summary
Modifier and TypeMethodDescriptionint
int
getHeight
(CharSequence text) Gets the height of the specified text.
-
Constructor Details
-
Font
public Font()Creates a default antialiased font with monospaced glyphs and default size 16. -
Font
public Font(boolean antiAlias) Creates a default font with monospaced glyphs and default size 16.- Parameters:
antiAlias
- Wheter the font should be antialiased or not
-
Font
public Font(int size) Creates a default antialiased font with monospaced glyphs and specified size.- Parameters:
size
- Font size
-
Font
public Font(int size, boolean antiAlias) Creates a default font with monospaced glyphs and specified size.- Parameters:
size
- Font sizeantiAlias
- Wheter the font should be antialiased or not
-
Font
Creates a antialiased Font from an input stream.- Parameters:
in
- The input streamsize
- Font size- Throws:
FontFormatException
- if fontFile does not contain the required font tables for the specified formatIOException
- If font can't be read
-
Font
Creates a Font from an input stream.- Parameters:
in
- The input streamsize
- Font sizeantiAlias
- Wheter the font should be antialiased or not- Throws:
FontFormatException
- if fontFile does not contain the required font tables for the specified formatIOException
- If font can't be read
-
Font
Creates a Font from an input stream.- Parameters:
path
- Path to TTF filesize
- Font sizeantiAlias
- Whether the font should be antialiased or not
-
Font
Creates a antialiased font from an AWT Font.- Parameters:
font
- The AWT Font
-
Font
Creates a font from an AWT Font.- Parameters:
font
- The AWT FontantiAlias
- Wheter the font should be antialiased or not
-
-
Method Details
-
getHeight
Gets the height of the specified text.- Parameters:
text
- The text- Returns:
- Height in pixels of the text.
-
getFontHeight
public int getFontHeight() -
getGlyphs
-
getTexture
-