thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.
http://thinkpixellab.com/pxloader
1.11k stars 173 forks source link

PxFontLoader #11

Open paulirish opened 12 years ago

paulirish commented 12 years ago

Fonts load asynchronously and there is no load event at all. This always bites developers making canvas games that want custom fonts.

(Fwiw, in Mozilla, the window load event waits for fonts, but not in Webkit)

joelfillmore commented 12 years ago

Thanks Paul, this is a great idea!

Font.js looks awesome and should be easy to plug into PxLoader.

I'll try to get the wrapper done in the next day or so.

Studio-Hunto commented 11 years ago

This would be very usefull. Did you look into this Joel?

joelfillmore commented 11 years ago

Yes, I wrote the wrapper but was having problems getting consistent load events. I won't have time to work on it for a few weeks but will try to find the code and put it in a branch in case someone else wants to take a look.

joelfillmore commented 11 years ago

@Studio-Hunto - I've pushed the PxLoaderFont wrapper into the fonts branch: https://github.com/thinkpixellab/PxLoader/tree/fonts

I wasn't able to repro the issues with the load events, but they were only sporadic when I saw them earlier. They seemed to occur more frequently in some browsers and especially when starting from an empty cache. I'd like to spend a little more time with the code before pushing it to master.

If you'd like to play with the code there is a demo in the /tests/fonts directory which shows how to use the plugin. It preloads 4 fonts before using them to draw on a canvas.

Studio-Hunto commented 11 years ago

Thanks Joel, ill try and see if I can help.

2012/7/16 Joel Fillmore < reply@reply.github.com

@Studio-Hunto - I've pushed the PxLoaderFont wrapper into the fonts branch: https://github.com/thinkpixellab/PxLoader/tree/fonts

I wasn't able to repro the issues with the load events, but they were only sporadic when I saw them earlier. They seemed to occur more frequently in some browsers and especially when starting from an empty cache. I'd like to spend a little more time with the code before pushing it to master.

If you'd like to play with the code there is a demo in the /tests/fonts directory which shows how to use the plugin. It preloads 4 fonts before using them to draw on a canvas.


Reply to this email directly or view it on GitHub: https://github.com/thinkpixellab/PxLoader/issues/11#issuecomment-6996443