[]
        
(Showing Draft Content)

FontCollection

Class: FontCollection

Represents a collection of fonts.

Extends

Constructors

Constructor

new FontCollection(): FontCollection;

Creates an empty FontCollection instance.

Returns

FontCollection

Overrides

ObjectBase.constructor

Constructor

new FontCollection(om): FontCollection;

Creates an empty FontCollection instance.

Parameters

om

ObjectManager

An object manager that controls the lifetime of the FontCollection object.

Returns

FontCollection

Overrides

ObjectBase.constructor

Accessors

count

Get Signature

get count(): number;

Gets the number of fonts in the FontCollection.

Returns

number


defaultFont

Get Signature

get defaultFont(): Font;

Gets or sets the default font for the current font collection.

Returns

Font

Set Signature

set defaultFont(font): void;

Gets or sets the default font for the current font collection.

Parameters
font

Font

Returns

void


id

Get Signature

get id(): number;

Gets the reference to the object.

Returns

number

Inherited from

ObjectBase.id


om

Get Signature

get om(): ObjectManager;

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

ObjectBase.om

Methods

getDefaultCollection()

Call Signature

static getDefaultCollection(): FontCollection;

Gets the default FontCollection instance.

Returns

FontCollection

The default FontCollection instance.

Call Signature

static getDefaultCollection(om): FontCollection;

Gets the default FontCollection instance.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the FontCollection object.

Returns

FontCollection

The default FontCollection instance.


addFallbackFont()

addFallbackFont(font): void;

Adds the specified font as fallback to the FontCollection.

Parameters

font

Font

The Font to be added as fallback font.

Returns

void


addFont()

addFont(
   font, 
   fallbackFont?, 
   defaultFont?): void;

Adds the specified font to the FontCollection.

Parameters

font

Font

The Font object to add, if the Font is not yet added.

fallbackFont?

boolean

true if the font should also be added to the list of fallback fonts, false otherwise.

defaultFont?

boolean

true if the font should be set as default font, false otherwise.

Returns

void


clear()

clear(): void;

Removes all fonts from the FontCollection.

Returns

void


clearFallbackFonts()

clearFallbackFonts(): void;

Clears the list of fallback fonts in the FontCollection.

Returns

void


clone()

clone(): FontCollection;

Creates a copy of the FontCollection.

Returns

FontCollection


contains()

contains(font): boolean;

Determines whether the font is in the FontCollection.

Parameters

font

Font

The Font to be searched.

Returns

boolean


free()

free(): void;

Detaches the object from the ObjectManager and deallocates its memory, if possible.

Returns

void

Inherited from

ObjectBase.free


getAt()

getAt(index): Font;

Gets the font with the specified index from the FontCollection.

Parameters

index

number

Returns

Font


indexOf()

indexOf(font): number;

Gets the index of the font in the FontCollection, or -1 if the font is not found.

Parameters

font

Font

The Font to be searched.

Returns

number


loadFont()

loadFont(
   fontBytes, 
   fallbackFont?, 
   defaultFont?): void;

Loads a font or font collection from the byte array.

Parameters

fontBytes

Uint8Array

The binary data of the font.

fallbackFont?

boolean

true if the font should be added to the list of fallback fonts, false otherwise.

defaultFont?

boolean

true if the font should be set as default font, false otherwise.

Returns

void


rebind()

rebind(omTo): void;

Rebinds the object from the current ObjectManager to the specified one.

Parameters

omTo

ObjectManager

The new ObjectManager for the object.

Returns

void

Inherited from

ObjectBase.rebind


remove()

remove(font): boolean;

Removes the specified font from the FontCollection.

Parameters

font

Font

The Font to be removed from the collection.

Returns

boolean

true if the font was actually removed, false otherwise.


removeAt()

removeAt(index): void;

Removes a font at the specified index.

Parameters

index

number

Returns

void


removeFallbackFont()

removeFallbackFont(font): void;

Removes the specified font from fallbacks of the FontCollection.

Parameters

font

Font

The Font to be removed from fallback fonts.

Returns

void


searchFont()

searchFont(searchFontOptions): Font;

Searches for a font with specified options in the FontCollection.

Parameters

searchFontOptions

SearchFontOptions

Returns

Font

The Font found, or null if not found.