一种解决方案,给字体添加一个有透明度的描边,锯齿会减轻一些
totalDistanceText = new fabric.Textbox('0m', { textAlign: 'center', 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);