Class FontImpl

  • All Implemented Interfaces:
    Cloneable, Font, Cloneable

    public class FontImpl
    extends Object
    implements Font, Cloneable
    Provides a Java representation of the Font element of an SLD.
    Author:
    Ian Turton, CCG
    • Constructor Detail

      • FontImpl

        protected FontImpl()
        Creates a new instance of DefaultFont
    • Method Detail

      • getFamily

        public List<Expression> getFamily()
        Description copied from interface: Font
        SVG font-family parameters in preferred order.
        Specified by:
        getFamily in interface Font
        Returns:
        live list of font-family parameters in preferred order
      • getSize

        public Expression getSize()
        Description copied from interface: Font
        Font size in pixels with a default of 10 pixels.

        Please note this is specified in pixels so you may need to take the resolution of your output into account when providing a size.

        Specified by:
        getSize in interface Font
        Returns:
        font size
      • setSize

        public void setSize​(Expression size)
        Specified by:
        setSize in interface Font
        Parameters:
        size - the font size in pixels
      • getStyle

        public Expression getStyle()
        Description copied from interface: Font
        The "font-style" SVG parameter should be "normal", "italic", or "oblique".

        If null is returned the default value should be considered "normal".

        Specified by:
        getStyle in interface Font
        Returns:
        Expression or null
      • setStyle

        public void setStyle​(Expression style)
        Specified by:
        setStyle in interface Font
        Parameters:
        style - The "font-style" SVG parameter (one of "normal", "italic", or "oblique"
      • getWeight

        public Expression getWeight()
        Description copied from interface: Font
        The "font-weight" SVG parameter should be "normal" or "bold".

        If null the default should be considered as "normal"

        Specified by:
        getWeight in interface Font
        Returns:
        font-weight SVG parameter
      • setWeight

        public void setWeight​(Expression weight)
        Specified by:
        setWeight in interface Font
        Parameters:
        weight - The "font-weight" SVG parameter (one of "normal", "bold")
      • clone

        public Object clone()
        Creates a clone of the font.
        Specified by:
        clone in interface Cloneable
        Overrides:
        clone in class Object
        Returns:
        A copy of this object.
        See Also:
        Cloneable.clone()
      • hashCode

        public int hashCode()
        Generates the hashcode for the font.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code.
      • equals

        public boolean equals​(Object oth)
        Compares this font with another for equality. Two fonts are equal if their family, style, weight and size are equal.
        Overrides:
        equals in class Object
        Returns:
        True if this and oth are equal.
      • accept

        public Object accept​(TraversingStyleVisitor visitor,
                             Object data)
        Description copied from interface: Font
        calls the visit method of a StyleVisitor
        Specified by:
        accept in interface Font
        Parameters:
        visitor - the style visitor