Class MapFont

java.lang.Object
dev.cerus.maps.api.font.MapFont

public class MapFont extends Object
Represents a font
  • Field Details

    • MINECRAFT_FONT

      public static final MapFont MINECRAFT_FONT
  • Constructor Details

    • MapFont

      public MapFont()
  • Method Details

    • fromBukkit

      public static MapFont fromBukkit(org.bukkit.map.MapFont bukkitFont)
      Convert Bukkit font to maps font
      Parameters:
      bukkitFont - The Bukkit font
      Returns:
      The converted font
    • set

      public void set(int codePoint, Sprite sprite)
      Register a codepoint
      Parameters:
      codePoint - The codepoint
      sprite - The sprite
    • get

      public Sprite get(int codePoint)
      Get a registered sprite
      Parameters:
      codePoint - The codepoint registered to the sprite
      Returns:
      The sprite
      Throws:
      IllegalArgumentException - if the codepoint was not registered
    • getSprites

      public List<Sprite> getSprites(String text)
      Get all sprites for the specified text
      Parameters:
      text - The text
      Returns:
      A list of sprites
      Throws:
      IllegalArgumentException - if the text is invalid
    • getWidth

      public int getWidth(String text)
      Get the width of a string
      Parameters:
      text - The string
      Returns:
      The width of the string
      Throws:
      IllegalArgumentException - if the text is invalid
    • getHeight

      public int getHeight()
      Get the maximum height of this font
      Returns:
      The max height
    • getHeight

      public int getHeight(String text)
      Get the height for a string
      Parameters:
      text - The string
      Returns:
      The height of the string
      Throws:
      IllegalArgumentException - if the text is invalid
    • isValid

      public boolean isValid(int codePoint)
      Checks if a codepoint was registered
      Parameters:
      codePoint - The codepoint
      Returns:
      True if valid
    • isValid

      public boolean isValid(char c)
      Checks if a character was registered
      Parameters:
      c - The character
      Returns:
      True if valid
    • isValid

      public boolean isValid(String text)
      Checks if a string is valid
      Parameters:
      text - The string
      Returns:
      True if valid