The Font object has onerror(), not error().

If measure text is called before the font is loaded, it attempts to output an error message, but it calls the non-existant error method instead of calling onerror. This fixes that call.