Class Fonts


public final class Fonts extends ResourcesContainer<Font>
A container class for managing font resources. This class extends the ResourcesContainer class, specifically for Font objects.
  • Method Details

    • get

      public Font get(String name, float size)
      Retrieves a font with the specified name and size.
      Parameters:
      name - The name of the font.
      size - The size of the font.
      Returns:
      The derived font with the specified size, or null if the font is not found.
    • get

      public Font get(String name, int style)
      Retrieves a font with the specified name and style.
      Parameters:
      name - The name of the font.
      style - The style of the font (e.g., Font.PLAIN, Font.BOLD).
      Returns:
      The derived font with the specified style, or null if the font is not found.
    • get

      public Font get(String name, int style, float size)
      Retrieves a font with the specified name, style, and size.
      Parameters:
      name - The name of the font.
      style - The style of the font (e.g., Font.PLAIN, Font.BOLD).
      size - The size of the font.
      Returns:
      The derived font with the specified style and size, or null if the font is not found.
    • load

      protected Font load(URL resourceName)
      Loads a custom font with the specified name from game's resources. As a fallback, when no font could be found by the specified fontName, it tries to get the font from the environment by calling.
      Specified by:
      load in class ResourcesContainer<Font>
      Parameters:
      resourceName - The name of the font
      Returns:
      The loaded font.
      See Also: