0

Is there any way to use other font-family in HTML canvas?

  ctx.fillStyle = '#FFF';
  ctx.font = '43px Arial';
  ctx.textAlign = 'center';
  ctx.fillText(name, 220, 515);

This is using Arial and it works as it's in the sans-serif family, but I've tried by using other family and it fails.

I've tried to change Arial to Segoe-UI font like this:

ctx.font = '43px Segoe-UI';

But still no effect, how can I use segoe font on html canvas? If there's no way, is it proper if I save that text into images and import as images into the canvas?

cpru
  • 78
  • 1
  • 7
Khairul Habib
  • 452
  • 1
  • 12
  • 29

0 Answers0