Skip to content

Could FontLoader error and fileerror events trigger right away? #244

Description

@danzen

It seems that if I have a broken font URL I see an error in the console right away but I am waiting the default 8 seconds for the error event to trigger. I might be wrong - but that seems to be what is happening. I could not get the fileerror event to trigger so this is using the error event. And I am just using a bad url to the font.

Activity

  1. lannymcnie commented on Nov 2, 2017

    @lannymcnie
    Member

    We don't load fonts as files. Instead we create CSS that triggers the font load in the browser, and then poll a canvas to determine when its loaded. Because of this, we do not receive the 404 error that the browser throws up.

    There might be a way to do this by determining the font path, preloading it with XHR (as long as the domain supports CORS), and surfacing the 404 before doing the actual font preload -- but I am not sure how handy that would be, and it could load the font file twice (once in the browser cache and once for the XHR version).

    Open to ideas....

  2. danzen commented on Dec 16, 2017

    @danzen
    ContributorAuthor

    What about a shorter timeout for fonts - so offer a fontTimeout (or whatever) parameter that defaults to 2 seconds as fonts would normally not take as long as images to load. Not sure if that is always the case but probably... Then if there are no traditional assets still loading and the fontTimeout has passed, trigger the error. I suppose we could separate out our font loads and set the default time to shorter, but we would not have to if CreateJS handled it.

  3. lannymcnie commented on Dec 18, 2017

    @lannymcnie
    Member

    Could be a reasonable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions