Class CssFontFace.CssFontFaceSrc

  • Enclosing class:
    CssFontFace

    public static class CssFontFace.CssFontFaceSrc
    extends java.lang.Object
    Class that defines a font face source.
    • Field Detail

      • UrlPattern

        public static final java.util.regex.Pattern UrlPattern
        The UrlPattern used to compose a source path.
      • FormatGroup

        public static final int FormatGroup
        The Constant FormatGroup.
        See Also:
        Constant Field Values
      • src

        final java.lang.String src
        The source path.
      • isLocal

        final boolean isLocal
        Indicates if the font is local.
    • Constructor Detail

      • CssFontFaceSrc

        private CssFontFaceSrc​(java.lang.String src,
                               boolean isLocal,
                               CssFontFace.FontFormat format)
        Instantiates a new CssFontFace.CssFontFaceSrc instance.
        Parameters:
        src - a source path
        isLocal - indicates if the font is local
        format - the font format (true type, open type, woff,...)
    • Method Detail

      • getSrc

        public java.lang.String getSrc()
        Gets the source path.
        Returns:
        the source path
      • isLocal

        public boolean isLocal()
        Checks if the font is local.
        Returns:
        true if the font is local, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • create

        public static CssFontFace.CssFontFaceSrc create​(java.lang.String src)
        Creates a CssFontFace.CssFontFaceSrc object by parsing a String trying to match patterns that reveal the font name, whether that font is local, and which format the font is in.
        Parameters:
        src - a string containing information about a font
        Returns:
        the font in the form of a CssFontFace.CssFontFaceSrc object
      • parseFormat

        public static CssFontFace.FontFormat parseFormat​(java.lang.String formatStr)
        Parses a String to a font format.
        Parameters:
        formatStr - a string
        Returns:
        a font format
      • unquote

        public static java.lang.String unquote​(java.lang.String quotedString)
        Removes single and double quotes at the start and the end of a String.
        Parameters:
        quotedString - a String that might be between quotes
        Returns:
        the String without the quotes