相同的代码,使用uniapp在iPhone XS Max safari浏览器和app里均无法加粗。
在jsrun里就可以加粗。
http://jsrun.net/4S6Kp
ctx.textBaseline = 'top'
ctx.fillStyle = '#333333'
ctx.save()
let {fontFamily = 'sans-serif', fontSize = 14, fontWeight = 'normal' , textStyle = 'normal'} = {}
ctx.font = `${textStyle} ${fontWeight} ${fontSize}px ${fontFamily}`;
ctx.fillText('我是默认的', 20, 10)
ctx.restore()
ctx.save()
let {fontFamily2 = 'sans-serif', fontSize2 = 14, fontWeight2 = 'bold' , textStyle2 = 'normal'} = {}
ctx.font = `${textStyle2} ${fontWeight2} ${fontSize2}px ${fontFamily2}`;
ctx.fillText('我是加粗的', 20, 50)
ctx.restore()
ctx.draw()
这是使用uniapp (hbx 2.9.3)的表现结果
这是在jsrun里跑的表现结果
陌上华年 (作者)
安卓是正常的,小程序也是正常的。。就IOS 的APP 和 浏览器 不行。。
2020-11-03 21:46