Skip to main content

Posts

Showing posts from May, 2017

Text styling of HTML5 Canvas using fabricjs

In previous post I have shared code to add text to HTML5 canvas using fabricjs. refer http://newapputil.blogspot.in/2017/03/write-text-on-html5-canvas-using.html Here in this post below is the code to change text style to italic , making text bold and underline the text using fabricjs on html5 canvas. This code will work when text object is selected. <canvas id= "c" width= "600" height= "600" ></canvas> <input type= "text" class= "add-text" > <button class= "add-text-btn" > Add Text </button> <button class= "bold-text-btn" > Bold </button> <button class= "underline-text-btn" > Underline </button> <button class= "italic-text-btn" > Italic </button> javascript code: // initialize fabric canvas and assign to global windows object for debug var canvas = window ._canvas = new fabric.Canvas( 'c