收藏
回答

小游戏中,canvas调用fillText绘制文字,字体加粗无效(安卓无效,iso正常)

框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
小游戏 Bug Android 9 vivo Y3 8.0.3

代码如下:

import './js/libs/weapp-adapter'
import './js/libs/symbol'



const screenWidth = window.innerWidth
const screenHeight = window.innerHeight


wx.setEnableDebug({
  enableDebugtrue,
});


const ctx = canvas.getContext('2d')
const start = () => {


  requestAnimationFrame(() => {
    ctx.clearRect(00, canvas.width, canvas.height);
    ctx.fillStyle = '#ffffff'
    ctx.font = '40px Arial'


    ctx.fillText(
      '正常字体',
      0,
      screenHeight / 2 - 100 + 50
    )


    ctx.font = 'bold 40px Arial'
    ctx.fillText(
      '加粗字体',
      screenWidth / 2 ,
      screenHeight / 2 - 100 + 50
    )


    start()
  })
}
start()


安卓上表现:

ios中的表现:

安卓测试环境:vivo Y3、微信8.0.3(其它型号的安卓机也测试过,加粗也无效)

ios测试环境:iphonexs、微信8.0.2

回答关注问题邀请回答
收藏

1 个回答

  • 小游戏运营专员 - 宏
    小游戏运营专员 - 宏
    2021-06-25

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2021-06-25
    有用
    回复
登录 后发表内容