$ cd ..
$ cat ~/writing/til/satori-cannot-read-woff2.md

Satori can't read woff2

next/og renders with Satori, which only understands ttf, otf and woff. My self-hosted woff2 fonts didn't work there.

written
tags
nextjs · fonts · og-images

The site self-hosts its fonts as variable woff2 files. When I added Open Graph images with next/og, those fonts wouldn't load: Satori, the renderer underneath, doesn't decompress woff2.

The fix was a second, small set of static woff files just for the images, read from disk at build time:

const font = (file: string) =>
  readFile(join(process.cwd(), "src/og", file));

Static weights are fine there: an OG image only needs regular and bold.

-- INSERT --