Found 566 Articles for FabricJS

How to set the baseline of subscript with Text using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:59:10

151 Views

In this tutorial, we are going to learn how to set the baseline of subscript with Text using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. We can also use the subscript property where we can specify its baseline value. Syntax new fabric.Text(text: String , { subscript : {“size”: Number, "baseline": Number}: Object }: ... Read More

How to set the background colour of text lines with Text using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:57:44

228 Views

In this tutorial, we are going to learn how to set the background colour of text lines with Text using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. Similarly we can also set the background colour of text lines by using the textBackgroundColor property. Syntax new fabric.Text(text: String , { textBackgroundColor : String }: ... Read More

How to set the angle of rotation of an instance in Text using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:56:03

141 Views

In this tutorial, we are going to learn how to set the angle of rotation of an instance in Text using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. Similarly, we can also set the angle of rotation of an instance by using the rotate method. Syntax rotate(angle: Number) Parameters angle − ... Read More

How to set the angle of rotation of a Text using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:54:18

919 Views

In this tutorial, we are going to set the angle of rotation of a Text using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. The angle property in FabricJS defines the angle of 2D rotation of an object. We also have the centeredRotation property that allows us to use the center point of a ... Read More

How to scale a Text object to a given width using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:52:54

202 Views

In this tutorial, we are going to learn how to scale a Text object to a given width using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. Similarly we can also scale a Text object to a given width by using the scaleToWidth method. Syntax scaleToWidth(value: Number, absolute: Boolean) Parameters value − ... Read More

How to scale a Text object to a given height using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:51:17

238 Views

In this tutorial, we are going to learn how to scale a Text object to a given height using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. Similarly we can also scale a Text object to a given height by using the scaleToHeight method. Syntax scaleToHeight(value: Number, absolute: Boolean) Parameters value − ... Read More

How to scale a Text object equally to horizontal and vertical direction using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:49:26

186 Views

In this tutorial, we are going to learn how to scale a Text object equally to horizontal and vertical direction using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. Similarly we can also scale a Text object by using the scale method. Syntax scale(value: Number) Parameters scale − This parameter accepts a ... Read More

How to make controlling corners of Text transparent using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:48:13

76 Views

In this tutorial, we are going to learn how to make the controlling corners of Text transparent using FabricJS.We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. The transparentCorners property allows us to make the controlling corners of Text object transparent. Syntax new fabric.Text(text: String ,{ transparentCorners: Boolean }: Object) Parameters text − This ... Read More

How to include Text object's default values in its serialization using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:46:34

219 Views

In this tutorial, we are going to learn how to include Text object’s default values in its serialization using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but we can also add additional functionalities. Serialization is used in order to export canvas contents. In order to achieve this we use toObject() and toJSON() methods. The includeDefaultValues property allows us to include or omit the object’s default values when being serialized. Syntax new fabric.Text(text: String , { includeDefaultValues: Boolean }: ... Read More

How to get the style of current selection in Text using FabricJS?

Rahul Gurung
Updated on 14-Sep-2022 10:44:58

621 Views

In this tutorial, we are going to learn how to get the style of current selection of Text using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. We can also find the style of current selection by using the getSelectionStyles method. Syntax getSelectionStyles(startIndexopt, endIndexopt, completeopt) Parameters startIndexopt − This parameter accepts a ... Read More

Advertisements