处理springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

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

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文件中增长以下内容,不对字体文件进行过滤便可:java

<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>

 

最后不要忘记重启项目!!清空浏览器缓存!!web

相关文章
相关标签/搜索