user3475571
user3475571

Reputation: 11

how to get whole list of font family in fabric.js

I'm using fabric.js in my site. suppose if I need to add any text in canvas, I write - like-

var text1 = new fabric.Text('Fabric', {
  left: 90,
  top: 570,
  angle: -5,
  fontFamily: 'Helvetica',
  fontSize: 20,
  fill: 'red'
})

but I need all available fonts (like - times new roman, Helvetica) in a list so that I can select the font at run time, I tried to google it but I got nothing. I wonder if anybody help me. Thank in advance.

Upvotes: 1

Views: 5574

Answers (1)

Victor Axelsson
Victor Axelsson

Reputation: 1466

fabricjs doens't provide any fonts for you. Instead, it uses a html5 canvas and therefore have the font the browser provides for you.

If you need to list available fonts during runtime you can test out the following.

Of you can import you own using font-face.

Upvotes: 1

Related Questions