Class FontConsumed


  • public class FontConsumed
    extends java.lang.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 Summary

      Fields 
      Modifier and TypeFieldDescription
      java.lang.Stringfamily
      The font family.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      FontConsumed​(java.lang.String family, java.lang.String style, java.lang.String weight)
      Constructor.
    • Field Detail

      • family

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

      • FontConsumed

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

      • getConsumedFonts

        public static java.util.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,
                                                java.util.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 java.lang.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 java.lang.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​(java.lang.Object o)
        Checks if the consumed fonts are equal.
        Overrides:
        equals in class java.lang.Object
      • hashCode

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