jacobabrennan / Project-Fennel

http://antlerpig.com
4 stars 2 forks source link

Fonts don't Load in time #41

Closed jacobabrennan closed 11 years ago

jacobabrennan commented 11 years ago

Problem: The first time using a custom font to draw on a canvas results in a default font being used. How it should work: Fonts should be preloaded and ready for use.

The cause is how fonts are loaded. Custom fonts are not retrieved until something uses them. This means that my canvas tries to draw, calls for the font, while that is loading asynchronously it draws on the canvas using whatever font is on hand, then the font loads later and is available for future use.

jacobabrennan commented 11 years ago

That was a quick fix. While loading resources, I create a canvas, append it to document.body, and draw on it once for each font. Then I remove it from the body, and all fonts are requested.