css - 为什么 Firefox 从我的字体选项中选择了错误的字体粗细?

标签 css firefox fonts font-face

我一直在使用 Source Sans ProSource Code Pro在我的 sites , 它在 Safari 和 Chrome 中看起来很棒。然而,在 Firefox 中,似乎使用了错误的字体粗细,因为 Firefox 中的粗细要轻得多(也更难阅读)。我的@font-face declarations看起来像这样:

@font-face {
    font-family: 'Source Sans Pro';
    src: url('/fonts/sourcesanspro-regular-webfont.eot');
    src: url('/fonts/sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('/fonts/sourcesanspro-regular-webfont.woff') format('woff'),
         url('/fonts/sourcesanspro-regular-webfont.ttf') format('truetype'),
         url('/fonts/sourcesanspro-regular-webfont.svg#source_sans_proregular') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Source Sans Pro';
    src: url('/fonts/sourcesanspro-light-webfont.eot');
    src: url('/fonts/sourcesanspro-light-webfont.eot?#iefix') format('embedded-opentype'),
         url('/fonts/sourcesanspro-light-webfont.woff') format('woff'),
         url('/fonts/sourcesanspro-light-webfont.ttf') format('truetype'),
         url('/fonts/sourcesanspro-light-webfont.svg#source_sans_prolight') format('svg');
    font-weight: lighter; // light
    font-style: normal;

}

参见 the file完整的声明。在显示 normal 大小时,我的声明是否导致 Firefox 选择了错误的文件?

最佳答案

正如 this answer 中指出的那样,它看起来好像 Firefox 使用最后声明的 @font-face 给定样式来显示内容。我为 normal 样式定义的最后一个面具有 light 的权重,所以这是 Firefox 使用的。解决方案是使用 numeric weights@font-face 声明中,正如我现在所做的那样 here .然后它会在适当的地方正确使用正常权重。

关于css - 为什么 Firefox 从我的字体选项中选择了错误的字体粗细?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19737556/

相关文章:

html - IcoMoon 字体加倍

Android 自定义微调器未填充

javascript - 位置 :fixed floating menu confined to scroll position

html - 如何将网页表单元素换行?

Html:如何使用箭头键动态移动图像?

javascript - Firefox 中的 Web Worker 调试

javascript - Firefox 使用 drawImage 将 SVG 图像渲染到 HTML5 Canvas 时出错

javascript - jQuery 触发器在 Firefox 上不起作用

c# - 带有图形的自定义字体样式

javascript - 如何在一行中为移动设备和桌面设备分配一个 css 值