在IE7和IE8中,使用自定义网络字体时,即使我明确设置
我正在使用以下
font-style: normal
,有时文本也会以斜体呈现。这个问题是零星发生的 - 它会正常渲染几次,然后我刷新一下,一切都是斜体,然后我再刷新一下,它就恢复正常了。我正在使用以下
@font-face
声明:@font-face {
font-family: 'DIN';
src: url('fonts/DINWeb.eot');
src: url('fonts/DINWeb.eot?#iefix') format('embedded-opentype'),
url('fonts/DINWeb.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'DIN';
src: url('fonts/DINWeb-Bold.eot');
src: url('fonts/DINWeb-Bold.eot?#iefix') format('embedded-opentype'),
url('fonts/DINWeb-Bold.woff') format('woff');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'DIN';
src: url('fonts/DINWeb-Ita.eot');
src: url('fonts/DINWeb-Ita.eot?#iefix') format('embedded-opentype'),
url('fonts/DINWeb-Ita.woff') format('woff');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: 'DIN';
src: url('fonts/DINWeb-BoldIta.eot');
src: url('fonts/DINWeb-BoldIta.eot?#iefix') format('embedded-opentype'),
url('fonts/DINWeb-BoldIta.woff') format('woff');
font-weight: bold;
font-style: italic;
}
有一篇文章上的评论表明这可能与@font-face
声明的顺序有关: 但是唯一阻止问题的事情是完全删除斜体声明。
另一个 Stack Overflow答案建议使用Font Squirrel @font-face生成器; 但是我无法使用它,因为我正在使用带有DRM的Web字体文件。
是否有一种方法可以在完全删除斜体声明的情况下解决此问题?
更新:经过进一步调查,似乎这个问题也影响IE8,而不仅仅是兼容模式。
@font-face
字体族名称。例如:DINnormal,DINbold,DINitalic,DINboldItalic
。在此SO Answer中查看CSS和HTML示例。如果创建独特的名称解决了您的问题,我将回答。干杯! - arttronics