Some checks failed
Build & Deploy KLZ Cables / 🔍 Prepare Environment (push) Successful in 21s
Build & Deploy KLZ Cables / 🧪 Quality Assurance (push) Successful in 1m36s
Build & Deploy KLZ Cables / 🏗️ Build & Push (push) Failing after 1m31s
Build & Deploy KLZ Cables / 🚀 Deploy (push) Has been skipped
Build & Deploy KLZ Cables / 🔔 Notifications (push) Successful in 3s
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { readFileSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
/**
|
|
* Loads the Inter fonts for use in Satori (Next.js OG Image generation).
|
|
* Since we are using runtime = 'nodejs', we can read them from the filesystem.
|
|
*/
|
|
export async function getOgFonts() {
|
|
const boldFontPath = join(process.cwd(), 'public/fonts/Inter-Bold.ttf');
|
|
const regularFontPath = join(process.cwd(), 'public/fonts/Inter-Regular.ttf');
|
|
|
|
try {
|
|
const boldFont = readFileSync(boldFontPath);
|
|
const regularFont = readFileSync(regularFontPath);
|
|
|
|
return [
|
|
{
|
|
name: 'Inter',
|
|
data: boldFont,
|
|
weight: 700 as const,
|
|
style: 'normal' as const,
|
|
},
|
|
{
|
|
name: 'Inter',
|
|
data: regularFont,
|
|
weight: 400 as const,
|
|
style: 'normal' as const,
|
|
},
|
|
];
|
|
} catch (error) {
|
|
console.error('Failed to load OG fonts from filesystem, falling back to system fonts:', error);
|
|
return [];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Common configuration for OG images
|
|
*/
|
|
export const OG_IMAGE_SIZE = {
|
|
width: 1200,
|
|
height: 630,
|
|
};
|