Class FontConsumed

java.lang.Object
com.iizix.prop.font.FontConsumed

public class FontConsumed extends Object
Class representing a consumed font. This class is used e.g. to collect information about components (including its children) in order to gather the required fonts.
Author:
Christopher Mindus
  • Field Details

    • family

      public final String family
      The font family. The font family may consist of a list of fonts that is comma separated.
  • Constructor Details

    • FontConsumed

      public FontConsumed(String family, String style, String weight)
      Constructor.
      Parameters:
      family - The font family, cannot be null.
      style - The style, null for undefined.
      weight - The weight, null for undefined.
      Throws:
      NullPointerException - If font family is null.
  • Method Details

    • getConsumedFonts

      public static Set<FontConsumed> getConsumedFonts(PropCnr comp)
      Collects all fonts in a component and its children recursively.
      Parameters:
      comp - The component to collect fonts from.
      Returns:
      The set of consumed fonts by the component and its children (recursively).
    • collectConsumedFonts

      public static void collectConsumedFonts(PropCnr comp, Set<FontConsumed> fonts)
      Collects all fonts in a component and its children recursively.
      Parameters:
      comp - The component to collect fonts from.
      fonts - The set of fonts to collect the information to.
    • getStyle

      public String getStyle()
      Gets the style. The style is not always the same as the value of the constructor.
      Returns:
      The style string, null if undefined, empty string for "unknown" values (e.g. "inherit").
    • getWeight

      public String getWeight()
      Gets the weight. The weight is not always the same as the value of the constructor.
      Returns:
      The weight string, null if undefined, empty string for "unknown" values (e.g. "inherit", "bolder" or "lighter").
    • equals

      public boolean equals(Object o)
      Checks if the consumed fonts are equal.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      The hash code.
      Overrides:
      hashCode in class Object