How to change the font style of a text canvas using Fabric.js ?
In this article, we are going to see how to change the font style of a text canvas using FabricJS. The canvas means text written is movable and can be stretched according to the requirement. Further, the text itself cannot be edited like a textbox.
fabric.Text(text, fontStyle: number);
Parameters: This function accepts two parameters as mentioned above and described below:
- text: It specifies the text to be written.
- fontStyle: It specifies the font style which can be normal, oblique or italic where normal is the default style.
Program: This example uses FabricJS to change font style of a text canvas.