Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font-face not working in IE, otf font

I know this was asked multiple times, but I couldn't get it to work after trying them. This is the simple CSS I am using to import a custom font. Also, I am using this with bootstrap.

@font-face {
    font-family: Montserrat-Black;
    src: url(Montserrat-Black.otf);
}

It's not working in IE11 itself. Please help me out. Thank you.

like image 903
Kristie Matthew Avatar asked May 28 '15 08:05

Kristie Matthew


People also ask

Does OTF work on all browsers?

TTF/OTF - TrueType and OpenType font support on Android Browser is fully supported on 2.3-103, partially supported on None of the versions, and not supported on 2.1-2.1 Android Browser versions.

Can I use OTF as web font?

You can use EOT (Embedded OpenType) files for Internet Explorer and either OTF (OpenType) or TTF (TrueType) for the rest. (Additional options include WOFF (Web Open Font Format) and SVG (Scalable Vector Graphics) but we will stick to more common types here.)


3 Answers

Internet explorer use eot format (legacy) or woff. See MSDN

Anyway i use this code for maximum compatibility:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
like image 179
Germano Plebani Avatar answered Oct 05 '22 06:10

Germano Plebani


Try using .eot file format for Internet Explorer. Something like:

@font-face {
    font-family: Montserrat-Black;
    src: url('Montserrat-Black.eot');
    src: url('Montserrat-Black.otf');
}
like image 44
cakan Avatar answered Oct 05 '22 06:10

cakan


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/Montserrat-Black.otf

like image 40
Arlo Carreon Avatar answered Oct 05 '22 07:10

Arlo Carreon