Class CSSFontDefinition

java.lang.Object
com.iizigo.font.CSSFontDefinition

public class CSSFontDefinition extends 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 Details

    • fontFamily

      public final String fontFamily
      The font family.
    • fontStretch

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

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

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

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

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

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

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

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

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

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

    • buildFromTTF

      public static int buildFromTTF(CSSFontDefinition fd, File file) throws IOException, 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:
      IOException - For I/O errors.
      FontFormatException - For TrueType font format errors.
    • parse

      public static List<CSSFontDefinition> parse(File file, ArrayList<String> warnings, boolean doIcons) throws 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:
      IOException - For I/O or parser errors.
    • parse

      public static List<CSSFontDefinition> parse(CSSRuleList list, ArrayList<String> warnings, File dir, boolean doIcons) throws 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:
      IOException - If the CSS definitions cannot be processed or a font definition is not found
    • getRequiredFontFiles

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

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

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

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