Make Adobe fonts work with CSS3 @font-face in IE9

前端 未结 19 2159
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 10:04

I\'m in the process of building a small intranet application and try, with no luck, to use Adobe font I purchased lately. As I was informed, in our case it\

19条回答
  •  时光取名叫无心
    2020-11-27 10:26

    I recently encountered this issue with .eot and .otf fonts producing the CSS3114 and CSS3111 errors in the console when loading. The solution that worked for me was to use only .woff and .woff2 formats with a .ttf format fallback. The .woff formats will be used before .ttf in most browsers and don't seem to trigger the font embedding permissions issue (css3114) and the font naming incorrect format issue (css3111). I found my solution in this extremely helpful article about the CSS3111 and CSS3114 issue, and also reading this article on using @font-face.

    note: This solution does not require re-compiling, converting or editing any font files. It is a css-only solution. The font I tested with did have .eot, .otf, .woff, .woff2 and .svg versions generated for it, probably from the original .ttf source which did produce the 3114 error when i tried it, however the .woff and .woff2 files seemed to be immune to this issue.

    This is what DID work for me with @font-face:

    @font-face {
      font-family: "Your Font Name";
      font-weight: normal;
      src: url('your-font-name.woff2') format('woff2'),
           url('your-font-name.woff') format('woff'),
           url('your-font-name.ttf')  format('truetype');
    }
    

    This was what triggered the errors with @font-face in IE:

    @font-face {
      font-family: 'Your Font Name';
      src: url('your-font-name.eot');
      src: url('your-font-name.eot?#iefix') format('embedded-opentype'),
           url('your-font-name.woff2') format('woff2'),
           url('your-font-name.woff') format('woff'),
           url('your-font-name.ttf')  format('truetype'),
           url('your-font-name.svg#svgFontName') format('svg');
    }
    

提交回复
热议问题