Google Fonts and Webfontloader

Google Fonts and Webfontloader

by John Vincent

Posted on April 26, 2017

Use Google Webfontloader to load your fonts.

Discussion about Google Fonts and how to best load them.

Google Fonts

Google Fonts Developer Guide provides documentation.

Google Web Fonts Helper

From Google Fonts choose your fonts.

When finished, select family.

Load Fonts


For example:

<link href=",400,600|Roboto:100,300,400,500,700" rel="stylesheet">


For example:

@import url(',400,600|Roboto:100,300,400,500,700');

In practice, this is poor as loading of the fonts will block the loading of the style sheet.


font-family: 'Roboto', sans-serif;
font-family: 'Open Sans', sans-serif;

Google Web Font Loader

Google Web Font Loader provides full documentation.

Google Fonts Web Font Loader

Using the Google Web Font Loader improves the page speed score.

Synchronously Load

For example:

<script src=""></script>
    google: {
      families: ['Roboto:100,300,400,500,700', 'Open Sans:300,400,600']

Asynchronously Load

For example:

WebFontConfig = {
    google: {
        families: ['Roboto:100,300,400,500,700', 'Open Sans:300,400,600']

(function(d) {
    var wf = d.createElement('script'), s = d.scripts[0];
    wf.src = '';
    wf.async = true;
    s.parentNode.insertBefore(wf, s);

This is extremely helpful at improving page speeds. However, there is a price.

Using the Web Font Loader asynchronously avoids blocking your page while loading the JavaScript. Be aware that if the script is used asynchronously, the rest of the page might render before the Web Font Loader is loaded and executed, which can cause a Flash of Unstyled Text (FOUT).

This article discusses techniques for dealing with this.