gpt4 book ai didi

spring-mvc - Spring Boot-Font Awesome OTS解析错误:转换失败

转载 作者:行者123 更新时间:2023-12-03 08:16:06 24 4
gpt4 key购买 nike

在Spring Boot / Spring MVC应用程序中字体无法正常工作的问题。

问题是所有字体文件都显示各种错误,如下所示

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正在过滤字体文件并损坏它们。

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


此更改允许在打包过程中不过滤字体。

关于spring-mvc - Spring Boot-Font Awesome OTS解析错误:转换失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34037051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com