Remotion Rule: Fonts
Remotion skill rule: Loading Google Fonts and local fonts in Remotion. Part of the official Remotion Agent Skill for programmatic video in React.
What it is
This Remotion skill rule covers loading Google Fonts and local fonts in Remotion projects. Remotion renders video frames as React components, which means font loading follows web patterns but with video-specific constraints. Fonts must be fully loaded before any frame renders, or you get fallback text in your output video.
This rule is part of the official Remotion Agent Skill set. It provides AI agents and developers with the correct patterns for font usage in programmatic video production, avoiding the common mistake of rendering frames before fonts are available.
Why it saves time or tokens
Font loading bugs in Remotion produce videos with system fallback fonts on random frames. Debugging which frames failed is time-consuming because the issue is non-deterministic. This skill rule gives a deterministic pattern that works on the first render. When an AI agent generates a Remotion composition, following this rule eliminates font-related re-renders.
How to use
- Choose between Google Fonts (remote) or local font files bundled in your project
- Use the
@remotion/google-fontspackage for Google Fonts orstaticFile()for local fonts - Ensure fonts are loaded at the composition level before any component renders text
Example
// Google Fonts approach
import { loadFont } from '@remotion/google-fonts/Inter';
const { fontFamily } = loadFont();
const MyTitle = () => (
<h1 style={{ fontFamily }}>Hello World</h1>
);
// Local font approach
import { staticFile } from 'remotion';
const localFont = new FontFace(
'CustomFont',
`url(${staticFile('fonts/custom.woff2')})`
);
await localFont.load();
document.fonts.add(localFont);
| Method | When to Use |
|---|---|
| @remotion/google-fonts | Standard fonts, no custom branding |
| staticFile + FontFace | Custom brand fonts, offline rendering |
| System fonts | Quick prototyping only |
Related on TokRepo
- AI tools for video — video production tools and skills on TokRepo
- AI tools for design — design tools for visual content creation
Common pitfalls
- Importing Google Fonts via CSS
@importin Remotion causes race conditions; always use the@remotion/google-fontspackage - Local font files must be in the
public/directory and loaded viastaticFile(); relative paths break during rendering - Not awaiting font load before render causes random frames to use fallback fonts, producing inconsistent video output
Frequently Asked Questions
CSS @import loads fonts asynchronously, and Remotion renders frames on a tight schedule. If a frame renders before the font finishes downloading, it uses the fallback font. The @remotion/google-fonts package ensures the font is loaded synchronously before any frame renders, preventing this race condition.
Place your font file (woff2 preferred for size) in the public/ directory. Use staticFile() to get the URL, create a FontFace object, call load() on it, and add it to document.fonts. Do this at the composition level so all frames have access to the loaded font.
Yes. Both Google variable fonts and local variable font files work in Remotion. Load them the same way as regular fonts. You can then use CSS font-variation-settings or font-weight with numeric values to access different weights and styles from a single font file.
If a font fails to load, Remotion renders text with the browser default fallback font, usually Times New Roman or a system sans-serif. This produces visible inconsistency in your video. Always handle font load errors and provide a fallback font-family in your CSS to maintain visual consistency.
Yes. Load each font independently using loadFont() for Google Fonts or FontFace for local fonts. Assign different fontFamily values to different text components. All fonts must be loaded before rendering starts, so call all loadFont() functions at the composition root level.
Citations (3)
- Remotion GitHub— Remotion renders video as React components
- Remotion Docs— @remotion/google-fonts package for synchronous font loading
- MDN Web Docs— FontFace API for loading custom fonts in web contexts
Related on TokRepo
Source & Thanks
Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule:
fonts
Part of the Remotion AI Skill collection on TokRepo.
Discussion
Related Assets
/babysit — Auto-Respond to PR Review Comments
Open-source slash command that watches a PR for review comments and auto-pushes fixes. Inspired by Boris Cherny's /babysit pattern.
/loop — Local Recurring Task Scheduler (Boris-Style)
Open-source slash command for recurring local Claude Code tasks with a 3-day safety cap. Inspired by Boris Cherny's /loop scheduler.
/batch — Parallel Worktree Migration Slash Command
Open-source slash command that splits a migration across parallel git worktrees. Inspired by Boris Cherny's /batch worktree pattern.