收藏
回答

Canvas wx.loadFontFace 第三方字体 模拟器可以 真机无效?

// 字体组
fonts:[{img:'../../images/dongfangdakai1.png',url:'url("https://hao.tinymomo.com/public/uploads/dongfangdakai.ttf")', family:'fangdazhengkai'}]

//点击加载
wx.loadFontFace({
      global: true,
      family: this.data.fonts[this.data.fontIndex].family,
      source: this.data.fonts[this.data.fontIndex].url,
      success(res){
        console.log(res)
        wx.hideLoading()
        CanvasDrag.changeFamily(that.data.fonts[that.data.fontIndex].family)
      }, fail(e) {
        wx.hideLoading()
        console.log(e)
      }
})
// 版本  2.30.4  3.55 等等都不行

// canvas 
<canvas 
id="canvas-label"
canvas-id="canvas-label"></canvas>


// font设置  font = 'normal normal 18px fangyuanti'
this.ctx.font = this.italic + ' ' + this.weight + ' ' + parseInt(this.fontSize) + 'px ' + this.family


真机加载字体成功 loaded success

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

1 个回答

  • Waymon丶魏
    Waymon丶魏
    09-06

    @Demons

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