【问题标题】:Icomoon font generator: Failed to decode downloaded fontIcomoon 字体生成器:无法解码下载的字体
【发布时间】:2016-01-04 07:33:22
【问题描述】:

我使用了一些来自https://icomoon.io/app/#/select的图标字体

当我使用生成的 CSS 时,它可以从实际 HTML 页面上的样式标签正常工作:

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

当我将 CSS 放入我的 CSS 文件并调整路径时:

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

我在开发者控制台中收到此错误:

Failed to decode downloaded font: file:///C:/Users/Daisy/Desktop/softstack%20consulting/fonts/icomoon.eot?hsw0h3
OTS parsing error: invalid version tag

我不明白为什么仅通过移动 CSS 并更改其路径就无法解码字体。我做错了什么,我该如何解决?

【问题讨论】:

    标签: html css fonts


    【解决方案1】:

    您正在使用以下行覆盖 srcsrc: url('../fonts/icomoon.eot?hsw0h3');

    更仔细地查看原始 CSS。那些用逗号分隔的不同格式应该是第二个src 值的一部分,而不是第一个。

    【讨论】:

      猜你喜欢
      • 2017-08-12
      • 2015-08-07
      • 2015-09-09
      • 1970-01-01
      • 2015-12-14
      • 1970-01-01
      • 2015-12-22
      • 2017-04-14
      • 1970-01-01
      相关资源
      最近更新 更多