Can't load font on node using webfontloader custom module

464 views Asked by At

I'm trying to load a font on node using webfontloader custom module like this:

WebFont.load({                              
    custom: {
            families: ['Arial Bold'],   
            urls: ['http://localhost:60838/fonts.css']                                          
    },
    active: function() {                                                    
        resolve();
    },
    inactive: function() {
        console.error('WebFont failed to load the font');
    }
});

This is my fonts.css file:

@font-face { font-family: "Arial Bold"; 
  src: url("Content/fonts/admin/Arial Bold.ttf") format("truetype"); 
} 

I've tried using both absolute and relative paths on the fonts.css src field and webfontloader's custom.url but I can't make it work, it always goes to inactive(). I can't find a real working example of webfontloader loading fonts where I can verify the paths and formats, I've tried debugging webfontloader.js as well but as I couldn't find a non minifed version it's very hard to understand what's happening.

Any idea how can I solve this?

0

There are 0 answers