Skip to main content

loadVariableFontFromInfo()v4.0.525

Loads a variable Google Font from metadata obtained using getInfo().

Because the metadata is pure JSON, it can be loaded from a server without including the generated font module in the client bundle.

Usage​

Load a variable font from metadata
import {getInfo} from '@remotion/google-fonts/NotoSans'; import {loadVariableFontFromInfo} from '@remotion/google-fonts/from-info'; const info = getInfo(); const {axes, fontFamily, waitUntilDone} = loadVariableFontFromInfo( info, 'normal', { subsets: ['latin'], }, ); console.log(fontFamily, axes.wght); waitUntilDone();

Arguments​

info​

Font metadata returned by getInfo(). The font must include variable font information.

style​

The variable font style to load, such as normal or italic.

options​

subsets​

The character subsets to load. At least one subset is required.

document?​

The document into which the font should be added. By default, the global window.document is used.

ignoreTooManyRequestsWarning?​

Set this to true to disable the warning emitted when loading more than 20 subset files.

Return value​

The return value is the same as loadVariableFont().

Compatibility​

BrowsersEnvironments
Chrome
Firefox
Safari

See also​