【问题标题】:Failed to decode downloaded font in Meteor无法在 Meteor 中解码下载的字体
【发布时间】:2015-12-22 10:23:36
【问题描述】:

这是我的 CSS:

@font-face {
    font-family: 'geometria_lightlight';
    src: url('Geometria-Light-webfont.eot');
    src: url('Geometria-Light-webfont.eot?#iefix') format('embedded-opentype'),
         url('Geometria-Light-webfont.woff2') format('woff2'),
         url('Geometria-Light-webfont.woff') format('woff'),
         url('Geometria-Light-webfont.ttf') format('truetype'),
         url('Geometria-Light-webfont.svg#geometria_lightlight') format('svg');
    font-weight: lighter;
    font-style: normal;

}

#logo{
  font-family: 'geometria_lightlight';
  font-size: 60px;
}

这是我在 Chrome 中收到的消息: 解码下载字体失败:http://localhost:3000/Geometria-Light-webfont.woff2 localhost/:1 OTS 解析错误:无效的版本标签 localhost/:1 解码下载字体失败:http://localhost:3000/Geometria-Light-webfont.woff

我通过 Font Squirrel 下载的每一种字体都会收到这条消息。

【问题讨论】:

  • 我也是这样,错误只与.woff字体文件有关。

标签: css meteor fonts


【解决方案1】:

将您的字体粘贴到文件夹public/fonts

然后做这样的事情:

@font-face {
  font-family: 'BebasNeueRegular';
  src: url('/fonts/BebasNeue-Regular.ttf') format('truetype');
}

【讨论】:

  • 有趣。您对为什么会发生这种情况有任何见解吗?谢谢
  • public 是 Meteor 搜索资产的地方。这有帮助吗?
  • meteor 中没有公用文件夹了。
  • 该问题仅与 .woff2 文件有关。
  • Meteor 中还有一个公用文件夹。在项目的根级别创建它。和@JoePrivett 相同的答案适用于 .woff2 格式。
【解决方案2】:

在尝试了许多其他方法,并在流星和 npm 配置中进行了大量重新安装和检查后,我刚刚通过清除 Chrome 中的浏览数据(缓存的图像和文件)然后刷新页面来解决这个问题。

【讨论】:

    猜你喜欢
    • 2015-08-07
    • 2015-09-09
    • 1970-01-01
    • 2017-08-12
    • 2016-03-17
    • 1970-01-01
    • 2017-08-14
    • 2018-06-11
    • 1970-01-01
    相关资源
    最近更新 更多