FontConfigs
FontConfigs class
Specifies font settings
class FontConfigs;
Constructors
Name | Description |
---|---|
constructor() | Default Constructor. |
Properties
Property | Type | Description |
---|---|---|
static defaultFontName | string | Gets or sets the default font name. |
static preferSystemFontSubstitutes | boolean | Indicate whether to use system font substitutes first or not when a font is not presented and the substitute of this font is not set. e.g. On Ubuntu, “Arial” font is generally substituted by “Liberation Sans”. Default value is false. |
Methods
Method | Description |
---|---|
static isFontAvailable(string) | Indicate whether the font is available. |
static getFontFileDataInfo(string, boolean, boolean, boolean) | Get data infomation of font file data. |
static setFontSubstitutes(string, string[]) | Font substitute names for given original font name. |
static getFontSubstitutes(string) | Returns array containing font substitute names to be used if original font is not presented. |
static setFontFolder(string, boolean) | Sets the fonts folder |
static setFontFolders(string[], boolean) | Sets the fonts folders |
static setFontSources(FontSourceBase[]) | Sets the fonts sources. |
static getFontSources() | Gets a copy of the array that contains the list of sources |
constructor()
Default Constructor.
constructor();
defaultFontName
Gets or sets the default font name.
static defaultFontName : string;
preferSystemFontSubstitutes
Indicate whether to use system font substitutes first or not when a font is not presented and the substitute of this font is not set. e.g. On Ubuntu, “Arial” font is generally substituted by “Liberation Sans”. Default value is false.
static preferSystemFontSubstitutes : boolean;
isFontAvailable(string)
Indicate whether the font is available.
static isFontAvailable(fontName: string) : boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
fontName | string | font name |
Returns
true if font is available, otherwise false.
getFontFileDataInfo(string, boolean, boolean, boolean)
Get data infomation of font file data.
static getFontFileDataInfo(fontName: string, isBold: boolean, isItalic: boolean, isExactStyle: boolean) : FontFileDataInfo;
Parameters:
Parameter | Type | Description |
---|---|---|
fontName | string | font name |
isBold | boolean | the font style is bold or not |
isItalic | boolean | the font style is italic or not |
isExactStyle | boolean | whether to match the given bold/italic style exactly |
Returns
Data infomation of font file data.
setFontSubstitutes(string, string[])
Font substitute names for given original font name.
static setFontSubstitutes(originalFontName: string, substituteFontNames: string[]) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
originalFontName | string | Original font name. |
substituteFontNames | string[] | List of font substitute names to be used if original font is not presented. |
getFontSubstitutes(string)
Returns array containing font substitute names to be used if original font is not presented.
static getFontSubstitutes(originalFontName: string) : string[];
Parameters:
Parameter | Type | Description |
---|---|---|
originalFontName | string | originalFontName |
Returns
An array containing font substitute names to be used if original font is not presented.
setFontFolder(string, boolean)
Sets the fonts folder
static setFontFolder(fontFolder: string, recursive: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
fontFolder | string | The folder that contains TrueType fonts. |
recursive | boolean | Determines whether or not to scan subfolders. |
setFontFolders(string[], boolean)
Sets the fonts folders
static setFontFolders(fontFolders: string[], recursive: boolean) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
fontFolders | string[] | The folders that contains TrueType fonts. |
recursive | boolean | Determines whether or not to scan subfolders. |
setFontSources(FontSourceBase[])
Sets the fonts sources.
static setFontSources(sources: FontSourceBase[]) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
sources | FontSourceBase[] | An array of sources that contain TrueType fonts. |
getFontSources()
Gets a copy of the array that contains the list of sources
static getFontSources() : FontSourceBase[];
Returns