Compute Height of Character at Given Position in Text Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:11:40

439 Views

In this tutorial, we are going to learn how to compute the height of line at required line index 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. We can also compute the height of line at required line index by using the getHeightOfLine method. Syntax getHeightOfLine(lineIndex: Number) Parameters lineIndex ... Read More

Change Font Weight of Text Using Fabric.js

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

471 Views

In this tutorial, we are going to see how to change the font weight 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. Font weight refers to the value which determines how bold or light our text will appear. Syntax new fabric.Text(text: String , { fontWeight: Number|String }: Object) Parameters ... Read More

Change Font Style of Text Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:08:41

448 Views

In this tutorial, we are going to learn about how to change the font style in Text object 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 change the font style by using the fontStyle property. Syntax new fabric.Text(text: String, { fontStyle: String }: Object) Parameters text − This parameter ... Read More

Change Font Size of Text Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:05:06

1K+ Views

In this tutorial, we are going to see how to change the font size 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 font size specifies how large or small the characters, displayed in our Text object, should be. We can change the font size by using the fontSize property ... Read More

Change Font Family of Text Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:03:45

2K+ Views

In this tutorial, we are going to learn about how to change the font family of Text object 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 change the font family by using the fontFamily property. Syntax new fabric.Text(text: String, { fontFamily: String }: Object) Parameters text − This parameter ... Read More

Center Text Object Vertically on Canvas using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:02:12

800 Views

In this tutorial, we are going to learn how to center a Text vertically on canvas 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 center the text object vertically on the canvas by using the centerV method. Syntax centerV() Example 1 Default appearance of the Text object Let’s see ... Read More

Center Text Object Horizontally on Canvas Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 12:01:07

1K+ Views

In this tutorial, we are going to learn how to center a Text horizontally on canvas 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 center the text object horizontally on the canvas by using the centerH method. Syntax centerH() Example 1 Default appearance of the Text object Let’s see ... Read More

Center Text Object on Canvas Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 11:58:15

420 Views

In this tutorial, we are going to learn how to center a Text horizontally and vertically on canvas 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 center the text object horizontally and vertically on the canvas by using the center method. Syntax center() Example 1 Default appearance of the ... Read More

Add Underline to Text Using FabricJS

Rahul Gurung
Updated on 13-Sep-2022 11:56:59

689 Views

In this tutorial, we are going to learn how to add underline to 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 overline, line height which can be obtained by the properties textAlign, overline and lineHeight respectively. Similarly we can also add underline to text by using the underline property. Syntax new fabric.Text(text: String , { underline: Boolean }: Object) Parameters text − This parameter ... Read More

Add Superscript with Text Using Fabric.js

Rahul Gurung
Updated on 13-Sep-2022 11:55:38

284 Views

In this tutorial, we are going to learn how to add superscript 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 add superscripts by using the setSuperscript method. Syntax setSuperscript(start: Number, end: Number) Parameters start − This parameter accepts a Number as value. The value given determines ... Read More

Advertisements