改为本地 fonts 字体渲染方案

- 在 message_summary 插件中新增本地字体 CSS 构建逻辑,动态注入模板\n- 使用 fonts/simhei.ttf 与 fonts/simsun.ttf 生成 @font-face,避免外网字体依赖\n- Gemini 总结模板移除 Google Fonts,改用本地字体变量与系统回退栈\n- 补充详细中文注释,说明离线字体加载与容错策略
This commit is contained in:
liuwei
2026-04-23 09:57:25 +08:00
parent 31e488e759
commit 6cf63bc494
2 changed files with 62 additions and 4 deletions

View File

@@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<style>
/* 说明:优先尝试加载与 Gemini 示例一致的 Inter / JetBrains Mono失败时回退到系统字体避免服务端无字体时样式崩坏。 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');
/* 说明:由后端动态注入本地字体 @font-facefonts 目录),避免外网字体依赖。 */
{{ local_font_css }}
:root {
--bg: #f8fafc;
@@ -33,7 +33,8 @@
padding: 10px 0 12px;
background: var(--bg);
color: var(--text);
font-family: "Inter", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
/* 说明:优先使用本地字体变量,未命中时回退系统字体。 */
font-family: var(--abot-font-sans, "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
-webkit-font-smoothing: antialiased;
}
.report-container {
@@ -177,7 +178,8 @@
font-style: italic;
}
.markdown-body code {
font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
/* 说明:代码字体优先使用本地/系统等宽字体栈,保证服务端离线场景可读。 */
font-family: var(--abot-font-code, "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace);
font-size: 12px;
background: #eff6ff;
color: #1e40af;