Closed bjarneheden closed 11 years ago
I'd rather return early; if the code throws on load, no calls to anything related to Font.js will ever work, which is good ("if it's going to be broken, don't try to use parts of it"). Moving the throws into the constructor rather than keeping them as a load requirement will execute code that is guaranteed to never succeed, wasting time and creating a longer than necessary callstack trace.
I moved the throwing of exceptions for Object.defineProperty and canvas to the Font constructor to make it possible to actually catch the exception/s and act on it (e.g. use fallback solution for older IE).