在IE7和IE8中,使用自定义Web字体时,即使在明确设置font-style: normal
时,文本有时也会以斜体显示。这个问题是零星的 - 它会渲染几次,然后我刷新,一切都以斜体显示,然后我刷新并恢复正常。自定义字体有时在IE8/IE7中以斜体显示
我使用这个@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;
}
即使世界上a commentthis article表示它可能是对@font-face
声明的顺序:但已停止这一问题的唯一的事情是完全移除斜体声明。
Another Stack Overflow answer建议使用Font Squirrel @ font-face生成器;我无法做到这一点,因为我使用的网络字体文件有DRM。
有没有办法解决这个问题,而没有完全删除斜体声明?
更新:经过进一步调查,似乎这个问题也影响IE8,而不仅仅是在兼容模式下。
您没有提供您的HTML这是在使用中。尝试使用独特的'@ font-face'系列名称。例如:'DINnormal,DINbold,DINitalic,DINboldItalic'。在这个[** SO Answer **](http://stackoverflow.com/a/10273361/1195891)查看CSS和HTML示例。如果创建独特的名字可以解决您的问题,我会做出答复。干杯! – arttronics 2012-07-10 04:32:12
@arttronics谢谢,结果发现独特的字体家族名称最终解决了这个问题。如果你写了一个答案,我会继续接受它。 – 2012-09-03 05:24:25
亚当夏普,很高兴为你解决问题......我发布了一个答案。干杯! – arttronics 2012-09-03 21:10:46