Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(poster): refine built-in template font pairings with catalog display fonts

tianma-if4edadb101f24
diff --git a/apps/web/src/lib/poster-design/vendor/qiaomu/templates.ts b/apps/web/src/lib/poster-design/vendor/qiaomu/templates.ts
index 13900320..254d8e1e 100644
--- a/apps/web/src/lib/poster-design/vendor/qiaomu/templates.ts
+++ b/apps/web/src/lib/poster-design/vendor/qiaomu/templates.ts
@@ -652,10 +652,10 @@ const PREMIUM: Template[] = [
return { background: linear(p, 180), objects: keep<FabricObject>(
kitGlow(w * 0.2, h * 0.3, Math.min(w, h) * 0.55, '#a855f7', 0.5), kitGlow(w * 0.8, h * 0.6, Math.min(w, h) * 0.55, p.accent, 0.5), ...lines, grain(w, h, 0.09, 23),
...cropMarks(w, h, m * 0.5, 40 * u, p.accent, Math.max(2, 3 * u)),
- meta(`● REC ${(i.badge?.trim() || 'SYS')} / ONLINE`, m, m * 0.85, inner * 0.7, Math.max(16, 20 * u), p.sub, { fontFamily: 'monospace', charSpacing: 120 }),
+ meta(`● REC ${(i.badge?.trim() || 'SYS')} / ONLINE`, m, m * 0.85, inner * 0.7, Math.max(16, 20 * u), p.sub, { fontFamily: 'JetBrains Mono', charSpacing: 120 }),
textbox(i.title, m, top, tw, { qcRole: 'title', fontSize: size, fill: p.ink, fontWeight: 'bold', lineHeight: 1.04, shadow: new Shadow({ color: p.accent, blur: 34 * u, offsetX: 0, offsetY: 0 }), charSpacing: -10 }),
...sub(i, m, top + th + 26 * u, inner, Math.max(26, 36 * u), p.sub, { fontWeight: 'bold' }),
- meta('00:03:21:07', m, h - m * 0.85 - 22 * u, inner * 0.5, Math.max(14, 18 * u), p.sub, { fontFamily: 'monospace' }), meta('2.39:1', m + inner * 0.5, h - m * 0.85 - 22 * u, inner * 0.5, Math.max(14, 18 * u), p.sub, { fontFamily: 'monospace', textAlign: 'right' }),
+ meta('00:03:21:07', m, h - m * 0.85 - 22 * u, inner * 0.5, Math.max(14, 18 * u), p.sub, { fontFamily: 'JetBrains Mono' }), meta('2.39:1', m + inner * 0.5, h - m * 0.85 - 22 * u, inner * 0.5, Math.max(14, 18 * u), p.sub, { fontFamily: 'JetBrains Mono', textAlign: 'right' }),
) };
},
},
@@ -821,7 +821,7 @@ const PREMIUM: Template[] = [
textbox(i.title, m, top, inner, { qcRole: 'title', fontSize: size, fill: p.ink, fontFamily: SERIF, fontWeight: 'bold', lineHeight: 1.08, textAlign: 'center', charSpacing: 120, shadow: new Shadow({ color: 'rgba(255,170,90,0.45)', blur: 38 * u, offsetX: 0, offsetY: 0 }) }),
rule(w / 2 - 60 * u, top + th + 24 * u, 120 * u, p.accent, Math.max(2, 3 * u)),
...sub(i, m, top + th + 46 * u, inner, Math.max(24, 32 * u), p.sub, { textAlign: 'center', charSpacing: 180 }),
- ...(w >= h * 1.3 ? [meta('PRESENTED BY QIAOMU', m, h - bar - m * 1.1 - 24 * u, inner * 0.5, Math.max(13, 16 * u), p.sub, { fontFamily: 'monospace' }), meta('2026 · 2.39:1', m + inner * 0.5, h - bar - m * 1.1 - 24 * u, inner * 0.5, Math.max(13, 16 * u), p.sub, { fontFamily: 'monospace', textAlign: 'right' })] : []),
+ ...(w >= h * 1.3 ? [meta('PRESENTED BY QIAOMU', m, h - bar - m * 1.1 - 24 * u, inner * 0.5, Math.max(13, 16 * u), p.sub, { fontFamily: 'JetBrains Mono' }), meta('2026 · 2.39:1', m + inner * 0.5, h - bar - m * 1.1 - 24 * u, inner * 0.5, Math.max(13, 16 * u), p.sub, { fontFamily: 'JetBrains Mono', textAlign: 'right' })] : []),
) };
},
},
@@ -1071,7 +1071,7 @@ const STUDIO: Template[] = [
rect(cx, cy, cw, ch, '#ffffff', { rx: r, ry: r, shadow: new Shadow({ color: 'rgba(49,46,129,0.22)', blur: 60 * u, offsetX: 0, offsetY: 24 * u }) }),
rect(cx, cy, cw, bar, '#f3f4f6', { rx: r, ry: r }), rect(cx, cy + bar / 2, cw, bar / 2, '#f3f4f6'), rule(cx, cy + bar, cw, '#e5e7eb', Math.max(1, 2 * u)),
dot(cx + bar * 0.55, cy + bar / 2, bar * 0.13, '#ff5f57'), dot(cx + bar * 0.95, cy + bar / 2, bar * 0.13, '#febc2e'), dot(cx + bar * 1.35, cy + bar / 2, bar * 0.13, '#28c840'),
- textbox(i.badge?.trim() || 'cover.md', cx + bar * 2, cy + (bar - bar * 0.36 * 1.13) / 2, cw - bar * 4, { qcRole: 'badge', fontSize: bar * 0.36, fill: '#6b7280', textAlign: 'center', fontFamily: 'monospace', lineHeight: 1 }),
+ textbox(i.badge?.trim() || 'cover.md', cx + bar * 2, cy + (bar - bar * 0.36 * 1.13) / 2, cw - bar * 4, { qcRole: 'badge', fontSize: bar * 0.36, fill: '#6b7280', textAlign: 'center', fontFamily: 'JetBrains Mono', lineHeight: 1 }),
rect(cx + pad, ty - kick, Math.max(40, 64 * u), Math.max(6, 9 * u), p.accent, { rx: 4 * u, ry: 4 * u }),
textbox(i.title, cx + pad, ty, tw, { qcRole: 'title', fontSize: size, fill: p.ink, fontWeight: 'bold', lineHeight: 1.08 }),
...sub(i, cx + pad, ty + th + 28 * u, tw, subSize, p.sub),
diff --git a/apps/web/src/lib/poster-design/vendor/qiaomu/typeset.ts b/apps/web/src/lib/poster-design/vendor/qiaomu/typeset.ts
index 12059ad8..d96e659f 100644
--- a/apps/web/src/lib/poster-design/vendor/qiaomu/typeset.ts
+++ b/apps/web/src/lib/poster-design/vendor/qiaomu/typeset.ts
@@ -16,21 +16,35 @@ export interface Pair { title: string[]; body: string[]; zh: string }
// the moment before the library has landed.
const BODY = ['思源黑体', 'PingFang SC', 'Microsoft YaHei'];
export const MOODS: Record<Mood, Pair> = {
- heavy: { zh: '稳重有力', title: ['思源黑体 Heavy', '思源黑体 Bold', 'PingFang SC'], body: BODY },
- punch: { zh: '冲击抓眼', title: ['抖音美好体', '思源黑体 Heavy', '思源黑体 Bold', 'PingFang SC'], body: BODY },
- tech: { zh: '科技数据', title: ['未来荧黑', '得意黑', '思源黑体 Heavy'], body: BODY },
- trend: { zh: '潮流年轻', title: ['得意黑', '抖音美好体', '站酷庆科黄油体'], body: BODY },
- warm: { zh: '亲切活泼', title: ['江城圆体', '站酷庆科黄油体', '猫啃什锦黑', '抖音美好体'], body: BODY },
- serif: { zh: '文艺深度', title: ['思源宋体 Heavy', '朱雀仿宋', '思源宋体 Bold', 'Songti SC'], body: ['霞鹜文楷', '思源宋体', ...BODY] },
- brush: { zh: '国风书法', title: ['马善政楷书', '志莽行书', '朱雀仿宋'], body: ['朱雀仿宋', '霞鹜文楷', '思源宋体', ...BODY] },
+ heavy: { zh: '稳重有力', title: ['思源黑体 Heavy', '阿里巴巴普惠体 Heavy', 'PingFang SC'], body: BODY },
+ punch: { zh: '冲击抓眼', title: ['优设标题黑', '阿里妈妈数黑体', '抖音美好体', '思源黑体 Heavy'], body: BODY },
+ tech: { zh: '科技数据', title: ['阿里妈妈数黑体', '未来荧黑', '得意黑', '思源黑体 Heavy'], body: BODY },
+ trend: { zh: '潮流年轻', title: ['得意黑', '阿里妈妈数黑体', '抖音美好体', '站酷庆科黄油体'], body: BODY },
+ warm: { zh: '亲切活泼', title: ['江城圆体', '站酷庆科黄油体', '抖音美好体'], body: BODY },
+ serif: { zh: '文艺深度', title: ['思源宋体 Heavy', '朱雀仿宋', '思源宋体', 'Songti SC'], body: ['霞鹜文楷', '思源宋体', ...BODY] },
+ brush: { zh: '国风书法', title: ['马善政楷书', '朱雀仿宋'], body: ['朱雀仿宋', '霞鹜文楷', '思源宋体', ...BODY] },
};
const TEMPLATE_FACES: Record<string, string[]> = {
- keyword: ['得意黑'], riso: ['站酷快乐体', '站酷庆科黄油体'],
- newspaper: ['思源宋体 Heavy'], mag: ['朱雀仿宋', '思源宋体 Heavy'],
- notes: ['霞鹜文楷'], numeral: ['未来荧黑'],
- window: ['未来荧黑', '得意黑'], brush: ['抖音美好体', '思源黑体 Heavy', '思源黑体 Bold'],
- polaroid: ['霞鹜文楷', '站酷庆科黄油体'], stack: ['抖音美好体', '思源黑体 Heavy', '思源黑体 Bold'],
+ neo: ['优设标题黑', '阿里妈妈数黑体'],
+ bold: ['阿里妈妈数黑体', '优设标题黑'],
+ bili: ['阿里妈妈数黑体', '思源黑体 Heavy'],
+ highlight: ['优设标题黑', '思源黑体 Heavy'],
+ interview: ['优设标题黑', '阿里妈妈数黑体'],
+ frame: ['优设标题黑', '思源黑体 Heavy'],
+ kicker: ['阿里妈妈数黑体', '思源黑体 Heavy'],
+ stack: ['优设标题黑', '阿里妈妈数黑体', '抖音美好体'],
+ regeng: ['抖音美好体', '优设标题黑'],
+ keyword: ['得意黑', '优设标题黑'],
+ riso: ['站酷快乐体', '站酷庆科黄油体'],
+ newspaper: ['思源宋体 Heavy'],
+ mag: ['思源宋体 Heavy', '朱雀仿宋'],
+ notes: ['霞鹜文楷'],
+ numeral: ['未来荧黑', '阿里妈妈数黑体'],
+ number: ['阿里妈妈数黑体', '未来荧黑'],
+ window: ['未来荧黑', '阿里妈妈数黑体', '得意黑'],
+ brush: ['抖音美好体', '思源黑体 Heavy'],
+ polaroid: ['霞鹜文楷', '江城圆体', '站酷庆科黄油体'],
};
const MOOD_OF: Record<string, Mood> = {
@@ -52,8 +66,9 @@ export interface Resolved { title?: string; body?: string; titleBold: boolean; /
/** Picks the first installed family of each list. `missing` names the top choice per role when it is not installed. */
export function resolvePair(templateId: string | undefined, have: (family: string) => boolean): Resolved {
const mood = MOODS[moodOf(templateId)];
+ const topTitle = TEMPLATE_FACES[templateId ?? '']?.[0] ?? mood.title[0];
const title = [...(TEMPLATE_FACES[templateId ?? ''] ?? []), ...mood.title, ...BODY].find(have), body = mood.body.find(have);
- const missing = [mood.title[0], mood.body[0]].filter((f): f is string => !!f && !have(f));
+ const missing = [topTitle, mood.body[0]].filter((f): f is string => !!f && !have(f));
return { ...(title ? { title } : {}), ...(body ? { body } : {}), titleBold: !!title && HAS_BOLD.has(title), missing: [...new Set(missing)] };
}