Question

I have downloaded font js file using Cufon builder. But when I use in my canvas that font is not working. Please help me...

<script src="js/Verdana_400.font.js"></script>

                 var textObj = new fabric.Text("Sample", { 
                      fontFamily:'Verdana_400', 
                      left: 100,
                      fontSize: 80,
                      top: 100
                  }); 
canvas.add(textObj);
Was it helpful?

Solution

You should try fontFamily: 'Verdana'

400 is the normal weight for fonts, as I recall. Typically, the name of the font file doesn't match the fontFamily name. It's better to look in your computer to see what how fonts are typically named, and use that name. For instance, I have a font file called airalbd.tff, and I just say fontFaimly: 'Arial' and `fontWeight: 'Bold' to make use of it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top