Skip to content

Instantly share code, notes, and snippets.

@Nooshu
Created February 23, 2020 03:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nooshu/bca22676f3491f548c297774c537b865 to your computer and use it in GitHub Desktop.
Save Nooshu/bca22676f3491f548c297774c537b865 to your computer and use it in GitHub Desktop.
Simple sample script to test the font load modificaion technique
// Test Page: https://keen-northcutt-3190bd.netlify.com/standard-load.html
// Paste below into the WPT Inject Script textarea.
(function(){
var montserratBold = new FontFace('montserratbold_italic', 'url(fonts/montserrat-bolditalic-webfont.woff2)', {
display: 'swap', // test the page using 'swap'
weight: '700'
});
document.fonts.add(montserratBold);
// Wait for the fonts to become ready (optional)
document.fonts.ready.then(function() {
for (var allowed of document.fonts) console.dir(allowed);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment