How to download fallback font formats using the FontFace API

When using the FontFace API (not @fontface), is there a convenient way to transfer several different font formats, for example, using multiple sources in @fontface?

Or, conversely, is there a convenient way to check which formats the browser uses the FontFace API, and I can provide the most ideal of several?

+4
source share
1 answer

From what the current CSS Font Loading project says , the FontFace API takes on the same values ​​as the corresponding descriptors @font-face. This means that you can simply pass any return string you use in the definition as the font data source @font-face. How it works with WebKit , anyway:

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

Source: https://habr.com/ru/post/1663326/


All Articles