Class Font

java.lang.Object
org.openpatch.scratch.internal.Font

public class Font extends Object
The Font class represents a font that can be used to render text on the screen. It supports various functionalities such as loading fonts from files, setting font sizes, and getting the font object for a specific size.
  • Field Details

    • defaultFontName

      public static String defaultFontName
      The default font name.
    • defaultFontPath

      public static String defaultFontPath
      The default font path.
    • defaultFont

      public static processing.core.PFont defaultFont
      The default font.
  • Constructor Details

    • Font

      public Font(String name, String path)
      Constructs a font with the specified name and path.
      Parameters:
      name - the name of the font
      path - the path to the font file
    • Font

      public Font(Font font)
      Copy constructor.
      Parameters:
      font - the font to copy
  • Method Details

    • getName

      public String getName()
      Returns the name of the font.
      Returns:
      the name of the font
    • getDefaultFont

      public static processing.core.PFont getDefaultFont()
      Returns the default font.
      Returns:
      the default font
    • loadFont

      public static AbstractMap<Integer,processing.core.PFont> loadFont(String path)
      Loads a font from the specified path and returns a map of font sizes.
      Parameters:
      path - the path to the font file
      Returns:
      a map of font sizes
    • getFont

      public processing.core.PFont getFont(int targetSize)