Skip to content

🎥 Make videos programmatically with React

docs: reduce redundant font best-practice wording

Cursor Agent6aa646cd05a1
diff --git a/packages/docs/docs/fonts.mdx b/packages/docs/docs/fonts.mdx
index e1eea3bd3c..7e3590d580 100644
--- a/packages/docs/docs/fonts.mdx
+++ b/packages/docs/docs/fonts.mdx
@@ -27,9 +27,7 @@ const GoogleFontsComp: React.FC = () => {
};
```
-For projects with multiple fonts, load fonts in one shared module and wait until they are ready before rendering.
-
-If you use text measurement APIs, see the [higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component).
+For projects with multiple fonts, load fonts in one shared module and wait until they are ready before rendering. If you use text measurement APIs, see the [higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component).
## Google Fonts using CSS
diff --git a/packages/docs/docs/google-fonts/index.mdx b/packages/docs/docs/google-fonts/index.mdx
index 75c285293a..13eee0ade7 100644
--- a/packages/docs/docs/google-fonts/index.mdx
+++ b/packages/docs/docs/google-fonts/index.mdx
@@ -77,26 +77,19 @@ 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.
-You can pass a style (such as `normal`, `italic`) to only load that style. If you want multiple styles, call `loadFont()` multiple times.
+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.
-```tsx twoslash title="Load just one style"
-import {loadFont} from '@remotion/google-fonts/TitanOne';
-
-loadFont('normal', {
- weights: ['400'],
- subsets: ['latin'],
-});
-```
-
-Use the TypeScript autocomplete to see the available styles. To further narrow down what's being loaded, you can specify `weights` and `subsets`. These options are also typesafe.
-
-```tsx twoslash title="Load a specific style with limited weights and subsets"
+```tsx twoslash title="Load multiple styles explicitly"
import * as Montserrat from '@remotion/google-fonts/Montserrat';
Montserrat.loadFont('normal', {
weights: ['400', '700'],
subsets: ['latin'],
});
+Montserrat.loadFont('italic', {
+ weights: ['400'],
+ subsets: ['latin'],
+});
```
[`loadFont()`](/docs/google-fonts/load-font) returns an object with a `fontFamily` property. You can use the `style` attribute to render text in the font you loaded.
@@ -143,10 +136,7 @@ export const waitForFonts = async () => {
};
```
-If you use text measurement APIs, wrap your content in a component that waits for your fonts before rendering:
-
-- [Higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component)
-- [Troubleshooting font loading errors](/docs/troubleshooting/font-loading-errors)
+If you use text measurement APIs, wrap your content in a component that waits for your fonts before rendering. See the [higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component) and [font loading troubleshooting](/docs/troubleshooting/font-loading-errors).
To get information about a font, you can import the `getInfo()` function:
diff --git a/packages/docs/docs/google-fonts/load-font.mdx b/packages/docs/docs/google-fonts/load-font.mdx
index a1d9d47334..37ac13fd9f 100644
--- a/packages/docs/docs/google-fonts/load-font.mdx
+++ b/packages/docs/docs/google-fonts/load-font.mdx
@@ -81,10 +81,7 @@ export const GoogleFontsExample: React.FC = () => {
};
```
-If your project uses multiple fonts, load them in one module and export a `waitForFonts()` helper. If you measure text, gate rendering until the fonts are loaded using a higher-order component:
-
-- [Higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component)
-- [Troubleshooting font loading errors](/docs/troubleshooting/font-loading-errors)
+If your project uses multiple fonts, load them in one module and export a `waitForFonts()` helper. If you measure text, see the [higher-order component example](/docs/layout-utils/best-practices#example-with-high-order-component) and [font loading troubleshooting](/docs/troubleshooting/font-loading-errors).
## Arguments