@font-face not displaying correctly in IE

30,224

Solution 1

Multiple font formats

To support a wide range of browsers, use a .ttf, .woff and .eot version of the font.

@font-face {
    font-family: 'shardee';
    src: url('fonts/Shardee.eot');
    src: url('fonts/Shardee.eot?#iefix')
             format('embedded-opentype'),
         url('fonts/Shardee.woff') format('woff'),
         url('fonts/Shardee.ttf') format('truetype');
}

You can use a Font conversion website like Font Squirrel, to convert the .ttf font into .woff and .eot.

DRM false positive

As @Jukka pointed out, there's a legal issue with the TTF file that's preventing it from being usable in Windows. In the IE developer console, the following error message is displayed :

CSS3114: @font-face failed OpenType embedding permission check.
Permission must be Installable.

Shardee appears to be an abandoned font with an unknown license type. Although it may be legal to use this font, Windows seems to require that every TTF file has DRM info that explicitly says it's legal to embed it in web pages. The error in IE is most likely a false positive.

To test this, I took a TTF font that's known to be legally licensed for use on websites. The TTF version didn't work in IE because of the DRM error. This example is definitely a false positive. This is one of the reasons why it's necessary to use multiple font formats, and why a single format like TTF will not work on all browsers.

Although Windows doesn't allow IE to use the TTF file, IE can still use the WOFF or EOT version. When I tested the above @font-face rule on a local webserver, using all three font formats, the Shardee font rendered correctly in all versions of IE (though with an error message in the IE developer console).

Steps to try:

  1. Convert the .ttf file to .woff and .eot
  2. Upload the .woff and .eot files to the same directory as the existing .ttf file.
  3. Replace the @font-face rule with the one above. I fixed a couple typos in the initial version of it.

If you still have a problem, there may be an issue with the web server settings. Related question: IE9 blocks download of cross-origin web font

Solution 2

By searching the web, I found this online tool that performs a fix on the TTF font, making it displayable by Explorer: https://www.andrebacklund.com/fontfixer.html

Solution 3

IE11: If you are receiving the CSS3114 error code in dev tools, you need to modify the first bits of the font file. This will allow IE to install the font.

Npm Module: You can use ttembed-js npm module, which will make the modifications for you. https://www.npmjs.com/package/ttembed-js

Usage: ttembed-js path/to/Shardee.ttf

Solution 4

FontPrep is an excellent Web Font Generator for the Mac OS X. it will even create a fonts.css

Solution 5

So the problem is apparently that on IE 10, the menu, inside the element with id=menu, does not appear in the declared font “shardee” but in the browser default font. This actually makes the menu readable. But technically, the explanation can be seen in Developer Tools (press F12 to enter them), in the Console pane. The error message, with code CSS3114, tells that @font-face did not pass the checks for usage rights for embedding.

Check out the usage rights of the font, and contact the copyright holder (which is to be presumed to be Bright Ideas) for obtaining the rights if possible.

Share:
30,224
Bart Roelofs
Author by

Bart Roelofs

This man is working on a amazing project in online sales.

Updated on April 27, 2020

Comments

  • Bart Roelofs
    Bart Roelofs about 4 years

    I have been searching for hours, asked friends and it didn't work out. So I hope you guys can help me. My website uses a custom font, but IE(10) doesn't support that on the way I do it. I have no idea it supports other methods. Here is mine:

        @font-face { font-family: shardee; src:url('fonts/Shardee.ttf'); }
    

    It is not necessary to have a custom font in Internet Explorer, but it would be nice.

    When Internet Explorer doesn't know the font, it used its default font. But the problem is, that the font-size of the custom font is perfect, but of the Internet Explorer default font it is way too big. I tried to fix it with a IE specific css code, but it just doesn't work at all. I am using the following css code for Interner Explorer:

        <!--[if IE]>
          <style>
              #menu ul li{ font-size:15px; }
          </style>
        <![endif]-->
    

    I have also tried it by a external stylesheet, which looked like this:

        <!--[if IE]>
          <link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_directory_uri() ?>/style/ie.css" />
        <![endif]-->
    

    The function I use in the php is a wordpress function that takes you to the path of your website. If you are not using wordpress, you can forget that code and leave it blank.

    The problem is not the path, the path is correct. I have looked into the source code in the browser, and it showed me the code I have in ie.css. The code in ie.css is exactly the same as above, but without the tags ect.

    I hope you guys can help me with this problem. 2 solutions are possible as far as I know. Let the ie specific css work, or show me a way to create custom fonts in IE. I am using Internet Explorer version 10.

    You can see the site here, but once it is fixed it will disappear because I don't need to put it on a subdomain once it is fixed.

    Kind regards, Bart Roelofs

  • Bart Roelofs
    Bart Roelofs about 11 years
    Thanks for the answer. But it didn't work out. It is working in chrome and Mozilla (and properly more browsers I haven't installed). But is doesn't work in IE 10. Maybe I do something wrong, but I have no idea what is should be.
  • Matt Coughlin
    Matt Coughlin about 11 years
    @BartRoelofs: I updated the answer with additional info, and an updated @font-face rule that worked fine in all versions of IE on a local web server using the Shardee font.
  • Matt Coughlin
    Matt Coughlin about 11 years
    Optionally add .svg files to support iOS 4.1 and earlier.
  • Admin
    Admin over 10 years
    @MattCoughlin thanks for the help, i also getting that error message on console . Fonts which i am using are many. and they working well, when i run application in local. but when i upload same application and sun from there it's not working well.
  • Peter Wilson
    Peter Wilson over 4 years
    that was the best fix for me!