How to use a custom font in canvas

code:
registerFont('Montserrat-Black.ttf', { family: 'Montserrat Black' });
//...
ctx.fillStyle = 'white';
ctx.font = '35px Montserrat Black';
ctx.fillText(message, 280, 114, 710);
registerFont('Montserrat-Black.ttf', { family: 'Montserrat Black' });
//...
ctx.fillStyle = 'white';
ctx.font = '35px Montserrat Black';
ctx.fillText(message, 280, 114, 710);
the Montserrat-Black.ttf file is in the same directory as the project and is not corrputed or anything, I've tried several times but I can't manage to use the font I want.
3 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
treble/luna
treble/luna5mo ago
not djs related, #other-js-ts
Cryingfreeman74
Cryingfreeman745mo ago
sorry