Skip to content Skip to sidebar Skip to footer

How To Load Fallback Font Formats With Fontface Api

When using the FontFace API (not @fontface) is there a convenient way to pass multiple different font formats, like with providing multiple sources in @fontface? Or alternatively,

Solution 1:

From what the current draft of the CSS Font Loading spec says, the FontFace API takes the same values as the corresponding @font-face descriptors. It means you can simply pass as the font data source whatever fallback string you’d use in your @font-face definition. It’s how WebKit handles it, anyway:

let fontFace = new FontFace("MyWebFont", "url('MyWebFont.woff2') format('woff2'), url('MyWebFont.woff') format('woff')");

Post a Comment for "How To Load Fallback Font Formats With Fontface Api"