mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(meme-generator): add meme generation API route with template and custom image modes
Custom route handler supporting template mode (JSON body with templateId) and custom image mode (multipart upload). Registers process function for pipeline compatibility. Includes 18 integration tests.
This commit is contained in:
@@ -61,7 +61,15 @@ export function loadFont(family: string): opentype.Font {
|
||||
}
|
||||
|
||||
const buf = readFileSync(join(FONT_DIR, filename));
|
||||
const font = opentype.parse(buf.buffer as ArrayBuffer);
|
||||
let font: opentype.Font;
|
||||
try {
|
||||
font = opentype.parse(buf.buffer as ArrayBuffer);
|
||||
} catch {
|
||||
if (filename !== FONT_MAP.anton) {
|
||||
return loadFont("anton");
|
||||
}
|
||||
throw new Error(`Failed to parse font: ${filename}`);
|
||||
}
|
||||
fontCache.set(filename, font);
|
||||
return font;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user