【问题标题】:Firefox not Rendering Font from Google Font APIFirefox 不从 Google Font API 渲染字体
【发布时间】:2012-08-25 19:40:27
【问题描述】:

我上传了一个我们公司外包的登录页面,Firefox 不渲染Lato 字体,而是退回到更底层的东西。

我们从 fonts.googleapis.com 获得了以下样式表。

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  src: local('Lato Bold'), local('Lato-Bold'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/wkfQbvfT_02e2IWO3yYueQ.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 100;
  src: local('Lato Hairline'), local('Lato-Hairline'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/boeCNmOCCh-EWFLSfVffDg.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 300;
  src: local('Lato Light'), local('Lato-Light'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/KT3KS9Aol4WfR6Vas8kNcg.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/9k-RPmcnxYEPm8CNFsH2gg.woff) format('woff');
}

在 IE、Chrome、Opera 和 Safari 中没有问题。 Firefox 是否有什么特别之处无法显示字体?

【问题讨论】:

  • 你用的是什么版本的FF?在最新版本上运行良好:jsfiddle.net/charlescarver/znKfg/2
  • 在 FF 14.0.1 中也为我工作:jsfiddle.net/e6JWm/1
  • 我已经在 Vista 中尝试了 15 次,在 Ubuntu 中尝试了 14 次。
  • 我已关注您的链接,但字体未在我的浏览器中呈现。
  • 也为我工作! Windows 7 中的 FF 15!

标签: css firefox font-face noscript google-font-api


【解决方案1】:

如果在 Firefox 中使用 Noscript: 打开 NoScript Options,转到 Embeddings 选项卡并取消选中:Forbid @font-face

如所述:https://developers.google.com/fonts/docs/troubleshooting

【讨论】:

    【解决方案2】:

    我想通了。我正在使用 NoScript 插件。它保护我免受来自谷歌的 XSS 攻击的威胁,即使整个网站都被允许。 :D

    我会研究 noscript 中是否有允许使用字体的设置,并将我的发现发布在这里。

    这不太可能给我们的客户带来问题。如果他们自己使用 NoScript,他们可能不会为着陆页上的字体而烦恼。

    编辑:

    我能够得到这个工作。在NoScript > Options 下,我选择了Advanced 选项卡和XSS 选项卡。然后我添加了以下异常:

    ^https://themes\.googleusercontent.com/static/fonts/lato/v6/[a-zA-Z\-_0-9]*\.woff$

    它比它需要的更具体。可以根据需要修剪子文件夹以允许更多站点。例如,以下内容应启用大多数字体:

    ^https://themes\.googleusercontent.com/static/fonts/[/a-zA-Z\-_0-9]*\.woff$

    【讨论】:

      【解决方案3】:

      您是在本地、在开发服务器上还是在类似的地方运行测试?检查 Firebug 的控制台,您应该能够在下载中找到错误,例如 404、权限或类似内容。

      【讨论】:

      • 不,在任何地方都找不到任何警告。如果 NoScript 有地方可以查看被阻止站点的详细信息,那将会很有趣,而且也许确实如此。我只是不知道在哪里。
      猜你喜欢
      • 1970-01-01
      • 2011-04-20
      • 2011-03-31
      • 2012-05-07
      • 2018-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-24
      相关资源
      最近更新 更多