我在使用Tomcat加载字体时有这样的错误:
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff2
1 OTS分析错误:无法将WOFF 2.0字体转换为SFNT
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regular-webfont.woff2
1 OTS分析错误:无法将WOFF 2.0字体转换为SFNT
%1无法解码下载的字体:https://my-address.com/css/fonts/fonts/fontawesom-webfont.woff2?v=4.3.0
1 OTS分析错误:无法将WOFF 2.0字体转换为SFNT
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regulation-webfont.woff
1 OTS分析错误:WOFF标头中的文件大小不正确
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff
1 OTS分析错误:WOFF标头中的文件大小不正确
https://fake.com/无法加载资源:NET::ERR_BLOCKED_BY_Client
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regulation-webfont.ttf
1 OTS分析错误:FFTM:未对齐的表
%1无法解码下载的字体:https://my-address.com/css/fonts/fonts/fontawesom-webfont.woff?v=4.3.0
1 OTS分析错误:WOFF标头中的文件大小不正确
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.ttf
1 OTS分析错误:GDEF:未对齐的表
%1无法解码下载的字体:https://my-address.com/css/fonts/fonts/fontawesom-webfont.ttf?v=4.3.0
1 OTS分析错误:表目录的entrySelector不正确
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-light_0-webfont.woff2
1 OTS分析错误:无法将WOFF 2.0字体转换为SFNT
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-light_0-webfont.woff
1 OTS分析错误:WOFF标头中的文件大小不正确
%1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-light_0-webfont.ttf
1 OTS分析错误:FFTM:无效的表偏移量
我从spring启动时没有这个错误。正确的文件在https://my-address.com/css/fonts/文件夹中。和字体显示不正确。我要修理什么才能使它正常工作?
如果您使用maven-resources-plugin复制带有选项
的webapp静态资源(包括字体),那么这可能是资源损坏的原因。
在这种情况下,您可以将筛选设置为false(示例):
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-frontend-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/static</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/build</directory>
<filtering>false</filtering> <!-- SET TO FALSE TO PREVENT RESOURCES CORRUPTION -->
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
有关maven资源筛选的更多信息
另一种选择是将资源排除在筛选之外(参见下面的@eppsilon注释)。