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