Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.