Google WebFont Loader

The Google WebFont Loader is a JavaScript library that gives you more control over font loading than the Google Fonts API provides.

The following example waits until the fonts have downloaded (unless you're using Firefox) before displaying the text - there is a short delay before the text appears. Refresh to see this.

Some Webfont Text

The following example first displays the text in the default serif font; then after the fonts have loaded it displays the text in the specified webfont. (This code reproduces Firefox's default behavior in all other modern browsers.) This is achieved by applying the webfont only once the webfont loader script has assigned the wf-active class to the DOM. We get FOUT but if we can match our default and web fonts closely, this is unlikely to be an issue, and probably better than a delay before text is displayed (first example).

Some Webfont Text

developers.google.com/fonts/docs/webfont_loader