feat(posters): 新增思源黑体 Noto Sans SC(中文黑体 400/700),海报库达 2360/66

This commit is contained in:
sgp
2026-11-05 01:47:36 +08:00
parent d3204ab459
commit 73f788556b
13 changed files with 83 additions and 26 deletions
+3 -3
View File
@@ -15,9 +15,9 @@ h1{font-size:16px}h2{font-size:14px}
<p>支持参数:<code>?only=源1,源2</code> 定向审计;<code>?max=N</code> 每源最多素材数;<code>?size=N</code> 渲染尺寸;<code>?compare=1</code> 开启「原始 vs 下载」逐像素对比。</p> <p>支持参数:<code>?only=源1,源2</code> 定向审计;<code>?max=N</code> 每源最多素材数;<code>?size=N</code> 渲染尺寸;<code>?compare=1</code> 开启「原始 vs 下载」逐像素对比。</p>
<div id="out"><p>加载中…</p></div> <div id="out"><p>加载中…</p></div>
<script src="js/data/poster-sources.js?v=20261105d"></script> <script src="js/data/poster-sources.js?v=20261105e"></script>
<script src="js/data/poster-builtin.js?v=20261105d"></script> <script src="js/data/poster-builtin.js?v=20261105e"></script>
<script src="js/core/posterlib.js?v=20261105d"></script> <script src="js/core/posterlib.js?v=20261105e"></script>
<script> <script>
/** 渲染 svg 字符串 → 像素统计 {blank, alphaSum, data, width, height} */ /** 渲染 svg 字符串 → 像素统计 {blank, alphaSum, data, width, height} */
+1 -1
View File
@@ -12,7 +12,7 @@
const HGB_PosterLib = (function () { const HGB_PosterLib = (function () {
'use strict'; 'use strict';
const VERSION = '20261105d'; // 与 poster.html 中 poster-builtin.js?v= 版本联动 const VERSION = '20261105e'; // 与 poster.html 中 poster-builtin.js?v= 版本联动
const cache = {}; // sid -> {items:[...]} const cache = {}; // sid -> {items:[...]}
const pending = {}; // sid -> Promise const pending = {}; // sid -> Promise
+3 -3
View File
@@ -5,7 +5,7 @@
## 生成时间 ## 生成时间
2026-11-04T17:37:47.941Z 2026-11-04T17:47:13.304Z
## ① 图标库(共享,LOGO/头像/海报共用) ## ① 图标库(共享,LOGO/头像/海报共用)
@@ -15,8 +15,8 @@
## ② 海报素材库 ## ② 海报素材库
- 源数:65 | 素材总数:2358 - 源数:66 | 素材总数:2360
- 类型分布:palette 7 / decoration 4 / bg 4 / font 50 - 类型分布:palette 7 / decoration 4 / bg 4 / font 51
- 源清单:js/data/manifest/posters.json - 源清单:js/data/manifest/posters.json
## ③ 技能库 ## ③ 技能库
+22 -2
View File
@@ -1,7 +1,7 @@
{ {
"kind": "posters", "kind": "posters",
"total": 2358, "total": 2360,
"builtAt": "2026-11-04T17:37:15.001Z", "builtAt": "2026-11-04T17:44:28.985Z",
"guide": "js/data/manifest/README.md", "guide": "js/data/manifest/README.md",
"idRule": "「源:相对路径」,如 fontsource-inter:latin-400-normal.woff2", "idRule": "「源:相对路径」,如 fontsource-inter:latin-400-normal.woff2",
"sources": [ "sources": [
@@ -1304,6 +1304,26 @@
"workspaces": [ "workspaces": [
"poster" "poster"
] ]
},
{
"id": "noto-sans-sc",
"type": "font",
"name": "Noto Sans SC",
"nameCn": "思源黑体(中文黑体)",
"desc": "Google 与 Adobe 联合开源的思源黑体简体中文版(OFL 1.1),字形中性、结构严谨、字重完整,是中文海报标题与正文的通用黑体首选",
"license": "OFL-1.1",
"licenseNote": "SIL Open Font License 1.1,可自由商用、修改与再分发,需保留版权声明且不得单独售卖字体",
"home": "https://fonts.google.com/noto/specimen/Noto+Sans+SC",
"github": "https://github.com/googlefonts/noto-cjk",
"format": "gh-files",
"coordText": "SubsetOTF 单文件(简体中文全字形子集,约 8MB / 字重)",
"variants": "Regular 400 / Bold 700",
"added": "2026-11-05",
"count": 2,
"file": "posters/noto-sans-sc.js",
"workspaces": [
"poster"
]
} }
] ]
} }
File diff suppressed because one or more lines are too long
+29
View File
@@ -929,6 +929,35 @@
variants: '24 组色系 × 12 级色阶 = 288 色', variants: '24 组色系 × 12 级色阶 = 288 色',
added: '2026-11-05', added: '2026-11-05',
workspaces: ['poster'] workspaces: ['poster']
},
/* ============================================================
* —— 2026-11-05 中文黑体:思源黑体(Noto Sans SC)——
* 来源 googlefonts/noto-cjk,SubsetOTF/SC 为简体中文完整字形子集单文件
* 仓库体积过大无法整树枚举(jsDelivr API 拒绝),改用显式 files 清单直拉
* ============================================================ */
{
id: 'noto-sans-sc',
type: 'font',
name: 'Noto Sans SC',
nameCn: '思源黑体(中文黑体)',
desc: 'Google 与 Adobe 联合开源的思源黑体简体中文版(OFL 1.1),字形中性、结构严谨、字重完整,是中文海报标题与正文的通用黑体首选',
license: 'OFL-1.1',
licenseNote: 'SIL Open Font License 1.1,可自由商用、修改与再分发,需保留版权声明且不得单独售卖字体',
home: 'https://fonts.google.com/noto/specimen/Noto+Sans+SC',
github: 'https://github.com/googlefonts/noto-cjk',
format: 'gh-files',
gh: 'googlefonts/noto-cjk',
ghBranch: 'main',
files: [
'Sans/SubsetOTF/SC/NotoSansSC-Regular.otf',
'Sans/SubsetOTF/SC/NotoSansSC-Bold.otf'
],
ext: ['.otf'],
scaleMode: 'wrap',
coordText: 'SubsetOTF 单文件(简体中文全字形子集,约 8MB / 字重)',
variants: 'Regular 400 / Bold 700',
added: '2026-11-05',
workspaces: ['poster']
} }
]; ];
}); });
+2
View File
@@ -0,0 +1,2 @@
/* Noto Sans SC(由 scripts/build-posters.js 生成,勿手动编辑)@cfg:ym2vlg */
window['HGB_PosterSource_noto-sans-sc'] = {"items":[{"id":"noto-sans-sc:NotoSansSC-Regular","name":"NotoSansSC-Regular","type":"font","category":"font","categoryCn":"字体排版","workspaces":["poster"],"file":"posters/noto-sans-sc/files/NotoSansSC-Regular.otf","mime":"application/octet-stream","bytes":8331336,"sha256":"faa6c9df652116dde789d351359f3d7e5d2285a2b2a1f04a2d7244df706d5ea9","width":null,"height":null},{"id":"noto-sans-sc:NotoSansSC-Bold","name":"NotoSansSC-Bold","type":"font","category":"font","categoryCn":"字体排版","workspaces":["poster"],"file":"posters/noto-sans-sc/files/NotoSansSC-Bold.otf","mime":"application/octet-stream","bytes":8543168,"sha256":"c6cb5a93abaa9edc8ee7463b7ebb7f42d618d40e6ed2f7a5371c97b0b64767c0","width":null,"height":null}]};
+3 -3
View File
@@ -118,7 +118,7 @@
<script src="js/core/dicebear.js?v=20260822e"></script> <script src="js/core/dicebear.js?v=20260822e"></script>
<script src="js/data/builtin-icons.js?v=20261105c"></script> <script src="js/data/builtin-icons.js?v=20261105c"></script>
<script src="js/data/poster-builtin.js?v=20261105d"></script> <script src="js/data/poster-builtin.js?v=20261105e"></script>
<script> <script>
(function () { (function () {
'use strict'; 'use strict';
@@ -176,7 +176,7 @@
.catch(function () { ICON_SRC = window.HGB_IconSources || []; }); .catch(function () { ICON_SRC = window.HGB_IconSources || []; });
} }
function loadPosterManifest() { function loadPosterManifest() {
return fetch('js/data/manifest/posters.json?v=20261105d') return fetch('js/data/manifest/posters.json?v=20261105e')
.then(function (r) { return r.json(); }) .then(function (r) { return r.json(); })
.then(function (m) { POSTER_SRC = m.sources || []; }) .then(function (m) { POSTER_SRC = m.sources || []; })
.catch(function () { POSTER_SRC = window.HGB_PosterSources || []; }); .catch(function () { POSTER_SRC = window.HGB_PosterSources || []; });
@@ -191,7 +191,7 @@
} }
function loadPosterData(id) { function loadPosterData(id) {
if (loadedCache['p_' + id]) return loadedCache['p_' + id]; if (loadedCache['p_' + id]) return loadedCache['p_' + id];
loadedCache['p_' + id] = loadScript('js/data/posters/' + id + '.js?v=20261105d') loadedCache['p_' + id] = loadScript('js/data/posters/' + id + '.js?v=20261105e')
.then(function () { return window['HGB_PosterSource_' + id] || null; }); .then(function () { return window['HGB_PosterSource_' + id] || null; });
return loadedCache['p_' + id]; return loadedCache['p_' + id];
} }
+2 -2
View File
@@ -84,7 +84,7 @@
</div> </div>
<script src="js/data/poster-sources.js"></script> <script src="js/data/poster-sources.js"></script>
<script src="js/data/poster-builtin.js?v=20261105d"></script> <script src="js/data/poster-builtin.js?v=20261105e"></script>
<script> <script>
(function () { (function () {
const builtin = window.HGB_PosterBuiltin || { sources: {} }; const builtin = window.HGB_PosterBuiltin || { sources: {} };
@@ -139,7 +139,7 @@
} }
// 优先读机器可读 manifest(js/data/manifest/posters.json,构建时生成);失败回退内置配置 // 优先读机器可读 manifest(js/data/manifest/posters.json,构建时生成);失败回退内置配置
fetch('js/data/manifest/posters.json?v=20261105d') fetch('js/data/manifest/posters.json?v=20261105e')
.then(r => r.json()) .then(r => r.json())
.then(m => { sources = m.sources || []; render(); }) .then(m => { sources = m.sources || []; render(); })
.catch(() => { sources = FALLBACK; render(); }); .catch(() => { sources = FALLBACK; render(); });
+2 -2
View File
@@ -90,8 +90,8 @@
<div id="toast" class="toast hidden"></div> <div id="toast" class="toast hidden"></div>
<script src="js/data/poster-sources.js"></script> <script src="js/data/poster-sources.js"></script>
<script src="js/data/poster-builtin.js?v=20261105d"></script> <script src="js/data/poster-builtin.js?v=20261105e"></script>
<script src="js/core/posterlib.js?v=20261105d"></script> <script src="js/core/posterlib.js?v=20261105e"></script>
<script src="js/core/ai.js?v=20260927a"></script> <script src="js/core/ai.js?v=20260927a"></script>
<script src="js/core/poster-store.js"></script> <script src="js/core/poster-store.js"></script>
<script src="js/core/poster-generator.js"></script> <script src="js/core/poster-generator.js"></script>
+14 -8
View File
@@ -221,19 +221,25 @@ async function downloadGhFiles(src) {
const items = []; const items = [];
let ok = 0, fail = 0; let ok = 0, fail = 0;
const repo = `${src.gh}@${src.ghBranch || 'master'}`; const repo = `${src.gh}@${src.ghBranch || 'master'}`;
const tree = JSON.parse(await fetchText(`https://data.jsdelivr.com/v1/packages/gh/${repo}`));
const exts = (Array.isArray(src.ext) ? src.ext : (src.ext ? String(src.ext).split(',') : ['.svg'])) const exts = (Array.isArray(src.ext) ? src.ext : (src.ext ? String(src.ext).split(',') : ['.svg']))
.map(e => e.trim().toLowerCase()); .map(e => e.trim().toLowerCase());
const files = []; const files = [];
(function walk(list, prefix) { if (Array.isArray(src.files) && src.files.length) {
for (const f of list) { // 显式文件清单:超大仓库(如 noto-cjk)无法整树枚举时直接按路径下载
if (f.type === 'directory') walk(f.files || [], prefix + f.name + '/'); files.push(...src.files);
else if (exts.some(e => f.name.toLowerCase().endsWith(e))) files.push(prefix + f.name); } else {
} const tree = JSON.parse(await fetchText(`https://data.jsdelivr.com/v1/packages/gh/${repo}`));
})(tree.files || [], ''); (function walk(list, prefix) {
for (const f of list) {
if (f.type === 'directory') walk(f.files || [], prefix + f.name + '/');
else if (exts.some(e => f.name.toLowerCase().endsWith(e))) files.push(prefix + f.name);
}
})(tree.files || [], '');
}
// dirs 支持 '.' 表示全目录;maxItems 用于超大源限量收录(如表情包全量过大) // dirs 支持 '.' 表示全目录;maxItems 用于超大源限量收录(如表情包全量过大)
const explicit = Array.isArray(src.files) && src.files.length > 0;
const allowed = (src.dirs || []).map(d => d === '.' || d === '' ? '' : d.replace(/\/$/, '') + '/'); const allowed = (src.dirs || []).map(d => d === '.' || d === '' ? '' : d.replace(/\/$/, '') + '/');
let picked = files.filter(p => allowed.some(d => d === '' || p.startsWith(d))); let picked = explicit ? files.slice() : files.filter(p => allowed.some(d => d === '' || p.startsWith(d)));
picked = dropNonAssets(picked); picked = dropNonAssets(picked);
if (src.exclude) { if (src.exclude) {
const re = new RegExp(src.exclude); const re = new RegExp(src.exclude);