【问题标题】:Firefox completelly refuses font load due to EOT由于 EOT,Firefox 完全拒绝字体加载
【发布时间】:2016-04-28 08:15:37
【问题描述】:

我注意到 Firefox 拒绝在我的一个网页上加载自定义字体。我 90% 确定它在一个月前有效。现在我使用 Firefox 43.04 (Windows)。控制台中的错误是:

downloadable font: rejected by sanitizer (font-family: "PT Serif" style:normal weight:bold stretch:normal src index:0) source: https://localhost:8443/project/fonts/2/pt-serif-v8-latin_latin-ext-700.eot

HTML 文本改为使用系统字体(Times New Roman)呈现。

相关的 CSS 是:

@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts//pt-serif-v8-latin_latin-ext-700.eot'); /* IE9 Compat Modes */
  src: local('PT Serif Bold'), local('PTSerif-Bold'),
       url('../fonts//pt-serif-v8-latin_latin-ext-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('../fonts//pt-serif-v8-latin_latin-ext-700.woff') format('woff'), /* Modern Browsers */
       url('../fonts//pt-serif-v8-latin_latin-ext-700.ttf') format('truetype'), /* Safari, Android, iOS */
}

如果我用 eot 删除这两行,那么它可以正常工作(使用网络字体)。

问题是,当问题只是一种格式时,为什么它会拒绝整个字体系列? 我需要 eot 用于 IE(奇怪,caniuse 声称 IE 从 v9 开始支持 WOFF,但它似乎不适用于我的 IE11)。

我通过https://google-webfonts-helper.herokuapp.com/fonts下载了字体文件

【问题讨论】:

    标签: firefox webfonts google-webfonts


    【解决方案1】:

    CSS 行(带有“Safari、Android、iOS”的行)以逗号而不是分号结尾。 (脸红)

    正确的(经测试可以使用)版本是:

    @font-face {
      font-family: 'PT Serif';
      font-style: normal;
      font-weight: 700;
      src: url('../fonts//pt-serif-v8-latin_latin-ext-700.eot'); /* IE9 Compat Modes */
      src: local('PT Serif Bold'), local('PTSerif-Bold'),
           url('../fonts//pt-serif-v8-latin_latin-ext-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
           url('../fonts//pt-serif-v8-latin_latin-ext-700.woff') format('woff'), /* Modern Browsers */
           url('../fonts//pt-serif-v8-latin_latin-ext-700.ttf') format('truetype'); /* Safari, Android, iOS */
    }

    【讨论】:

    • 我可以确认这会导致 Firefox 被拒绝。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 2014-11-10
    相关资源
    最近更新 更多