Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"

2023-05-25,,

准确来讲,应该是maven项目使用Bootstrap时,出现

"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"

导致图标出不来的问题。

解决方案:

设置filter,font文件不需要filter,见下面示例:

 <build>
<finalName>bootstrap in maven</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
</excludes>
</resource>
<!-- fonts file cannot use filter as the data structure of byte file will be changed via filter -->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>

</resources>
...
</build>

原因:

上面的xml里也写了,因为经过maven的filter,会破坏font文件的二进制文件格式,到时前台解析出错。

Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"的相关教程结束。

《Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT".doc》

下载本文的Word格式文档,以方便收藏与打印。