[]
DsPdfJS API / FontCollection
Represents a collection of fonts.
new FontCollection():
FontCollection
Creates an empty FontCollection instance.
FontCollection
ObjectBase.constructor
new FontCollection(
om):FontCollection
Creates an empty FontCollection instance.
An object manager that controls the lifetime of the FontCollection object.
FontCollection
ObjectBase.constructor
get count():
number
Gets the number of fonts in the FontCollection.
number
get defaultFont():
Font|null
Gets or sets the default font for the current font collection.
Font | null
set defaultFont(
font):void
Gets or sets the default font for the current font collection.
Font | null
void
get id():
number
Gets the reference to the object.
number
get om():
ObjectManager
Gets the owner ObjectManager instance.
staticgetDefaultCollection():FontCollection
Gets the default FontCollection instance.
FontCollection
The default FontCollection instance.
staticgetDefaultCollection(om):FontCollection
Gets the default FontCollection instance.
An object manager that controls the lifetime of the FontCollection object.
FontCollection
The default FontCollection instance.
addFallbackFont(
font):void
Adds the specified font as fallback to the FontCollection.
The Font to be added as fallback font.
void
addFont(
font,fallbackFont?,defaultFont?):void
Adds the specified font to the FontCollection.
The Font object to add, if the Font is not yet added.
boolean = false
true if the font should also be added to the list of fallback fonts, false otherwise.
boolean = false
true if the font should be set as default font, false otherwise.
void
clear():
void
Removes all fonts from the FontCollection.
void
clearFallbackFonts():
void
Clears the list of fallback fonts in the FontCollection.
void
clone():
FontCollection
Creates a copy of the FontCollection.
FontCollection
contains(
font):boolean
Determines whether the font is in the FontCollection.
The Font to be searched.
boolean
free():
void
Detaches the object from the ObjectManager and deallocates its memory, if possible.
void
getAt(
index):Font
Gets the font with the specified index from the FontCollection.
number
indexOf(
font):number
Gets the index of the font in the FontCollection, or -1 if the font is not found.
The Font to be searched.
number
loadFont(
fontBytes,fallbackFont?,defaultFont?):void
Loads a font or font collection from the byte array.
Uint8Array
The binary data of the font.
boolean = false
true if the font should be added to the list of fallback fonts, false otherwise.
boolean = false
true if the font should be set as default font, false otherwise.
void
rebind(
omTo):void
Rebinds the object from the current ObjectManager to the specified one.
The new ObjectManager for the object.
void
remove(
font):boolean
Removes the specified font from the FontCollection.
The Font to be removed from the collection.
boolean
true if the font was actually removed, false otherwise.
removeAt(
index):void
Removes a font at the specified index.
number
void
removeFallbackFont(
font):void
Removes the specified font from fallbacks of the FontCollection.
The Font to be removed from fallback fonts.
void
searchFont(
searchFontOptions):Font|null
Searches for a font with specified options in the FontCollection.
Font | null
The Font found, or null if not found.