处理SPRINGBOOT OTS PARSING ERROR: FAILED TO CONVERT WOFF 2.0 FONT TO SFNT

  • 处理SPRINGBOOT OTS PARSING ERROR: FAILED TO CONVERT WOFF 2.0 FONT TO SFNT已关闭评论
  • 1,752次阅读
  • A+
所属分类:Spring

springboot项目中添加了字体等文件后,页面无法识别,浏览器调试窗口报错如下:

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff?v=4.4.0
OTS parsing error: incorrect file size in WOFF header

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.ttf?v=4.4.0
OTS parsing error: incorrect entrySelector for table directory

解决方式,pom文件中增加如下内容,不对字体文件进行过滤即可:

<build>
  <plugins>
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <configuration>
          <nonFilteredFileExtensions>
               <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
     </configuration>
    </plugin>
  </plugins>
</build>
  • 我的微信
  • 加好友一起交流!
  • weinxin
  • 微信公众号
  • 关注公众号获取分享资源!
  • weinxin