I've been playing with canvas and the awesome fabric library. I can't get text to display in anything other than the normal weight. i.e.
var text2 = new fabric.Text('tseting', {
fontsize: 50,
fontFamily: 'Arial',
fontStyle = 'bold',
left: 100,
top: 100,
fill:"#FF0000"
});
canvas2.add(text2);
The 'bold' tag doesn't get applied. When I created the font.js
file suing cufon, I included the bold and italic fonts. Any ideas gratefully received.
I've been playing with canvas and the awesome fabric library. I can't get text to display in anything other than the normal weight. i.e.
var text2 = new fabric.Text('tseting', {
fontsize: 50,
fontFamily: 'Arial',
fontStyle = 'bold',
left: 100,
top: 100,
fill:"#FF0000"
});
canvas2.add(text2);
The 'bold' tag doesn't get applied. When I created the font.js
file suing cufon, I included the bold and italic fonts. Any ideas gratefully received.
- fontStyle = 'bold' you have used wrong property that means you should use bold property with fontWeight – Rash Commented Jun 19, 2013 at 14:23
2 Answers
Reset to default 5You've used the wrong property, and a typo ( the fontStyle = 'bold',
).
Use this instead:
var text2 = new fabric.Text('testing', {
fontSize: 50,
fontFamily: 'Arial',
fontWeight: 'bold',
left: 100,
top: 100,
fill: "#FF0000"
});
canvas2.add(text2);
fontStyle
refers to italic / normal.
Try fontWeight: bold
or fontWeight: 700
?