【发布时间】:2016-03-04 11:25:39
【问题描述】:
我已经看到了如何使用这种语法在每行、每个字符的基础上将多种样式应用于给定 IText 对象的示例...
var iTextSample = new fabric.IText('hello\nworld', {
styles: {
0: {
0: { textDecoration: 'underline', fontSize: 80 },
1: { textBackgroundColor: 'red' }
},
1: {
0: { textBackgroundColor: 'rgba(0,255,0,0.5)' },
4: { fontSize: 20 }
}
}
});
在这里拉小提琴- https://jsfiddle.net/tLy9eqj6/
是否有类似的语法可以仅使用一组参数在一行中设置多个字符?例如,这将在第 1 行的前 5 个字符下划线...
var iTextSample = new fabric.IText('hello\nworld', {
styles: {
0: {
[0,1,2,3,4]: { textDecoration: 'underline' }
}
}
});
【问题讨论】:
标签: fabricjs