GlyphtContext
Index
Constructors
Methods
Constructors
constructor
new GlyphtContext(): GlyphtContext
Returns
GlyphtContext
Methods
loadFonts 
loadFonts(
fontFiles: Uint8Array<ArrayBufferLike>[],
options?: LoadFontsOptions,
): Promise<FontRef[]>Load a set of fonts. This will return a list of FontRefs that can be subset.
There is no equivalent method for loading a single font, because a single font file could be a collection of multiple fonts and hence have to return an array anyway.
Parameters
fontFiles: Uint8Array<ArrayBufferLike>[]
Font files to load.
Optionaloptions: LoadFontsOptionsOptions object.
Returns
Promise<FontRef[]>A list of loaded fonts.
destroy
destroy(): void
Destroy this context, meaning any previously-loaded FontRefs can no longer be subset. All promises previously returned from FontRef#subset will resolve, but any further calls will error out.
If running in Node, Bun, Deno, or another such runtime, this will allow the program to exit once all font processing work is finished.
Returns
void
Context object for all font processing. This is what you use to load fonts.
All subsetting is done off-thread using a worker. If running in an environment where your program is meant to exit by itself (e.g. on the command line), you must call GlyphtContext#destroy after subsetting your fonts to close the worker thread and allow the program to exit.