mirror of
https://github.com/YuleBest/FontMM.git
synced 2026-12-04 03:11:48 +08:00
revert(metrics): 移除固定行距字距功能, 不再改动字体本身 (issue #17)
实测只要在 WebUI 改动「固定行距 & 字距」就会触发开机失败, 把设置恢复默认同样触发, 不动该设置则一切正常; beta.9 已因此撤回。为保险起见整套功能删除: - apply.sh: 删掉 unify_one / MANAGED_FONTS 与 metrics.txt、line-height.txt 读取 - fontmm-subset: 删掉 -line-metrics 模式 (sfnt/字体集合解析与 hhea/OS-2/head 改写) - WebUI: 删掉高级配置里的开关与档位, 以及 dev 模式的伪 exec 分支 - customize.sh: 设置继承清单去掉 metrics.txt / line-height.txt - README / DEVELOPMENT / dev/ci.mjs 同步移除相关章节与检查
This commit is contained in:
1 parent
03a565ddea
commit
e5288439dd
12 files changed
+12
-666
No files matched your search
+7
-37
@@ -123,21 +123,20 @@ await check('派生字体配置未被 git 跟踪', async () => {
|
||||
// apply.sh 的占位字体映射 与 empty-font.mjs 的占位清单 必须一致
|
||||
//
|
||||
// apply.sh 里有两类单引号字体名:
|
||||
// 1. 会被用户字体覆盖的 SysFont*/SysSans* 占位文件 —— 必须与 empty-font.mjs 的
|
||||
// PLACEHOLDERS 一一对应
|
||||
// 2. 直接替换的系统字体 (DroidSansMono.ttf / NotoColorEmoji.ttf) —— 不经过占位机制,
|
||||
// 不属于占位清单, 无论出现在单行还是多行列表里都要排除
|
||||
// 1. 多行的字体列表赋值 (hans_fonts/hant_fonts/en_fonts) —— 会被用户字体覆盖的
|
||||
// SysFont*/SysSans* 占位文件, 必须与 empty-font.mjs 的 PLACEHOLDERS 一一对应
|
||||
// 2. 单行的系统字体名 (DroidSansMono.ttf / NotoColorEmoji.ttf) —— 直接替换系统
|
||||
// 字体文件, 不经过占位机制, 不属于占位清单
|
||||
// 按「是否含换行」区分这两类, 与源码结构一致。
|
||||
await check('apply.sh 占位映射与占位清单一致', async () => {
|
||||
// 直接替换的系统字体: 仓库里是真实文件, 不能被占位脚本清空
|
||||
const systemFonts = new Set(['DroidSansMono.ttf', 'NotoColorEmoji.ttf']);
|
||||
|
||||
const applySh = await fsp.readFile(path.join(SRC_DIR, 'apply.sh'), 'utf8');
|
||||
const mapped = new Set();
|
||||
for (const m of applySh.matchAll(/'([^']*)'/g)) {
|
||||
const value = m[1];
|
||||
if (!value.includes('\n')) continue; // 跳过单行系统字体名
|
||||
for (const line of value.split('\n')) {
|
||||
const name = line.trim();
|
||||
if (name.endsWith('.ttf') && !systemFonts.has(name)) mapped.add(name);
|
||||
if (name.endsWith('.ttf')) mapped.add(name);
|
||||
}
|
||||
}
|
||||
if (mapped.size === 0) throw new Error('未从 apply.sh 解析到占位字体列表 (解析逻辑可能已失效)');
|
||||
@@ -196,35 +195,6 @@ await check('Zygisk 预热字体清单与 apply.sh 一致', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
// 固定行距 (issue #17): 开关与档位由 WebUI 写、apply.sh 读, 文件名/取值必须一致。
|
||||
// (早先版本还有一个「度量载体」字体插到 fonts.xml, 因设备上会导致开机失败已移除)
|
||||
await check('行距开关与档位一致 (apply.sh / WebUI)', async () => {
|
||||
const applySh = await fsp.readFile(path.join(SRC_DIR, 'apply.sh'), 'utf8');
|
||||
const metricsTs = await fsp.readFile(path.join(WEB_DIR, 'src', 'metrics.ts'), 'utf8');
|
||||
|
||||
const shSwitch = /\$\{?FONTS_DIR\}?\/metrics\.txt/.test(applySh);
|
||||
const webSwitch = /FONTS_DIR\}\/metrics\.txt/.test(metricsTs);
|
||||
if (!shSwitch || !webSwitch) {
|
||||
throw new Error(`开关文件名不一致 (apply.sh=${shSwitch}, WebUI=${webSwitch})`);
|
||||
}
|
||||
|
||||
const shLevel = /\$\{?FONTS_DIR\}?\/line-height\.txt/.test(applySh);
|
||||
const webLevel = /FONTS_DIR\}\/line-height\.txt/.test(metricsTs);
|
||||
if (!shLevel || !webLevel) {
|
||||
throw new Error(`档位文件名不一致 (apply.sh=${shLevel}, WebUI=${webLevel})`);
|
||||
}
|
||||
|
||||
// 档位缺省值: WebUI 的常量必须包含 apply.sh 的缺省值, 否则界面显示与刷入结果不一致
|
||||
const shDefault = applySh.match(/METRICS_TOTAL=(\d+)/);
|
||||
if (!shDefault) throw new Error('apply.sh 中未找到行距档位缺省值');
|
||||
if (!metricsTs.includes(shDefault[1])) {
|
||||
throw new Error(`WebUI 未定义 apply.sh 的缺省档位 ${shDefault[1]}`);
|
||||
}
|
||||
|
||||
// 字体行距统一只作用于 apply.sh 安装的字体, 清单不能卷进占位/系统字体之外的名字
|
||||
if (!/^MANAGED_FONTS='/m.test(applySh)) throw new Error('apply.sh 中未找到 MANAGED_FONTS 清单');
|
||||
});
|
||||
|
||||
// 前端脚本引用的 dev 入口必须存在 (避免重命名后 package.json 指向不存在的文件)
|
||||
await check('package.json 中引用的 dev 脚本存在', async () => {
|
||||
const pkg = JSON.parse(await fsp.readFile(path.join(ROOT, 'package.json'), 'utf8'));
|
||||
|
||||
Reference in new issue
Block a user