Skip to content

Load webfont using native FontFace with fall back to font-face-observer

Notifications You must be signed in to change notification settings

cymen/webfont-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webfont-loader npm version

Load webfont using native FontFace with fall back to font-face-observer (see web font loading detection, without timers for details on how the fallback works).

Assumptions:

  • have font in WOFF format
  • font src is a HTTP or HTTPS URL

Example

var webFontLoader = require('webfont-loader');

webFontLoader('My Font Family', {src: ['http://some.cdn.example.com/my_font.woff']}).then(
  function fontLoaded() {
    // ...
  },
  function fontFailedToLoad() {
    // ...
  }
);

About

Load webfont using native FontFace with fall back to font-face-observer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published