Creates and registers a new Font instance for both canvas and builder apis.
new Font(data, [alias])
The font alias. If not provided, a random UUID will be used. const data = await readFile('path/to/font.ttf'); const font = new Font(data, 'my-font');
The font data
The alias for this font.
Returns the font data that includes information such as the font name, weight, data, and style.
String representation of this font.
Unloads the font from the canvas and builder apis.
Creates a new Font instance from a buffer.
Parameter | Type | Description | Optional |
---|---|---|---|
buffer | The buffer containing the font data | ||
alias | The font alias. If not provided, a random UUID will be used. const buffer = await readFile('path/to/font.ttf'); const font = Font.fromBuffer(buffer, 'my-font'); |
Loads the default font bundled with this package. const font = Font.loadDefault();
/docs/canvacord/class/Font