loadFonts
Loads the fonts satori needs to render text.
This package ships inter-latin-400-normal.ttf / inter-latin-700-normal.ttf under assets/docs-site/fonts; this falls back to any other .ttf/.otf in fontsDirectory and returns null when the directory holds none, so the caller can skip OG generation instead of crashing the build.
Import:
import { loadFonts } from '@mnaoumov/typescript-dev-toolkit/docs-site/og-image';Signature:
function loadFonts(fontsDirectory: string): Promise<Font[] | null>Parameters:
| Parameter | Type | Description |
|---|---|---|
fontsDirectory |
string | The folder holding the fonts. |
Returns: Promise<Font[] | null> — The fonts, or null when the folder holds none.