diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b94db01..6ae64bd 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -18,6 +18,7 @@ "@codemirror/language": "^6.10.0", "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.35.0", + "@fontsource/inter": "^5.2.8", "@iconify-json/lucide": "^1.2.90", "@lezer/highlight": "^1.2.0", "@lezer/lr": "^1.4.0", @@ -1706,6 +1707,15 @@ "node": ">=18" } }, + "node_modules/@fontsource/inter": { + "version": "5.2.8", + "resolved": "https://registry.npmjs.org/@fontsource/inter/-/inter-5.2.8.tgz", + "integrity": "sha512-P6r5WnJoKiNVV+zvW2xM13gNdFhAEpQ9dQJHt3naLvfg+LkF2ldgSLiF4T41lf1SQCM9QmkqPTn4TH568IRagg==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, "node_modules/@iconify-json/lucide": { "version": "1.2.90", "resolved": "https://registry.npmjs.org/@iconify-json/lucide/-/lucide-1.2.90.tgz", diff --git a/frontend/package.json b/frontend/package.json index 7d723d3..e5b56a9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,6 +19,7 @@ "@codemirror/language": "^6.10.0", "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.35.0", + "@fontsource/inter": "^5.2.8", "@iconify-json/lucide": "^1.2.90", "@lezer/highlight": "^1.2.0", "@lezer/lr": "^1.4.0", diff --git a/frontend/public/fonts/Inter-SemiBold.ttf b/frontend/public/fonts/Inter-SemiBold.ttf deleted file mode 100644 index 0cb8fd6..0000000 --- a/frontend/public/fonts/Inter-SemiBold.ttf +++ /dev/null @@ -1,1451 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Page not found · GitHub · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
- Skip to content - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - -
- - - - - - - - - -
-
- - - -
-
- -
-
- 404 “This is not the web page you are looking for” - - - - - - - - - - - - -
-
- -
-
- -
- - -
-
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - diff --git a/frontend/src/lib/og-renderer.tsx b/frontend/src/lib/og-renderer.tsx index cb205ad..06ab31f 100644 --- a/frontend/src/lib/og-renderer.tsx +++ b/frontend/src/lib/og-renderer.tsx @@ -10,22 +10,21 @@ interface OgImageProps { } function loadFont(): ArrayBuffer { - // In prod: dist/client/fonts/ In dev: public/fonts/ - const candidates = [ - join(process.cwd(), 'dist', 'client', 'fonts', 'Inter-SemiBold.ttf'), - join(process.cwd(), 'public', 'fonts', 'Inter-SemiBold.ttf'), - ]; - for (const path of candidates) { - try { - const buf = readFileSync(path); - // Node.js Buffers share a pooled ArrayBuffer — slice to get a - // standalone copy so Satori's OpenType parser starts at byte 0. - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); - } catch { - // try next - } - } - throw new Error('Inter-SemiBold.ttf not found'); + // Load Inter SemiBold (weight 600) from @fontsource/inter in node_modules. + // This is always available because it's a production dependency. + // Satori supports woff format natively. + const fontPath = join( + process.cwd(), + 'node_modules', + '@fontsource', + 'inter', + 'files', + 'inter-latin-600-normal.woff' + ); + const buf = readFileSync(fontPath); + // Node.js Buffers share a pooled ArrayBuffer — slice to get a + // standalone copy so Satori's OpenType parser starts at byte 0. + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); } let fontData: ArrayBuffer | null = null;