// Define a FontFace
const font = new FontFace("my-font", 'url("my-font.woff")', {
style: "italic",
weight: "400",
});
font.stretch = "condensed";FontFace / notebook
FontFace
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
// Load the font
font.load().then(
() => {
// Resolved - add font to document.fonts
},
(err) => {
console.error(err);
},
);