Package com.iizigo.font
Class CSSFontDefinition
java.lang.Object
com.iizigo.font.CSSFontDefinition
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
Modifier and TypeFieldDescriptionfinal String
The font family.The font files required.final ArrayList<FontFormat>
The font file formats, null entries when not found.The font files locals, null entries when not found (can be comma separated).The font files queries, null entries when not found.final String
The font stretch, null for default "normal".final String
The font style, null for default "normal".final String
The font weight, null for default "normal".final LinkedHashMap<String,
CSSFontIcon> The map of available icons, sorted by name.At least one style declaration in one or more @FontFace.final String
The unicode range, null for default "U+0-10FFFF".Method Summary
Modifier and TypeMethodDescriptionstatic int
buildFromTTF
(CSSFontDefinition fd, File file) Builds the icons that are available in the TrueType font file as defined characters between ASCII 32 and less than 65535.Gets the icon CSS declaration string.Gets the font files required, relative the CSS document URL.String[]
Gets the file names to copy in absolute paths.void
initializeFontFiles
(EditorFontFiles ff, String baseRef) Creates the font files definition.static List<CSSFontDefinition>
Processes a CSS file from a file.static List<CSSFontDefinition>
parse
(CSSRuleList list, ArrayList<String> warnings, File dir, boolean doIcons) Parses all fond definitions found in a style sheet.
Field Details
fontFamily
The font family.fontStretch
The font stretch, null for default "normal".fontStyle
The font style, null for default "normal".fontWeight
The font weight, null for default "normal".unicodeRange
The unicode range, null for default "U+0-10FFFF".iconStyleDecls
At least one style declaration in one or more @FontFace.icons
The map of available icons, sorted by name.fontFiles
The font files required.fontFormats
The font file formats, null entries when not found.fontQueries
The font files queries, null entries when not found.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
Gets the font files required, relative the CSS document URL.- Returns:
- A list of files from the 'src' declarations.
getRequireFontFileNames
Gets the file names to copy in absolute paths.getIconCSS
Gets the icon CSS declaration string.initializeFontFiles
Creates the font files definition.