typekit/webfontloader — pull request #66 by bramstein (2012-11-13 15:18:53+00:00)
Title: Improve font watching

This pull requests aims to improve the accuracy of the `active` and `inactive` events on Webkit versions that are affected by the following bug:

https://bugs.webkit.org/show_bug.cgi?id=76684

The following changes are made:

* Font metrics are now compared on both width and height. This is to reduce the chance of almost metrics compatible fonts being considered identical and thus failing detection.
* The Webkit bug is detected using a null-webfont, and if it is present the detection code ignores the first change in font metrics and only fires the `active` event when another metrics change is detected.
* If a timeout occurs and the Webkit bug is present we now assume that the font loaded but has identical metrics to the browser's last resort font. This might result in false `active` events in the rare case where the last resort font is metrics compatible with the webfont being loaded.
* Test cases are added to emulate the broken Webkit behaviour.

All tests are passing and the code compiles without errors or warnings.