Class FontManager
Constructors
constructor
-
Returns FontManager
Methods
StaticgetCoreDefinitions
-
Collect all the font definitions and combine them.
Returns { [key: string]: FamilyDefinition }[]
Core font definitions.
StaticloadFonts
-
loadFonts(
opts?: {
document?: Document;
editor?: boolean;
fonts?:
| { [key: string]: FamilyDefinition }[]
| { [key: string]: FamilyDefinition };
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
Optionalopts: {
document?: Document;
editor?: boolean;
fonts?:
| { [key: string]: FamilyDefinition }[]
| { [key: string]: FamilyDefinition };
ms?: number;
}Optional parameters.
-
Optionaldocument?: DocumentThe target document to load the fonts into.
-
Optionaleditor?: booleanWhen true verifies the
editorfield of FontFamilyDefinition. -
Optionalfonts?: { [key: string]: FamilyDefinition }[] | { [key: string]: FamilyDefinition }A custom set of font family definitions to load. If not defined the core font family definitions are loaded.
-
Optionalms?: numberThe maximum time to spend loading fonts before proceeding.
-
Returns Promise<void>
StaticremoveDuplicateDefinitions
-
removeDuplicateDefinitions(
fonts: { [key: string]: FamilyDefinition }[],
): { [key: string]: FamilyDefinition }[]Removes duplicate font definitions.
Parameters
- fonts: { [key: string]: FamilyDefinition }[]
An array of FontFamilyDefinition objects to process.
Returns { [key: string]: FamilyDefinition }[]
Filtered font definitions.
- fonts: { [key: string]: FamilyDefinition }[]
Loads FVTT core fonts supporting
FontConfigon 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.