Class MapFont

java.lang.Object
studio.magemonkey.codex.mccore.gui.MapFont

public class MapFont extends Object
Represents a font that can more efficiently draw to a map canvas
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapFont(Font font, int space)
    Initializes a MapFont using a Font template
  • Method Summary

    Modifier and Type
    Method
    Description
    studio.magemonkey.codex.mccore.gui.MapFont.MapChar
    getChar(char c)
    Gets data for a character from the font.
    Retrieves the font wrapped by this object
    int
    Retrieves the spacing between letters for this font
    int[]
    Measures the dimensions of a string

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MapFont

      public MapFont(Font font, int space)
      Initializes a MapFont using a Font template
      Parameters:
      font - font template
      space - spacing between characters
  • Method Details

    • getFont

      public Font getFont()
      Retrieves the font wrapped by this object
      Returns:
      wrapped font
    • getSpace

      public int getSpace()
      Retrieves the spacing between letters for this font
      Returns:
      spacing between letters
    • measureString

      public int[] measureString(String str)
      Measures the dimensions of a string
      Parameters:
      str - string to measure
      Returns:
      the dimensions of the string { width, height, yOffset }
    • getChar

      public studio.magemonkey.codex.mccore.gui.MapFont.MapChar getChar(char c)
      Gets data for a character from the font. If the character is not initialized, it will be initialized first.
      Parameters:
      c - character to get the data of
      Returns:
      character data for the font