Package bagel

Class Font

java.lang.Object
bagel.Font

public class Font extends Object
Represents a loaded font that can be used to draw text.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Font(String filename, int size)
    Load the font from the given file at the given size.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    drawString(String string, double x, double y)
    Draw the provided string with its bottom-left at the given (x, y) location.
    void
    drawString(String string, double x, double y, DrawOptions options)
    Draw the provided string with its bottom-left at the given (x, y) location with additional options.
    double
    getWidth(String string)
     

    Methods inherited from class java.lang.Object

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

    • Font

      public Font(String filename, int size)
      Load the font from the given file at the given size. Creating multiple copies of the same font (at the same size) is efficient.
  • Method Details

    • drawString

      public void drawString(String string, double x, double y)
      Draw the provided string with its bottom-left at the given (x, y) location. The text will be left-aligned.
    • drawString

      public void drawString(String string, double x, double y, DrawOptions options)
      Draw the provided string with its bottom-left at the given (x, y) location with additional options. The text will be left-aligned.
    • getWidth

      public double getWidth(String string)