为什么不在@ font-face,Font Squirrel定义字体重量或字体风格? [英] Why not define font-weight or font-style in @font-face, Font Squirrel?
问题描述
当我们定义@ font-face样式时,我们可以定义所引用的文件是否为字体的粗体,斜体或粗体斜体版本,如此SO问题所述:
When we define @font-face styles, we can define whether the referenced files are for the bold, italic, or bold italic versions of a font, as discussed in this SO question:
http://stackoverflow.com/questions/ 2436749 / how-to-define-bold-italic-using-font-face
示例:
@font-face {
font-family: 'FontinSans';
src: local('☺'), url('fontin_sans_regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'FontinSans';
src: local('☺'), url('fontin_sans_bold.woff') format('woff');
font-weight: bold;
font-style: normal;
}
但是,Font Squirrel不会以这种方式生成@ font-face他们这样做:
However, Font Squirrel doesn't generate @font-face kits this way. They do something like this instead:
@font-face {
font-family: 'FontinSans';
src: local('☺'), url('fontin_sans_regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'FontinSansBold';
src: local('☺'), url('fontin_sans_bold.woff') format('woff');
font-weight: normal;
font-style: normal;
}
这意味着在我们的CSS文件中,我们必须这样做: p>
Which means in our CSS files we have to do things like this:
h2 {
font-family: 'FontinSansBold', Verdana, sans-serif;
font-weight: normal;
}
为什么Font Squirrel使用font-weight和font-区分粗体和斜体变体?为什么要使用单独的字体系列?
Why doesn't Font Squirrel use the font-weight and font-style declarations to distinguish the bold and italic variants? Why use a separate font family? Do they know something about (lack of) support for this feature in some browser?
推荐答案
默认情况下,Font-Squirrel为了增加对不遵循规范的用户代理(那些忽略 font-weight
和 font-
By default, Font-Squirrel does this in order to increase support with user-agents that do not follow specification (those that ignore font-weight
and font-style
).
如果您不在乎那些过时的用户代理,您可以启用样式链接选项 @ font-face
工具包生成器的专家部分。请注意,IE8和以下版本忽略编号的 font-weight
值,并且只支持正常
和 / code>(和相应的
400
, 700
重量值)。
If you do not care about those outdated user-agents, you may enable the "Style Linking" option which is available in the expert section of the @font-face
kit generator. Note that IE8 and below ignores numbered font-weight
values and only support normal
and bold
(and corresponding 400
, 700
weight values).
这篇关于为什么不在@ font-face,Font Squirrel定义字体重量或字体风格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!