Represents the context for managing fonts in Penpot. This interface provides methods to interact with fonts, such as retrieving fonts by ID or name.
An array containing all available fonts.
Finds a font by its unique identifier.
The ID of the font to find.
Returns the Font object if found, otherwise null.
Font
null
const font = fontsContext.findById('font-id');if (font) { console.log(font.name);} Copy
const font = fontsContext.findById('font-id');if (font) { console.log(font.name);}
Finds a font by its name.
The name of the font to find.
const font = fontsContext.findByName('font-name');if (font) { console.log(font.name);} Copy
const font = fontsContext.findByName('font-name');if (font) { console.log(font.name);}
Finds all fonts matching a specific ID.
The ID to match against.
Returns an array of Font objects matching the provided ID.
const fonts = fontsContext.findAllById('font-id');console.log(fonts); Copy
const fonts = fontsContext.findAllById('font-id');console.log(fonts);
Finds all fonts matching a specific name.
The name to match against.
Returns an array of Font objects matching the provided name.
const fonts = fontsContext.findAllByName('font-name');console.log(fonts); Copy
const fonts = fontsContext.findAllByName('font-name');console.log(fonts);
Represents the context for managing fonts in Penpot. This interface provides methods to interact with fonts, such as retrieving fonts by ID or name.