Every family a draw can match, sorted and de-duplicated -- the platform's own plus anything FontLibrary.use has added.
The weights, widths and styles available under name, or undefined
when nothing resolves under it.
Forget every face registered with FontLibrary.use and drop the cached font collections. System fonts are unaffected.
Register one or more font files, optionally under an alias of your own.
Naming an alias files every face given under that family name, whatever
the file itself declares, which is how a face is reached from
ctx.font by a name of your choosing. Without one, each face keeps the
family name it declares.
Paths, Buffers and ArrayBuffers are all accepted, as is an object
mapping several aliases to their files in one call. The return value
describes the faces that were read -- an empty array means the file
held no usable font.
FontLibrary.use("Colorfont", "./fonts/Colorfont-Regular.ttf")
FontLibrary.use(["./fonts/Inter-Regular.ttf", "./fonts/Inter-Bold.ttf"])
FontLibrary.use({ Headline: "./fonts/Playfair.ttf" })
OptionalfontPaths: string | readonly string[]As above, from font data already in memory rather than a path.
As above, filing several in-memory faces under one alias -- the weights and styles of a single family, typically.
As above, with no alias: each face keeps the family name its file declares.
As above, registering several aliases at once. The result maps each alias to the faces read for it, so a family that contributed nothing is visible as an empty array.
The process-wide font registry: what a draw can match by name, and how to add faces that are not installed on the system.
Its state is global rather than per-canvas, so a family registered here is visible to every canvas, window and paragraph in the process.
🧪 Not in the HTML Canvas standard.