From be2d2719e5c9d07c73b5c8d5bbc4faf84df13b6d Mon Sep 17 00:00:00 2001 From: martbost Date: Fri, 28 Aug 2026 08:42:33 -0500 Subject: [PATCH] Video Maker: resolve the DejaVu bold font from real candidate paths (Alpine vs Debian) instead of relying on ffmpeg's fallback Co-Authored-By: Claude Fable 5 --- suite-video.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/suite-video.js b/suite-video.js index e8163d5..e245617 100644 --- a/suite-video.js +++ b/suite-video.js @@ -59,6 +59,22 @@ function dt(s) { // Linux (no colons), required on Windows drive letters when testing locally. function dtPath(p) { return String(p || '').replace(/\\/g, '/').replace(/:/g, '\\:'); } +// Alpine puts DejaVu in /usr/share/fonts/dejavu; Debian uses truetype/dejavu. +// Pick a real file rather than trusting ffmpeg's undefined fallback. +let _font = null; +function pickFont() { + if (_font) return _font; + const cands = [ + '/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf', + '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', + '/usr/share/fonts/dejavu/DejaVuSans.ttf', + '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf' + ]; + for (const c of cands) { try { if (fs.existsSync(c)) { _font = c; return c; } } catch (e) {} } + _font = cands[0]; + return _font; +} + function ffmpegBin() { return process.env.FFMPEG_BIN || 'ffmpeg'; } function render(opts) { @@ -74,7 +90,7 @@ function render(opts) { const out = path.join(outDir(), id + '-' + angle + '.mp4'); try { writeQrPpm(link, qrFile, 10, 4); } catch (e) { return reject(new Error('Could not build your QR code.')); } - const font = process.env.FF_FONT || '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'; + const font = process.env.FF_FONT || pickFont(); const shortLink = link.replace(/^https?:\/\//, ''); const headline = name ? (name + ' invited you') : 'You were invited';