无法解码下载的字体,OTS 解析错误:无效的版本标签 + rails 4 [英] Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4

查看:38
本文介绍了无法解码下载的字体,OTS 解析错误:无效的版本标签 + rails 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行资产预编译,并在生产模式下运行应用程序.编译后,当我加载我的索引页面时,我在 chrome 控制台中收到以下警告:

I am doing assets pre-compile, and running the application in production mode. After compilation when I load the my index page I got followings warnings in the chrome console:

Failed to decode downloaded font: http://localhost:3000/fonts/ionicons.ttf?v=2.0.0
prospects:1 OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/ionicons.woff?v=2.0.0
prospects:1 OTS parsing error: invalid version tag

问题在于它没有加载图标而不是显示方块.

我们使用了自定义字体,代码如下:

we used the custom fonts and the code is:

@font-face {
  font-family: 'icomoon';
  src: font-url('icomoon.eot');
  src: font-url('icomoon.eot?#iefix') format('embedded-opentype'),
       font-url('icomoon.ttf') format('truetype'),
       font-url('icomoon.woff') format('woff'),
       font-url('icomoon.svg#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
}

我不知道我最后遗漏了什么.我搜索了很多,也尝试了解决方案,但没有任何成功.在开发模式下它工作正常,但不知道为什么它在生产模式下显示方块.

I don't know what is missing from my end . I searched a lot and also tried solution but not got any success.In development mode its working fine but don't know why its showing square in the production mode.

推荐答案

我得到了完全相同的错误,在我的情况下,结果是因为 @font-face 声明.由于我们使用的开发服务器(实时服务器)被配置为在任何 404:s 上提供默认的 index.html,网络检查员从未抱怨过 404.在不了解您的设置的任何详细信息的情况下,这可能是罪魁祸首.

I got the exact same error, and in my case it turned out to be because of a wrong path for the @font-face declaration. The web inspector never complained with a 404 since the dev server we're using (live-server) was configured to serve up the default index.html on any 404:s. Without knowing any details about your setup, this could be a likely culprit.

这篇关于无法解码下载的字体,OTS 解析错误:无效的版本标签 + rails 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆