|
@@ -5,19 +5,20 @@ import { join } from "node:path";
|
|
|
export { getPageTitle } from "@/lib/page-titles";
|
|
export { getPageTitle } from "@/lib/page-titles";
|
|
|
|
|
|
|
|
// Cache font data in memory after first load
|
|
// Cache font data in memory after first load
|
|
|
-let fontCache: { geistRegular: Buffer } | null = null;
|
|
|
|
|
|
|
+let fontCache: { geistRegular: Buffer; geistPixelSquare: Buffer } | null = null;
|
|
|
|
|
|
|
|
async function loadFonts() {
|
|
async function loadFonts() {
|
|
|
if (fontCache) return fontCache;
|
|
if (fontCache) return fontCache;
|
|
|
- const geistRegular = await readFile(
|
|
|
|
|
- join(process.cwd(), "public/Geist-Regular.ttf"),
|
|
|
|
|
- );
|
|
|
|
|
- fontCache = { geistRegular };
|
|
|
|
|
|
|
+ const [geistRegular, geistPixelSquare] = await Promise.all([
|
|
|
|
|
+ readFile(join(process.cwd(), "public/Geist-Regular.ttf")),
|
|
|
|
|
+ readFile(join(process.cwd(), "public/GeistPixel-Square.ttf")),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ fontCache = { geistRegular, geistPixelSquare };
|
|
|
return fontCache;
|
|
return fontCache;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export async function renderOgImage(title: string) {
|
|
export async function renderOgImage(title: string) {
|
|
|
- const { geistRegular } = await loadFonts();
|
|
|
|
|
|
|
+ const { geistRegular, geistPixelSquare } = await loadFonts();
|
|
|
|
|
|
|
|
return new ImageResponse(
|
|
return new ImageResponse(
|
|
|
<div
|
|
<div
|
|
@@ -53,8 +54,8 @@ export async function renderOgImage(title: string) {
|
|
|
<span
|
|
<span
|
|
|
style={{
|
|
style={{
|
|
|
fontSize: 36,
|
|
fontSize: 36,
|
|
|
- fontFamily: "Geist",
|
|
|
|
|
- fontWeight: 400,
|
|
|
|
|
|
|
+ fontFamily: "Geist Pixel Square",
|
|
|
|
|
+ fontWeight: 500,
|
|
|
color: "white",
|
|
color: "white",
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
@@ -99,6 +100,12 @@ export async function renderOgImage(title: string) {
|
|
|
style: "normal",
|
|
style: "normal",
|
|
|
weight: 400,
|
|
weight: 400,
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "Geist Pixel Square",
|
|
|
|
|
+ data: geistPixelSquare.buffer as ArrayBuffer,
|
|
|
|
|
+ style: "normal",
|
|
|
|
|
+ weight: 500,
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|