Interface MapFont


public interface MapFont
A bitmap font to write on maps with.

Each character is a MapFont.Glyph: a small grid of set and unset pixels. Text is laid out on lines lineHeight() pixels apart; on each line, glyph row 0 sits ascent() pixels below the top of the line, which leaves room for the accents of capitals.

Since:
0.1.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Collects the glyphs of a font.
    static final record 
    The pixels of one character.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns how many pixels below the top of a line glyph row 0 is.
    Returns the glyph drawn for characters the font does not have.
    glyph(int codePoint)
    Returns the glyph of a character.
    int
    Returns how many empty columns separate two glyphs.
    int
    Returns how many pixels apart two lines are.
    int
    width(String text)
    Measures one line of text.
  • Method Details

    • glyph

      @Nullable MapFont.Glyph glyph(int codePoint)
      Returns the glyph of a character.
      Parameters:
      codePoint - the character
      Returns:
      its glyph, or null if the font does not have it
      Since:
      0.1.0
    • fallback

      MapFont.Glyph fallback()
      Returns the glyph drawn for characters the font does not have.
      Returns:
      the glyph drawn for characters the font does not have
      Since:
      0.1.0
    • lineHeight

      int lineHeight()
      Returns how many pixels apart two lines are.
      Returns:
      how many pixels apart two lines are
      Since:
      0.1.0
    • ascent

      int ascent()
      Returns how many pixels below the top of a line glyph row 0 is.
      Returns:
      how many pixels below the top of a line glyph row 0 is
      Since:
      0.1.0
    • letterSpacing

      int letterSpacing()
      Returns how many empty columns separate two glyphs.
      Returns:
      how many empty columns separate two glyphs
      Since:
      0.1.0
    • width

      int width(String text)
      Measures one line of text.
      Parameters:
      text - the text, without line breaks
      Returns:
      its width in pixels
      Since:
      0.1.0