Spring Boot-Font Awesome OTS解析错误:转换失败 [英] Spring Boot - Font Awesome OTS parsing error: Failed to convert
本文介绍了Spring Boot-Font Awesome OTS解析错误:转换失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
字体问题在Spring Boot/Spring MVC应用程序中无法正常工作.
Problem with Fonts not working correctly within a Spring Boot / Spring MVC Application.
问题是所有字体文件都显示各种错误,如下所示
The problem is that all of the font files show various errors such as below
Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff2?v=4.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
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
推荐答案
问题是Maven正在过滤字体文件并破坏它们.
The issue is that Maven was filtering the font files and corrupting them.
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
解决方法是对pom.xml
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
</excludes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
</includes>
</resource>
此更改允许在包装过程中不过滤字体.
This change allows for the fonts to not be filtered during packaging.
这篇关于Spring Boot-Font Awesome OTS解析错误:转换失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文