我上传了我们公司外包的登陆页面,而 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 有什么特殊之处导致它无法显示字体吗?
最佳答案
我明白了。我正在使用 NoScript 插件。它保护我免受来自 google 的 XSS 攻击的威胁,即使整个网站都被允许。 :D
我将研究 noscript 中是否有允许使用字体的设置,并在此处发布我的发现。
这不太可能给我们的客户带来问题。如果他们自己使用 NoScript,他们可能不会担心登陆页面上的字体。
编辑:
我能够让这个工作。在 NoScript > Options
下,我选择了 Advanced
选项卡和 XSS
选项卡。然后我添加了以下异常(exception):
^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$
关于css - Firefox 无法从 Google Font API 渲染字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12207690/