Skip to content

Instantly share code, notes, and snippets.

@victory-sokolov
Created March 16, 2022 10:20
Show Gist options
  • Save victory-sokolov/fd17c5068e145ec68d61d97be5fef2dd to your computer and use it in GitHub Desktop.
Save victory-sokolov/fd17c5068e145ec68d61d97be5fef2dd to your computer and use it in GitHub Desktop.
Dynamically load font
var junction_font = new FontFace('Junction Regular', 'url(fonts/junction-regular.woff)');
junction_font.load().then(function(loaded_face) {
document.fonts.add(loaded_face);
document.body.style.fontFamily = '"Junction Regular", Arial';
}).catch(function(error) {
// error occurred
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment