Skip to content

🎥 Make videos programmatically with React

Update using-fonts.md

Jonny Burgerb78962434a6e
diff --git a/packages/docs/docs/using-fonts.md b/packages/docs/docs/using-fonts.md
index 0781ecddd3..581a7904d1 100644
--- a/packages/docs/docs/using-fonts.md
+++ b/packages/docs/docs/using-fonts.md
@@ -5,9 +5,29 @@ id: fonts
Here are some ways how you can use custom fonts in Remotion.
+## Google Fonts using `@remotion/google-fonts`
+
+_available from v3.2.40_
+
+[`@remotion/google-fonts`](/docs/google-fonts/index.md) is a type-safe way to load Google fonts without having to create CSS files.
+
+```tsx title="MyComp.tsx"
+import { loadFont } from "@remotion/google-fonts/TitanOne";
+
+const { fontFamily } = loadFont();
+
+const GoogleFontsComp: React.FC = () => {
+ return <div style={{ fontFamily }}>Hello, Google Fonts</div>;
+};
+```
+
## Google Fonts using CSS
-Import the CSS that Google Fonts gives you. From version 2.2 on, Remotion will automatically wait until the fonts are loaded.
+Import the CSS that Google Fonts gives you. From version 2.2 on, Remotion will automatically wait until the fonts are loaded
+
+:::note
+This does not work if you use [`lazyComponent`](/docs/composition#lazycomponent).
+:::
```css title="font.css"
@import url("https://fonts.googleapis.com/css2?family=Bangers");
@@ -21,18 +41,6 @@ const MyComp: React.FC = () => {
};
```
-## Google Fonts using `@remotion/google-fonts`
-
-Instead of writing separate CSS files to import Google Fonts, we can use [`@remotion/google-fonts`](./google-fonts/index.md) to easily integrate it in Remotion and get some TypeScript auto-complete feature.
-
-```tsx title="MyComp.tsx"
-import { fontFamily, loadFont } from "@remotion/google-fonts/TitanOne";
-
-const GoogleFontsComp: React.FC = () => {
- return <div style={{ fontFamily: fontFamily }}>Hello, Google Fonts</div>;
-};
-```
-
## Example using local fonts
Put the font into your `public/` folder and use the [`staticFile()`](/docs/staticfile) API to load the font. Use the `FontFace` browser API to load the font. [Click here](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) to read the syntax that can be used for the Font Face API.