packages/docs/docs/fonts-api/load-font.mdx
Part of the @remotion/fonts package
Load a local font for use in Remotion.
Automatically blocks the render until the font is ready.
import { loadFont } from "@remotion/fonts";
import { AbsoluteFill, staticFile } from "remotion";
loadFont({
family: "Bangers",
url: staticFile("bangers.ttf"),
}).then(() => console.log("Font loaded!"));
export const GoogleFontsExample: React.FC = () => {
return (
<AbsoluteFill
style={{
fontFamily: "Bangers",
}}
>
<h1>Local Font</h1>
</AbsoluteFill>
);
};
Give the family a name.
You can then reference that name in your CSS using fontFamily.
Where to load the font from. Can be a local file using staticFile() or a URL.
Defines the format of the font file. By default gets derived from the file extension of the URL.
Override with one of the following values explicitly: woff2, woff, opentype, truetype.
Defines the ascent metric for the font.
Defines the descent metric for the font.
Equivalent to the CSS font-display property.
Determines how a font face is displayed based on whether and when it is downloaded and ready to use.
Equivalent to the CSS font-feature-settings property.
Allows control over advanced typographic features in OpenType fonts.
Defines the line gap metric for the font.
Equivalent to the CSS font-stretch property.
Specify what kind of stretch the loaded font has.
Equivalent to the CSS font-style property.
Specify what kind of style the loaded font has.
Equivalent to the CSS font-weight property.
Specify what kind of weight the loaded font has.
The range of Unicode code points to be used from the font.