标签:rect pre header local file 错误 bsp host localhost
前言:jar 包里面的字体加载,浏览器 console 中报警告信息,这里记录一下解决方案。
附:自己的一个 jar 包源码 https://github.com/yuleGH/querydb
错误问题:
谷歌浏览器 console 中报警告信息:
Failed to decode downloaded font: http://localhost:8080/font/element-icons.woff?v=230-rc1
OTS parsing error: incorrect file size in WOFF header
原因:
网上说是由于使用 maven 的 resource 插件开启 filtering 功能后,会破坏有二进制内容的文件。
解决方案:
我把我的 jar 包里面的代码贴出来,亲测可用
<!--配置打包时字体文件不被maven拷贝,导致字体文件破坏--> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> <include>**/*.html</include> <include>**/*.js</include> <include>**/*.css</include> <include>**/*.xml</include> </includes> <excludes> <exclude>**/*.ttf</exclude> <exclude>**/*.woff</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>**/*.ttf</include> <include>**/*.woff</include> </includes> </resource>
解决访问 jar 包里面的字体报错:OTS parsing error: incorrect file size in WOFF header
标签:rect pre header local file 错误 bsp host localhost
原文地址:https://www.cnblogs.com/yuxiaole/p/9739814.html