我使用npm下载了FontAwesome,然后使用grunts copy任务将css文件和字体复制到我的电子应用程序的根目录中的右侧文件夹中.
到现在为止还挺好.一切都应该是它应有的地方.
现在,当我在我的应用程序中引用FontAwesome时,图标不会被加载.这些是我在控制台中遇到的错误:
Failed to decode downloaded font:
file:///path/to/fonts/fontawesome-webfont.woff2?v=4.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNTFailed to decode downloaded font:
file:////path/to/fonts/fontawesome-webfont.woff?v=4.4.0
OTS parsing error: incorrect file size in WOFF headerFailed to decode downloaded font:
file:////path/to/fonts/fontawesome-webfont.ttf?v=4.4.0
OTS parsing error: incorrect entrySelector for table directory
我已经尝试通过删除所有版本参数来修改FontAwesome的css文件,但这似乎不是问题.问题出现在通过电子启动应用程序.并在浏览器中查看html文件时.
UPDATE
回答一些意见:
>此问题发生在电子和浏览器中(在chrome和firefox中测试)
>我使用的是FontAwesome(4.4.0)和Electron(0.32.1)的最新版本(通过npm全新安装)
> css加载如:< link rel =“stylesheet”type =“text / css”href =“css / font-awesome.css”>
解决方法:
我有一个类似的问题(也许这个答案会帮助某人).我使用Maven来构建项目(Java JS). Maven Filter Plugin损坏了二进制字体文件.我不得不添加包含和排除:
<resources>
<resource>
<directory>${project.sources}</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.woff</exclude>
<exclude>**/*.ttf</exclude>
</excludes>
</resource>
<resource>
<directory>${project.sources}</directory>
<filtering>false</filtering>
<includes>
<include>**/*.woff</include>
<include>**/*.ttf</include>
</includes>
</resource>
</resources>
原文地址:https://codeday.me/bug/20190930/1835782.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。