如何使Fabric.js IText字体不粗体?

时间:2015-04-01 02:35:48

标签: fabricjs

In this jsfiddle我有一个fontWeight: 'normal'的IText,字体仍以粗体字母显示。如何使这个文字不粗体?

使用Javascript:

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

var text = new fabric.IText('This is the text',{
    left: 20,
    top: 20,
    fontFamily: 'Arial',
    fontWeight: 'normal',
    fontSize: 18,
    stroke: 'black',
    fill: 'black'
});

canvas.add(text);

2 个答案:

答案 0 :(得分:4)

笔触效果使其显得粗体。

文本本身具有正常的标准体重here is a comparison without the stroke effect

var text = new fabric.IText('This is the text',{
  left: 20,
  top: 20,
  fontFamily: 'Arial',
  fontWeight: 'normal',
  fontSize: 18,
  fill: 'black'
});

答案 1 :(得分:0)

这只是因为中风,如果你删除了中风,那么你会得到fontweight:'Normal',请找到小提琴https://jsfiddle.net/Gauravkakkar25/ruoa19r7/1/