Custom font sometimes renders in italics in IE8 / IE7

后端 未结 3 1347
有刺的猬
有刺的猬 2021-02-09 15:13

In IE7 and IE8, when using a custom web font, text is sometimes rendered in italics, even when I explicitly set font-style: normal. The issue is sporadic - it will

相关标签:
3条回答
  • 2021-02-09 15:42

    If, like me, you came across this question while experiencing a similar issue using TypeKit fonts, this entry from the TypeKit blog explains how you can force unique font-family names for each weight & style of a TypeKit font to address it.

    0 讨论(0)
  • 2021-02-09 15:42

    I was having a similar issue, web font was showing in Italic when using IE8(Emulator), after digging and digging I came across a article that suggest emulator can sometimes be misleading especially when it comes to webFonts, and what it suggested was trying the site in the actual IE8, as I am using a windows 7 machine i wasn't able to download the real thing so I used this site called http://www.browserstack.com/ (No testers or fake browsers. Test in real browsers including Internet Explorer 6, 7, 8, 9, 10 and 11.)

    and i noticed my font was not italic anymore :D

    Here's the link to the article i read,

    http://blog.typekit.com/2013/03/14/the-dangers-of-cross-browser-testing-with-ie9s-browser-modes/

    Hope this helps you guys, if i came across something like this when researching it really would have saved me a few hours

    0 讨论(0)
  • 2021-02-09 15:46

    For each of your @font-face font-family names, create a custom name instead.

    Example:

    @font-face {
        font-family: 'DINnormal';
        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: 'DINbold';
        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: 'DINitalic';
        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: 'DINboldItalic';
        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;
    }
    

    After those CSS rules are defined, then you can include specific CSS rule:

    li {
      font: 18px/27px 'DINnormal', Arial, sans-serif;
    }
    
    0 讨论(0)
提交回复
热议问题