Class FontManager
Index
Constructors
Methods
Constructors
constructor
- new FontManager(): FontManager
Returns FontManager
Methods
Static
getCoreDefinitions
- getCoreDefinitions(): { [key: string]: FontFamilyDefinition }[]
Collect all the font definitions and combine them.
Returns { [key: string]: FontFamilyDefinition }[]
Core font definitions.
Static
loadFonts
- loadFonts(
opts?: {
document?: Document;
editor?: boolean;
fonts?:
| { [key: string]: FontFamilyDefinition }[]
| { [key: string]: FontFamilyDefinition };
ms?: number;
},
): Promise<void> Ensure that fonts have loaded and are ready for use. Enforce a maximum timeout in milliseconds. Proceed after that point even if fonts are not yet available.
Parameters
Optional
opts: {
document?: Document;
editor?: boolean;
fonts?:
| { [key: string]: FontFamilyDefinition }[]
| { [key: string]: FontFamilyDefinition };
ms?: number;
}Optional parameters.
Optional
document?: DocumentThe target document to load the fonts into.
Optional
editor?: booleanWhen true verifies the
editor
field of FontFamilyDefinition.Optional
fonts?:
| { [key: string]: FontFamilyDefinition }[]
| { [key: string]: FontFamilyDefinition }A custom set of font family definitions to load. If not defined the core font family definitions are loaded.
Optional
ms?: numberThe maximum time to spend loading fonts before proceeding.
Returns Promise<void>
Static
removeDuplicateDefinitions
- removeDuplicateDefinitions(
fonts: { [key: string]: FontFamilyDefinition }[],
): { [key: string]: FontFamilyDefinition }[] Removes duplicate font definitions.
Parameters
- fonts: { [key: string]: FontFamilyDefinition }[]
An array of FontFamilyDefinition objects to process.
Returns { [key: string]: FontFamilyDefinition }[]
Filtered font definitions.
- fonts: { [key: string]: FontFamilyDefinition }[]
Loads FVTT core fonts supporting
FontConfig
on Foundry v10+.Note: This class contains code modified from Foundry VTT core client code. There are only so many ways to process core Foundry data structures correctly.