does fabricjs support letterspacing now?(fabricjs 2.0.0-beta5)

3.2k views Asked by At

I am trying to add letterspacing feature to my photo/text editing project using fabricjs.

Tried code

var newText= new fabric.IText('New Text', {
  fontWeight:200,
  fontSize:30,
  letterSpacing:30,//this line
  fill:"rgb(0,0,0)"
});

But not working. I found that this topic was found in 2015-2016 and think that it's solved now. But I can't find solution how to use letterspacing in fabricjs.
Topic1: https://github.com/kangax/fabric.js/issues/1974#issuecomment-255216649

1

There are 1 answers

0
Durga On BEST ANSWER

var canvas  = new fabric.Canvas('c');

var newText= new fabric.IText('New Text', {
  fontWeight:200,
  fontSize:30,
  charSpacing:1000,
  fill:"rgb(0,0,0)"
});
canvas.add(newText);
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="1000" height="1000"></canvas>

Use charSpacing to give additional space between characters.