kinetograph.

Fonts

Register a font from Google Fonts, a file in public/, a stylesheet or CSS @font-face, and use it in text.

Text uses only the fonts you register. Kinetograph reads no system fonts, so a render looks the same on every machine.

src/Title.tsx
import { Text } from '@kinetographdev/core';
import { loadFont } from '@remotion/google-fonts/Inter';

const { fontFamily } = loadFont('normal', { weights: ['400', '700'] });

export const Title = () => (
  <Text font={fontFamily} weight={700} size={96} color="#ffffff">
    Hello
  </Text>
);
Four lines set in registered fonts: DM Sans in three weights, Playfair Display italic, JetBrains Mono and Rock Salt.

Call loadFont at the top of the file, outside any component.

Google Fonts

Import the family you want from @remotion/google-fonts/<Family>. The first render downloads each file and keeps it in ~/.cache/kinetograph/fonts, so later renders need no network.

A font file in your project

Put the file in public/fonts/ and register it under a family name:

src/fonts.ts
import { loadFont } from '@remotion/fonts';
import { staticFile } from '@kinetographdev/core';

loadFont({ family: 'Brand', url: staticFile('fonts/Brand-Bold.ttf'), weight: '700' });
loadFont({ family: 'Brand', url: staticFile('fonts/Brand-Italic.ttf'), style: 'italic' });

Then write <Text font="Brand" weight={700}>. The file can be TrueType, OpenType, WOFF or WOFF2.

A stylesheet or CSS

For fonts hosted elsewhere, makeWebFont from @kinetographdev/core/fonts takes the URL of a stylesheet of @font-face rules. In HTML or an imported stylesheet, @font-face works as in a browser, with the url() looked for beside the entry file, then in public/.

HTML pages and JSON scenes

  • An HTML page names a family in CSS. The families HyperFrames embeds are built in, and any other font comes from @font-face with a file.
  • In a .json scene, the fonts object maps a family name to a file. See the scene format.

Rules

  • Register before measuring. Text is never measured before its fonts are registered.
  • No system fonts. With no font loaded, text is drawn in the bundled DM Sans, and lint reports a Text whose font is not registered.
  • Missing characters. CJK, Arabic, Devanagari and similar scripts have no bundled font, so load one that has them. Emoji are monochrome.

What works

  • Drawn natively: Google Fonts, font files, @font-face, FontFace, variable fonts and -webkit-text-stroke, text-shadow and background-clip: text.
  • Approximated: monospace and ex can differ from Chrome, and a variable font set per element with font-variation-settings can measure wider. Emoji are monochrome.
  • Not supported: system fonts, and getAvailableFonts() from @remotion/google-fonts.
  • doctor lists a character no font has, and a font that did not download (under stylesheets). Run npx kinetograph doctor <entry> before a long render, and see What works.

On this page