fabric.js 字体锯齿问题

一种解决方案,给字体添加一个有透明度的描边,锯齿会减轻一些

totalDistanceText = new fabric.Textbox('0m', {
    textAlign: 'center',
    width: bodyWidth,
    hoverCursor: 'default',
    selectable: false,
    fill: "#ffffff",
    fontWeight: 800,
    top: computedPx(30),
    fontSize: 33,
    // 这里给字体加一个透明度为0.5的描边
    stroke: 'rgba(255,255,255,0.6)',
    strokeWidth: 1,

    fontFamily: 'PingFangSC-Semibold, PingFang SC'
})
canvas.add(totalDistanceText);

  

posted @ 2022-03-25 11:32  飞尽堂前燕  阅读(246)  评论(0编辑  收藏  举报