custom @font-face does not load in chrome (chrome

2019-06-20 15:08发布

问题:

custom @font-face does not load in chrome(chrome custom fonts not rendering) Using custom fonts using CSS

@font-face {
    font-family:'gotham-rounded-medium';
    src:url('fonts/gothumrounded_medium/gotham-rounded-medium.eot');
    src:url('fonts/gothumrounded_medium/gotham-rounded-medium.eot?#iefix')format("embedded-opentype"),
        url('fonts/gothumrounded_medium/gotham-rounded-medium.woff')format("woff"),
        url('fonts/gothumrounded_medium/gotham-rounded-medium.ttf')format("truetype"),
        url('fonts/gothumrounded_medium/gotham-rounded-medium.svg')format("svg");
    font-weight:400;
    font-style:normal
}

.custom_font{
   font-family:'gotham-rounded-medium', arial, sans-serif;
}

The texts are showing only when you resize the screen window.

So please is there something that it can be done to solve this issue?

回答1:

In my case the problem was connected with multiple inclusion of the same @font-face made by different Angular 2 modules. Please see:

https://bugs.chromium.org/p/chromium/issues/detail?id=582198#c20



回答2:

Looks like this is getting fixed in Chrome 59 if it is the same bug as listed here: https://bugs.chromium.org/p/chromium/issues/detail?id=602968

Also - it's probably a better practice to only include font-face declarations once. We solved the issue by refactoring our CSS architecture and only including font-faces once.