FontConfigs

FontConfigs class

Specifies font settings

class FontConfigs;

Constructors

NameDescription
constructor()Default Constructor.

Properties

PropertyTypeDescription
static defaultFontNamestringGets or sets the default font name.
static preferSystemFontSubstitutesbooleanIndicate 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

MethodDescription
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:

ParameterTypeDescription
fontNamestringfont 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:

ParameterTypeDescription
fontNamestringfont name
isBoldbooleanthe font style is bold or not
isItalicbooleanthe font style is italic or not
isExactStylebooleanwhether 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:

ParameterTypeDescription
originalFontNamestringOriginal font name.
substituteFontNamesstring[]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:

ParameterTypeDescription
originalFontNamestringoriginalFontName

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:

ParameterTypeDescription
fontFolderstringThe folder that contains TrueType fonts.
recursivebooleanDetermines whether or not to scan subfolders.

setFontFolders(string[], boolean)

Sets the fonts folders

static setFontFolders(fontFolders: string[], recursive: boolean) : void;

Parameters:

ParameterTypeDescription
fontFoldersstring[]The folders that contains TrueType fonts.
recursivebooleanDetermines whether or not to scan subfolders.

setFontSources(FontSourceBase[])

Sets the fonts sources.

static setFontSources(sources: FontSourceBase[]) : void;

Parameters:

ParameterTypeDescription
sourcesFontSourceBase[]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

FontSourceBase[]