Add lower-corner layouts, custom blur backgrounds, and classic blur fill.

Ship composition families, optional background images for lower-corner templates, and an optional blurred cover fill for classic letterbox.
This commit is contained in:
Atakan Doğan Özban
2026-08-07 00:51:37 +02:00
parent 03634d5100
commit 848607f9e0
25 changed files with 1081 additions and 122 deletions
+27 -4
View File
@@ -9,8 +9,17 @@ import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const outDir = path.join(__dirname, "..", "assets", "fonts");
/** Direct TTF URLs from Google Fonts GitHub (OFL). */
/** Direct TTF URLs from Google Fonts GitHub (OFL / Apache 2.0). */
const FONTS = [
{
file: "Arimo-Regular.ttf",
// Static TTF from googlefonts/arimo (not the broken google/fonts apache/static path)
url: "https://cdn.jsdelivr.net/gh/googlefonts/arimo@main/fonts/ttf/Arimo-Regular.ttf",
},
{
file: "Arimo-Bold.ttf",
url: "https://cdn.jsdelivr.net/gh/googlefonts/arimo@main/fonts/ttf/Arimo-Bold.ttf",
},
{
file: "Inter-Regular.ttf",
url: "https://github.com/google/fonts/raw/main/ofl/inter/Inter%5Bopsz%2Cwght%5D.ttf",
@@ -35,12 +44,22 @@ const FONTS = [
await fs.mkdir(outDir, { recursive: true });
function looksLikeFont(buf) {
if (buf.length < 4) return false;
const asStr = buf.subarray(0, 4).toString("ascii");
if (asStr === "OTTO" || asStr === "true" || asStr === "typ1") return true;
return buf[0] === 0x00 && buf[1] === 0x01 && buf[2] === 0x00 && buf[3] === 0x00;
}
for (const font of FONTS) {
const dest = path.join(outDir, font.file);
try {
await fs.access(dest);
console.log("skip (exists)", font.file);
continue;
const existing = await fs.readFile(dest);
if (looksLikeFont(existing)) {
console.log("skip (exists)", font.file);
continue;
}
console.warn("corrupt font, re-fetching", font.file);
} catch {
/* download */
}
@@ -54,6 +73,10 @@ for (const font of FONTS) {
continue;
}
const buf = Buffer.from(await res.arrayBuffer());
if (!looksLikeFont(buf)) {
console.error("FAILED invalid font bytes", font.file, buf.subarray(0, 8).toString("hex"));
continue;
}
await fs.writeFile(dest, buf);
console.log("wrote", font.file, buf.length, "bytes");
}