Skip to content

Calling FontLoader multiple times #20

@DangerD256

Description

@DangerD256

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);
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions