Skip to content

πŸŽ₯ Make videos programmatically with React

Docs: document v5 loadFont weights and subsets requirement (#10017)

Santhi Prakash9c6227c99c57
diff --git a/packages/docs/docs/google-fonts/index.mdx b/packages/docs/docs/google-fonts/index.mdx
index 498cd8e931..f4b502e46b 100644
--- a/packages/docs/docs/google-fonts/index.mdx
+++ b/packages/docs/docs/google-fonts/index.mdx
@@ -75,7 +75,7 @@ Montserrat.loadFont('normal', {
});
```
-Call [`loadFont()`](/docs/google-fonts/load-font) to start the loading process. Calling it without arguments loads every style, weight and subset, which can cause unnecessary requests.
+Call [`loadFont()`](/docs/google-fonts/load-font) to start the loading process. In Remotion 4.0, calling it without arguments loads every style, weight and subset, which can cause unnecessary requests. From [v5.0](/docs/5-0-migration), `weights` and `subsets` are required.
Use TypeScript autocomplete to see the available styles. To further narrow down what's being loaded, specify `weights` and `subsets`. If you need multiple styles, call `loadFont()` multiple times.
diff --git a/packages/docs/docs/google-fonts/load-font.mdx b/packages/docs/docs/google-fonts/load-font.mdx
index 37ac13fd9f..8faca6ee29 100644
--- a/packages/docs/docs/google-fonts/load-font.mdx
+++ b/packages/docs/docs/google-fonts/load-font.mdx
@@ -41,7 +41,9 @@ export const GoogleFontsExample: React.FC = () => {
Pass a specific style (e.g. `normal`, `italic`) and optionally weights and subsets to narrow down what gets loaded.
:::warning
-Calling `loadFont()` without arguments loads all styles, weights and character subsets of a font. This can trigger a lot of network requests and may lead to warnings or timeouts.
+In Remotion 4.0, calling `loadFont()` without arguments loads all styles, weights and character subsets of a font. This can trigger a lot of network requests and may lead to warnings or timeouts.
+
+From [v5.0](/docs/5-0-migration), you must pass non-empty `weights` and `subsets` arrays in the `options` argument. Otherwise `loadFont()` throws.
:::
:::info
@@ -85,7 +87,11 @@ If your project uses multiple fonts, load them in one module and export a `waitF
## Arguments
-All arguments and options are optional. Use TypeScript autocompletion or [`getInfo`](/docs/google-fonts/get-info) to discover available options. If no arguments are passed, all styles, weights and subsets are loaded.
+Use TypeScript autocompletion or [`getInfo`](/docs/google-fonts/get-info) to discover available options.
+
+The `style` argument is optional. In Remotion 4.0, if no arguments are passed, all styles, weights and subsets are loaded.
+
+From [v5.0](/docs/5-0-migration), `options.weights` and `options.subsets` are required and must be non-empty arrays.
### style
@@ -95,11 +101,11 @@ The font style we want to load. While each font has a different set of styles, c
#### weights?
-Array of weights that should be loaded. By default, all.
+Array of weights that should be loaded. Optional in v4.x. Required from v5.0.
#### subsets?
-Array of font subsets that should be loaded. By default, all.
+Array of font subsets that should be loaded. Optional in v4.x. Required from v5.0.
#### document?
diff --git a/packages/docs/docs/troubleshooting/font-loading-errors.mdx b/packages/docs/docs/troubleshooting/font-loading-errors.mdx
index befcac8a75..7a77c68ad5 100644
--- a/packages/docs/docs/troubleshooting/font-loading-errors.mdx
+++ b/packages/docs/docs/troubleshooting/font-loading-errors.mdx
@@ -16,7 +16,7 @@ When using `@remotion/google-fonts`, you may encounter timeout errors like:
### Problem
-By default, `loadFont()` attempts to load all available font weights and character subsets, which can cause timeouts.
+In Remotion 4.0, calling `loadFont()` without arguments loads all available font weights and character subsets, which can cause timeouts. From [v5.0](/docs/5-0-migration), you must pass non-empty `weights` and `subsets` arrays β€” otherwise `loadFont()` throws.
### Solution