1. 将外部字体放在与index.html同目录下;
  2. 打开index.html文件;
  3. 在style中引入外部字体:
      @font-face {
                font-family: 'MyText';
                src:url('./font/MyText.ttf') ;
            }
  4. 在script里监听字体是否加载完成:
            document.fonts.ready.then(success, fail);
            function success(){
                egret.runEgret({renderMode:"webgl", audioType:0});
            }
            function fail(){
    
            }  
  5. 直接引用:label.fontFamily ="MyText"

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-11-02
  • 2022-02-09
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-04
  • 2022-12-23
  • 2021-06-09
  • 2021-04-21
  • 2021-07-16
相关资源
相似解决方案