Package fonts

Class Font

java.lang.Object
fonts.Font

public class Font extends Object
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

    Constructors
    Constructor
    Description
    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.
    Font(Font font)
    Creates a antialiased font from an AWT Font.
    Font(Font font, boolean antiAlias)
    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.
    Font(String path, float size, boolean antiAlias)
    Creates a Font from an input stream.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
     
    int
    Gets the height of the specified text.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 size
      antiAlias - Wheter the font should be antialiased or not
    • Font

      public Font(InputStream in, int size) throws FontFormatException, IOException
      Creates a antialiased Font from an input stream.
      Parameters:
      in - The input stream
      size - Font size
      Throws:
      FontFormatException - if fontFile does not contain the required font tables for the specified format
      IOException - If font can't be read
    • Font

      public Font(InputStream in, int size, boolean antiAlias) throws FontFormatException, IOException
      Creates a Font from an input stream.
      Parameters:
      in - The input stream
      size - Font size
      antiAlias - Wheter the font should be antialiased or not
      Throws:
      FontFormatException - if fontFile does not contain the required font tables for the specified format
      IOException - If font can't be read
    • Font

      public Font(String path, float size, boolean antiAlias)
      Creates a Font from an input stream.
      Parameters:
      path - Path to TTF file
      size - Font size
      antiAlias - Whether the font should be antialiased or not
    • Font

      public Font(Font font)
      Creates a antialiased font from an AWT Font.
      Parameters:
      font - The AWT Font
    • Font

      public Font(Font font, boolean antiAlias)
      Creates a font from an AWT Font.
      Parameters:
      font - The AWT Font
      antiAlias - Wheter the font should be antialiased or not
  • Method Details

    • getHeight

      public int getHeight(CharSequence text)
      Gets the height of the specified text.
      Parameters:
      text - The text
      Returns:
      Height in pixels of the text.
    • getFontHeight

      public int getFontHeight()
    • getGlyphs

      public Map<Character,Glyph> getGlyphs()
    • getTexture

      public Texture getTexture()