Shoora
4/22/2019 - 1:26 AM

google-font-fallback

google-font-fallback

WebFontConfig = {google: {families: []}};

(function(d, fonts) {
    WebFontConfig.google.families = fonts.map(function(font) {return font + '::latin'});

    var wf = d.createElement('script');
    wf.src = '//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.async = 'true';

    wf.onerror = function() {
        var link;

        fonts.forEach(function(font) {
            link = d.createElement('link');
            link.rel = 'stylesheet';
            link.href = '/fonts/' + font + '/font.css';

            d.head.appendChild(link);
        });
    };

    var s = d.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
})(document, ['Roboto', 'Lobster', 'Crushed']);