Domanda

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);
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top