Class GFont

java.lang.Object
com.iizix.prop.GFont
All Implemented Interfaces:
Cloneable

public class GFont extends Object implements Cloneable
A font specifies the properties for a Font used in text operations.
Author:
Christopher Mindus
  • Field Details

    • DEFAULT

      public static final GFont DEFAULT
      The default font: 10p serif.
    • family

      public final String family
      The font family CSS value.
    • size

      public final String size
      The CSS font size (including units), e.g. "10pt".
    • weight

      public final String weight
      The font weight as CSS value, e.g. "bold", default "normal".
    • style

      public final String style
      The CSS font style: "normal", "italic" or "oblique".
    • variant

      public final String variant
      The font variant, default "normal".
  • Constructor Details

    • GFont

      public GFont(String family, String size)
      Creates an new normal font.
      Parameters:
      family - The font family CSS value.
      size - The CSS font size (including units), e.g. "10pt".
      Throws:
      NullPointerException - If family or size is null.
    • GFont

      public GFont(String family, String size, String weight, String style, String variant)
      Creates an new normal font.
      Parameters:
      family - The font family CSS value.
      size - The CSS font size (including units), e.g. "10pt".
      weight - The font weight as CSS value, e.g. "bold", default "normal".
      style - The CSS font style: "normal", "italic" or "oblique".
      variant - The font variant, default "normal".
      Throws:
      NullPointerException - If family, size, weight, style or variant is null.
  • Method Details

    • equals

      public boolean equals(Object o)
      Checks if two font objects are equal.
      Overrides:
      equals in class Object
    • equals

      public boolean equals(GFont font)
      Checks if two font objects are equal.
      Parameters:
      font - another font object. If null, the fonts are not equal.
      Returns:
      true if equal, false otherwise.
    • getString

      public String getString()
      Gets the font as a String in the form described below.
      Returns:
      the String as described above.
    • toString

      public String toString()
      Returns a string representation of this class instance and its values.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this class instance.