Package com.github.tadukoo.view.font
Class FontFamily
java.lang.Object
com.github.tadukoo.view.font.FontFamily
- All Implemented Interfaces:
FontConstants
Represents a single font family. This can be a logical font, a proprietary font for which we have no files (but
can specify an alternate), or an open source font where we have the actual files and can specify a local path to
them.
- Version:
- Alpha v.0.2
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
Modifier and TypeFieldDescriptionprivate final FontFamily
The open source alternative font that can be substituted - may be null for open source fontsprivate final String
The font directory - may be null for non-open source fontsThe font files (includes all variants, such as bold, italic, etc.) - may be null for non-open source fontsprivate final String
The name of the fontFields inherited from interface com.github.tadukoo.view.font.FontConstants
BLACK, BLACK_ITALIC, BOLD, BOLD_ITALIC, EXTRA_LIGHT, EXTRA_LIGHT_ITALIC, ITALIC, LIGHT, LIGHT_ITALIC, MEDIUM, MEDIUM_ITALIC, OTF, REGULAR, SEMI_BOLD, SEMI_BOLD_ITALIC, THIN, THIN_ITALIC, TTF
-
Constructor Summary
ConstructorDescriptionFontFamily
(String name) This constructor is used for the logical fonts provided by Java.FontFamily
(String name, FontFamily alternate) This constructor is used for proprietary fonts, and provides an open source alternative.FontFamily
(String name, String directory, List<String> files) This constructor is used for open sources fonts included in a project. -
Method Summary
Modifier and TypeMethodDescriptiongetFiles()
getName()
makeRegularList
(String name, String extension) Creates a List of font filenames that just contains {name}-Regular.{extension} (a common occurrence).makeStandardList
(String name, String extension) Creates a list of font filenames containing the following: {name}-Regular.{extension} {name}-Bold.{extension} {name}-Italic.{extension} {name}-BoldItalic.{extension} This appears to be the most common list of filenames for fonts.makeStandardListWithAdditions
(String name, String extension, List<String> additions) Creates a list of font filenames containing the 4 standard ones (by callingmakeStandardList
), plus additional ones specified in the format {name}-{addition}.{extension}static String
stdFileStr
(String name, String type, String extension) Constructs a string in the form {name}-{type}.{extension} (which appears to be a common filename for a lot of fonts - .e.g Arimo-Regular.ttf, Gelasio-Medium.ttf, etc.)
-
Field Details
-
name
The name of the font -
directory
The font directory - may be null for non-open source fonts -
files
The font files (includes all variants, such as bold, italic, etc.) - may be null for non-open source fonts -
alternate
The open source alternative font that can be substituted - may be null for open source fonts
-
-
Constructor Details
-
FontFamily
FontFamily(String name) This constructor is used for the logical fonts provided by Java.- Parameters:
name
- The name of the logical Font
-
FontFamily
This constructor is used for open sources fonts included in a project. These fonts can be found in the TadukooFonts project.- Parameters:
name
- The name of the fontdirectory
- The font directoryfiles
- The font files (includes all variants, such as bold, italic, etc.)
-
FontFamily
FontFamily(String name, FontFamily alternate) This constructor is used for proprietary fonts, and provides an open source alternative.- Parameters:
name
- The name of the fontalternate
- The open source alternative font that can be substituted
-
-
Method Details
-
stdFileStr
Constructs a string in the form {name}-{type}.{extension} (which appears to be a common filename for a lot of fonts - .e.g Arimo-Regular.ttf, Gelasio-Medium.ttf, etc.)- Parameters:
name
- The name of the fonttype
- The type of font (e.g. Regular, Bold, Italic, etc.)extension
- The extension of the font (e.g. ttf)- Returns:
- A string of the form {name}-{type}.{extension}
-
makeRegularList
Creates a List of font filenames that just contains {name}-Regular.{extension} (a common occurrence).- Parameters:
name
- The name of the fontextension
- The extension of the font file (e.g. ttf)- Returns:
- A List containing just {name}-Regular.{extension}
-
makeStandardList
Creates a list of font filenames containing the following:- {name}-Regular.{extension}
- {name}-Bold.{extension}
- {name}-Italic.{extension}
- {name}-BoldItalic.{extension}
- Parameters:
name
- The name of the fontextension
- The extension of the font files (e.g. ttf)- Returns:
- A List of the 4 standard font filenames
-
makeStandardListWithAdditions
public static List<String> makeStandardListWithAdditions(String name, String extension, List<String> additions) Creates a list of font filenames containing the 4 standard ones (by callingmakeStandardList
), plus additional ones specified in the format {name}-{addition}.{extension}- Parameters:
name
- The name of the fontextension
- The extension of the font files (e.g. ttf)additions
- The additional types to be used (e.g. Medium, Semibold, etc.)- Returns:
- A List of the standard font filenames plus the additional ones
-
getName
- Returns:
- The name of the font
-
getDirectory
- Returns:
- The font directory - may be null for non-open source fonts
-
getFiles
- Returns:
- The font files (includes all variants, such as bold, italic, etc.) - may be null for non-open source fonts
-
getAlternate
- Returns:
- The open source alternative font that can be substituted - may be null for open source fonts
-