FontLoader
FontLoader copied to clipboard
Calling FontLoader multiple times
Need to load fonts by ajax call, first time function works well, second and next times function returns success instantly.
jQuery.ajax({
type: "POST",
url: ajax_url,
data: 'act=getFont&name='+font,
success: function(data)
{
var fontLoader = new FontLoader([font], {
"fontLoaded": function(font) {
},
"complete": function(error) {
if (error !== null) {
} else {
// All fonts were loaded
console.log('loaded!! ->'+font);
loader(0);
canvas.getActiveObject().setFontFamily(font);
canvas.renderAll();
},1000);
}
}
}, 3000);
fontLoader.loadFonts();
jQuery('body').append(data);
}
});