单个字符上的FabricJS行高和字符间距
有没有办法在单个字符上添加字符间距和行高?我在这里工作以供参考,但无法在开发中复制相同的内容:https :
//www.papier.com/customise/spring-wildflowers-8451
这是小提琴链接:https :
//jsfiddle.net/tLy9eqj6/
var canvas=new fabric.Canvas('canv');
var iTextSample = new fabric.IText('hellonworld', {
left: 50,
top: 50,
fontFamily: 'Helvetica',
fill: '#333',
lineHeight: 1.1,
styles: {
0: {
0: { textDecoration: 'underline', fontSize: 80 },
1: { textBackgroundColor: 'red' }
},
1: {
0: { textBackgroundColor: 'rgba(0,255,0,0.5)' },
4: { fontSize: 20 }
}
}
});
canvas.add(iTextSample);
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.4.0/fabric.js"></script>
<canvas width="250" height="300"></canvas>