🎥 Make videos programmatically with React
alright
Jonny Burger312bc10c6d86
diff --git a/packages/compositor-darwin-arm64/remotion b/packages/compositor-darwin-arm64/remotionindex 6067b9a8cc..1ad855df38 100755Binary files a/packages/compositor-darwin-arm64/remotion and b/packages/compositor-darwin-arm64/remotion differdiff --git a/packages/docs/docs/fonts/index.md b/packages/docs/docs/fonts/index.mddeleted file mode 100644index 41323e90b5..0000000000--- a/packages/docs/docs/fonts/index.md+++ /dev/null@@ -1,66 +0,0 @@-----image: /generated/articles-docs-fonts-index.png-id: fonts-sidebar_label: Overview-title: "@remotion/fonts"-----import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';---The `@remotion/fonts` package provides APIs for easily load local fonts into Remotion.--## Installation--<Tabs-defaultValue="npm"-values={[-{ label: 'npm', value: 'npm', },-{ label: 'yarn', value: 'yarn', },-{ label: 'pnpm', value: 'pnpm', },-]-}>-<TabItem value="npm">--```bash-npm i @remotion/fonts-```-- </TabItem>-- <TabItem value="yarn">--```bash-yarn add @remotion/fonts-```-- </TabItem>-- <TabItem value="pnpm">--```bash-pnpm i @remotion/fonts-```-- </TabItem>-</Tabs>--## Usage--Put the font into your `public/` folder.-To load a font, import the package `@remotion/fonts` and call [`loadFont()`](/docs/fonts/load-font).--```tsx twoslash-import { loadFont } from "@remotion/fonts/";-loadFont({- family: 'some name',- url: 'someName',- weight: '500',- // ... other options-}).then(() => console.log('Font loaded!'))-```--:::note-Check the available options [around the URL](/docs/fonts/load-font).-The font format should be one of `woff2` for WOFF2 files, `woff` for WOFF, `opentype` for OTF, `truetype` for TTF.-:::diff --git a/packages/docs/docs/fonts/index.mdx b/packages/docs/docs/fonts/index.mdxnew file mode 100644index 0000000000..cb72bb9ef6--- /dev/null+++ b/packages/docs/docs/fonts/index.mdx@@ -0,0 +1,30 @@+---+image: /generated/articles-docs-fonts-index.png+id: fonts+sidebar_label: Overview+title: "@remotion/fonts"+---++import Tabs from "@theme/Tabs";+import TabItem from "@theme/TabItem";++The `@remotion/fonts` package provides an API for [loading local fonts](/docs/fonts) into a Remotion component.++## Installation++<Installation pkg="@remotion/fonts" />++## Example Usage++Put the font into your `public/` folder.+To load a font, import the package `@remotion/fonts` and call [`loadFont()`](/docs/fonts/load-font).++```tsx twoslash+import { loadFont } from "@remotion/fonts/";+loadFont({+ family: "some name",+ url: "someName",+ weight: "500",+ // ... other options+}).then(() => console.log("Font loaded!"));+```diff --git a/packages/docs/docs/fonts/load-font.md b/packages/docs/docs/fonts/load-font.mdxsimilarity index 65%rename from packages/docs/docs/fonts/load-font.mdrename to packages/docs/docs/fonts/load-font.mdxindex e0737d485d..41c7ec8faa 100644--- a/packages/docs/docs/fonts/load-font.md+++ b/packages/docs/docs/fonts/load-font.mdx@@ -6,29 +6,25 @@ crumb: "@remotion/fonts"_Part of the [`@remotion/fonts`](/docs/fonts) package_-Load a local font for use in Remotion.--- Automatically blocks the render until the font is ready.-- Each `loadFont()` call is typesafe and available options are exposed through autocompletion.+Load a local font for use in Remotion.+Automatically blocks the render until the font is ready.## Usage```tsx twoslashimport { loadFont } from "@remotion/fonts";-import { AbsoluteFill } from "remotion";+import { AbsoluteFill, staticFile } from "remotion";loadFont({- family: 'Bangers',- url: 'bangers.ttf',- weight: '500'- // ... other options-}).then(() => console.log('Font loaded!'));+ family: "Bangers",+ url: staticFile("bangers.ttf"),+}).then(() => console.log("Font loaded!"));export const GoogleFontsExample: React.FC = () => {return (<AbsoluteFillstyle={{- fontFamily: 'Bangers',+ fontFamily: "Bangers",}}><h1>Local Font</h1>@@ -36,42 +32,51 @@ export const GoogleFontsExample: React.FC = () => {);};```-## Arguments++## Options++### family++The name of the font family.++### url++Where to load the font from.All arguments and options are optional. Use TypeScript autocompletion.-### ascentOverride+### ascentOverride?Defines the ascent metric for the font.-### descentOverride+### descentOverride?Defines the descent metric for the font.-### display+### display?Determines how a font face is displayed based on whether and when it is downloaded and ready to use.-### featureSettings+### featureSettings?Allows control over advanced typographic features in OpenType fonts.-### lineGapOverride+### lineGapOverride?Defines the line gap metric for the font.-### stretch+### stretch?Allows to specify a normal, condensed, or expanded face.-### style+### style?The font style we want to load. While each font has a different set of styles, common options are: `normal`, `italic` etc.-### unicodeRange+### unicodeRange?The range of Unicode code points to be used from the font.-### weight+### weight?-Sets the weight (or boldness) of the font. The weights available depend on the font-family that is currently set.\ No newline at end of file+Sets the weight (or boldness) of the font. The weights available depend on the font-family that is currently set.diff --git a/packages/fonts/src/get-font-format.ts b/packages/fonts/src/get-font-format.tsindex 4b2377c2b0..9f8f62f86c 100644--- a/packages/fonts/src/get-font-format.ts+++ b/packages/fonts/src/get-font-format.ts@@ -1,4 +1,6 @@-export const getFontFormat = (url: string): string => {+type FontFormat = 'woff2' | 'woff' | 'opentype' | 'truetype';++export const getFontFormat = (url: string): FontFormat => {const ext = url.split('.').pop()?.toLowerCase();switch (ext) {case 'woff2':diff --git a/packages/fonts/src/load-font.ts b/packages/fonts/src/load-font.tsindex ab7a0c5a64..bcbe7b2423 100644--- a/packages/fonts/src/load-font.ts+++ b/packages/fonts/src/load-font.ts@@ -1,10 +1,20 @@import {cancelRender, continueRender, delayRender, staticFile} from 'remotion';import {getFontFormat} from './get-font-format';-interface LoadFontOptions extends FontFaceDescriptors {+type LoadFontOptions = {family: string;url: string;-}+ ascentOverride?: string;+ descentOverride?: string;+ display?: 'auto' | 'block' | 'fallback' | 'optional' | 'swap';+ featureSettings?: string;+ lineGapOverride?: string;+ stretch?: string;+ style?: string;+ unicodeRange?: string;+ variant?: string;+ weight?: string;+};export const loadFont = async ({family,