字体样式没有显示主要是因为字体还没有加载完成~

css

@font-face {
font-family: myFont;
src: local('sen.ttf'), url("sen.ttf");
}

html

<canvas ></canvas>

js

window.onload = function () {
let el = document.getElementById('can');
let ctx = el.getContext('2d');
ctx.font = '20px myFont';
ctx.fillText('你好啊啊啊啊', 20, 20);
};

 
                    
            
                

相关文章:

  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-12-21
  • 2021-11-28
  • 2021-05-08
相关资源
相似解决方案