我正在尝试在图像上覆盖unicode字符,但字符没有显示。
var img = new Image()
img.src = fs.readFileSync(path.join(__dirname, 'images', 'snow.jpg'))
ctx.drawImage(img, 0, 0, 500, 500)
img = new Image()
//img.src = canvas.toBuffer()
ctx.font = "40pt Calibri";
ctx.lineWidth = 1
ctx.strokeStyle = '#ddd'
ctx.fillStyle = '#000'
ctx.fillText('Wahoo', 49, 99)
ctx.rotate(0.5)
ctx.translate(20, -40)
ctx.fillText("Testing", 100, 180)
ctx.rotate(0)
ctx.translate(20, -60)
// Unicode here
ctx.fillText('\u5929\u6c23', 160, 100)
canvas.createPNGStream().pipe(res);`发布于 2020-12-17 01:04:28
可能会替换掉
ctx.strokeText = "#ddd"
通过
ctx.fillText = "#ddd"
它可能会工作得更好,并正确地显示...
https://stackoverflow.com/questions/39280547
复制相似问题