Class CSSFontDefinition


  • public class CSSFontDefinition
    extends java.lang.Object
    The CSS font definition containing all the icons.

    The following CSS can be parsed: - FontAwsome - IcoMoon - Iconic (https://useiconic.com/open/)

    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      java.lang.StringfontFamily
      The font family.
      java.util.ArrayList<java.io.File>fontFiles
      The font files required.
      java.util.ArrayList<FontFormat>fontFormats
      The font file formats, null entries when not found.
      java.util.ArrayList<java.lang.String>fontLocals
      The font files locals, null entries when not found (can be comma separated).
      java.util.ArrayList<java.lang.String>fontQueries
      The font files queries, null entries when not found.
      java.lang.StringfontStretch
      The font stretch, null for default "normal".
      java.lang.StringfontStyle
      The font style, null for default "normal".
      java.lang.StringfontWeight
      The font weight, null for default "normal".
      java.util.LinkedHashMap<java.lang.String,​CSSFontIcon>icons
      The map of available icons, sorted by name.
      java.util.ArrayList<java.lang.String>iconStyleDecls
      At least one style declaration in one or more @FontFace.
      java.lang.StringunicodeRange
      The unicode range, null for default "U+0-10FFFF".
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static intbuildFromTTF​(CSSFontDefinition fd, java.io.File file)
      Builds the icons that are available in the TrueType font file as defined characters between ASCII 32 and less than 65535.
      java.lang.StringgetIconCSS()
      Gets the icon CSS declaration string.
      java.util.List<java.io.File>getRequiredFontFiles()
      Gets the font files required, relative the CSS document URL.
      java.lang.String[]getRequireFontFileNames()
      Gets the file names to copy in absolute paths.
      voidinitializeFontFiles​(EditorFontFiles ff, java.lang.String baseRef)
      Creates the font files definition.
      static java.util.List<CSSFontDefinition>parse​(java.io.File file, java.util.ArrayList<java.lang.String> warnings, boolean doIcons)
      Processes a CSS file from a file.
      static java.util.List<CSSFontDefinition>parse​(org.w3c.dom.css.CSSRuleList list, java.util.ArrayList<java.lang.String> warnings, java.io.File dir, boolean doIcons)
      Parses all fond definitions found in a style sheet.
      • Methods inherited from class java.lang.Object

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

      • fontFamily

        public final java.lang.String fontFamily
        The font family.
      • fontStretch

        public final java.lang.String fontStretch
        The font stretch, null for default "normal".
      • fontStyle

        public final java.lang.String fontStyle
        The font style, null for default "normal".
      • fontWeight

        public final java.lang.String fontWeight
        The font weight, null for default "normal".
      • unicodeRange

        public final java.lang.String unicodeRange
        The unicode range, null for default "U+0-10FFFF".
      • iconStyleDecls

        public final java.util.ArrayList<java.lang.String> iconStyleDecls
        At least one style declaration in one or more @FontFace.
      • icons

        public final java.util.LinkedHashMap<java.lang.String,​CSSFontIcon> icons
        The map of available icons, sorted by name.
      • fontFiles

        public final java.util.ArrayList<java.io.File> fontFiles
        The font files required.
      • fontFormats

        public final java.util.ArrayList<FontFormat> fontFormats
        The font file formats, null entries when not found.
      • fontQueries

        public final java.util.ArrayList<java.lang.String> fontQueries
        The font files queries, null entries when not found.
      • fontLocals

        public final java.util.ArrayList<java.lang.String> fontLocals
        The font files locals, null entries when not found (can be comma separated).
    • Method Detail

      • buildFromTTF

        public static int buildFromTTF​(CSSFontDefinition fd,
                                       java.io.File file)
                                throws java.io.IOException,
                                       java.awt.FontFormatException
        Builds the icons that are available in the TrueType font file as defined characters between ASCII 32 and less than 65535.
        Parameters:
        fd - The font definition.
        file - The TrueType font file (*.ttf).
        Returns:
        count of icons found.
        Throws:
        java.io.IOException - For I/O errors.
        java.awt.FontFormatException - For TrueType font format errors.
      • parse

        public static java.util.List<CSSFontDefinition> parse​(java.io.File file,
                                                              java.util.ArrayList<java.lang.String> warnings,
                                                              boolean doIcons)
                                                       throws java.io.IOException
        Processes a CSS file from a file.
        Parameters:
        file - The CSS file.
        warnings - Warnings array that gets filled in, null for none.
        doIcons - Parse the icons flag.
        Returns:
        The font definition.
        Throws:
        java.io.IOException - For I/O or parser errors.
      • parse

        public static java.util.List<CSSFontDefinition> parse​(org.w3c.dom.css.CSSRuleList list,
                                                              java.util.ArrayList<java.lang.String> warnings,
                                                              java.io.File dir,
                                                              boolean doIcons)
                                                       throws java.io.IOException
        Parses all fond definitions found in a style sheet.
        Parameters:
        list - The CSS rules list.
        warnings - Warnings array that gets filled in, null for none.
        dir - The directory of the CSS file.
        doIcons - Parse the icons flag.
        Throws:
        java.io.IOException - If the CSS definitions cannot be processed or a font definition is not found
      • getRequiredFontFiles

        public java.util.List<java.io.File> getRequiredFontFiles()
        Gets the font files required, relative the CSS document URL.
        Returns:
        A list of files from the 'src' declarations.
      • getRequireFontFileNames

        public java.lang.String[] getRequireFontFileNames()
        Gets the file names to copy in absolute paths.
      • getIconCSS

        public java.lang.String getIconCSS()
        Gets the icon CSS declaration string.
      • initializeFontFiles

        public void initializeFontFiles​(EditorFontFiles ff,
                                        java.lang.String baseRef)
        Creates the font files definition.