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);

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.
Was this page helpful?