Class GFont

  • All Implemented Interfaces:
    java.lang.Cloneable

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

      Fields 
      Modifier and TypeFieldDescription
      static GFontDEFAULT
      The default font: 10p serif.
      java.lang.Stringfamily
      The font family CSS value.
      java.lang.Stringsize
      The CSS font size (including units), e.g.
      java.lang.Stringstyle
      The CSS font style: "normal", "italic" or "oblique".
      java.lang.Stringvariant
      The font variant, default "normal".
      java.lang.Stringweight
      The font weight as CSS value, e.g.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      GFont​(java.lang.String family, java.lang.String size)
      Creates an new normal font.
      GFont​(java.lang.String family, java.lang.String size, java.lang.String weight, java.lang.String style, java.lang.String variant)
      Creates an new normal font.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanequals​(GFont font)
      Checks if two font objects are equal.
      booleanequals​(java.lang.Object o)
      Checks if two font objects are equal.
      java.lang.StringgetString()
      Gets the font as a String in the form described below.
      java.lang.StringtoString()
      Returns a string representation of this class instance and its values.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT

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

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

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

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

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

        public final java.lang.String variant
        The font variant, default "normal".
    • Constructor Detail

      • GFont

        public GFont​(java.lang.String family,
                     java.lang.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:
        java.lang.NullPointerException - If family or size is null.
      • GFont

        public GFont​(java.lang.String family,
                     java.lang.String size,
                     java.lang.String weight,
                     java.lang.String style,
                     java.lang.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:
        java.lang.NullPointerException - If family, size, weight, style or variant is null.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Checks if two font objects are equal.
        Overrides:
        equals in class java.lang.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 java.lang.String getString()
        Gets the font as a String in the form described below.
        Returns:
        the String as described above.
      • toString

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