当我们定义@ font -face样式时,我们可以定义引用的文件是用于字体的粗体、斜体还是粗体斜体版本,如下面的SO问题中所讨论的:
How to add multiple font files for the same font?
示例:
@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工具包。相反,他们会这样做:
@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文件中,我们必须这样做:
h2 {
font-family: 'FontinSansBold', Verdana, sans-serif;
font-weight: normal;
}为什么Font Squirrel不使用font-weight和font-style声明来区分粗体和斜体呢?为什么要使用单独的字体系列?他们是否了解(缺少)某些浏览器对此功能的支持?
发布于 2011-04-14 08:34:40
它确实涉及到检查字体内部,以确定字体是粗体还是斜体。并且必须在字体内设置某些位,以便IE拾取样式链接。大多数粗体/斜体字体都设置了这些位,但不是全部。我们正在研究一种使其更加自动化的方法。
https://stackoverflow.com/questions/3795611
复制相似问题