Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using @font-face in Microsoft Edge

I am dealing with a strange issue here.. It seems that Microsoft Edge browser doesn't load fonts when I use @font-face. I checked all my computers that run Windows 10 & Microsoft Edge.

I checked http://caniuse.com/#search=font%20face

It says that font-face is compatible with Edge so I don't know what's going on. In my example I just have a div and its font parameter.

CSS

@font-face{font-family:'Dosis';font-style:normal;font-weight:200;src:local('Dosis ExtraLight'), local('Dosis-ExtraLight'), url(http://fonts.gstatic.com/s/dosis/v4/RPKDmaFi75RJkvjWaDDb0vesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');}
@font-face{font-family:'Dosis';font-style:normal;font-weight:700;src:local('Dosis Bold'), local('Dosis-Bold'), url(http://fonts.gstatic.com/s/dosis/v4/22aDRG5X9l7obljtz7tihvesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');}

HTML

div {
  font-family:'Dosis';
}

Live version

http://codepen.io/mariomez/pen/YwGGWy

like image 552
justme Avatar asked Dec 24 '15 11:12

justme


People also ask

How do I add a font to Microsoft Edge?

Click the ellipsis (three-dot) button from the top-right. Click Settings on the menu. Click Appearance. Under the Fonts section, click the Customize fonts option.

How do you use font face?

The @font-face rule allows custom fonts to be loaded on a webpage. Once added to a stylesheet, the rule instructs the browser to download the font from where it is hosted, then display it as specified in the CSS.

How do I change my font face?

The font tag is having three attributes called size, color, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the <font> tag. The text that follows will remain changed until you close with the </font> tag.

Is font face deprecated?

<font-face> Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes.


1 Answers

You are using only WOFF2 format which has no support on Microsoft Edge.

WOFF2 Compatibility

To solve the problem include WOFF format in your @font-face declaration. Most of the modern browser supports WOFF

For maximum browser support include all possible format.

@font-face {
    font-family: 'MyWebFont';
    src: url('webfont.eot');
    src: url('webfont.eot?#iefix') format('embedded-opentype'),
       url('webfont.woff2') format('woff2'),
       url('webfont.woff') format('woff'), 
       url('webfont.ttf')  format('truetype'),
       url('webfont.svg#svgFontName') format('svg');
}  
like image 189
Shishir Morshed Avatar answered Sep 21 '22 15:09

Shishir Morshed