java.lang.Object
technology.sola.engine.assets.graphics.font.Font
All Implemented Interfaces:
Asset

@NullMarked public class Font extends Object implements Asset
Font is an Asset containing the information required to render strings of text for a particular font that has been rasterized into an image.
  • Constructor Details

    • Font

      public Font(SolaImage fontImage, FontInfo fontInfo)
      Creates a Font instance from a SolaImage with FontInfo.
      Parameters:
      fontImage - the image for the rasterized font
      fontInfo - the information regarding the rasterized font
  • Method Details

    • getGlyph

      public SolaImage getGlyph(char character, Color color)
      Gets a SolaImage for a glyph to render in desired Color.
      Parameters:
      character - the character to render
      color - the color to render the character
      Returns:
      the image for the character's glyph in desired color
    • hasGlyph

      public boolean hasGlyph(char character)
      Checks to see if this Font has a glyph registered for rendering.
      Parameters:
      character - the character to check for a glyph
      Returns:
      true if the Font has a glyph for the character
    • getDimensionsForText

      public Font.TextDimensions getDimensionsForText(String text)
      Calculates and returns the Font.TextDimensions for a string of text that would be rendered with this font.
      Parameters:
      text - the string of text
      Returns:
      the text dimensions
    • getFontInfo

      public FontInfo getFontInfo()
      Returns:
      the FontInfo