Record Class FontFace

java.lang.Object
java.lang.Record
nl.colorize.multimedialib.stage.FontFace

public record FontFace(nl.colorize.util.ResourceFile origin, String family, int size, ColorRGB color) extends Record
Describes a TrueType or FreeType font that can be used by the renderer to draw text. The font consists of the font family and the font style.

MultimediaLib applications should not make assumptions on which system fonts are available on the current platform. All fonts used by the application should be included in the application's resource files. Fonts can then be loaded from these files using MediaLoader.

  • Constructor Summary

    Constructors
    Constructor
    Description
    FontFace(nl.colorize.util.ResourceFile origin, String family, int size, ColorRGB color)
    Creates an instance of a FontFace record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the color record component.
    derive(int size)
     
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the family record component.
    final int
    Returns a hash code value for this object.
    nl.colorize.util.ResourceFile
    Returns the value of the origin record component.
    scale(Canvas canvas)
    Derives a version of this font that is scaled to match the specified display mode.
    int
    Returns the value of the size record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FontFace

      public FontFace(nl.colorize.util.ResourceFile origin, String family, int size, ColorRGB color)
      Creates an instance of a FontFace record class.
      Parameters:
      origin - the value for the origin record component
      family - the value for the family record component
      size - the value for the size record component
      color - the value for the color record component
  • Method Details

    • derive

      public FontFace derive(int size)
    • derive

      public FontFace derive(ColorRGB color)
    • scale

      public FontFace scale(Canvas canvas)
      Derives a version of this font that is scaled to match the specified display mode. If the canvas is zoomed in or zoomed out, the size indicated in the font style should also be scaled accordingly.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • origin

      public nl.colorize.util.ResourceFile origin()
      Returns the value of the origin record component.
      Returns:
      the value of the origin record component
    • family

      public String family()
      Returns the value of the family record component.
      Returns:
      the value of the family record component
    • size

      public int size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • color

      public ColorRGB color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component