feat: 添加古风官职特殊字符 + 优化字体子集化脚本

字符添加:
- 添加破折号(—)
- 添加庶、尉、谏、簿、丞
- 确保古风官职文本完整显示

脚本优化:
- 修改subset-font-safe.py,保留现有字符
- 合并新提取的字符,避免覆盖手动添加的字符
- 字体大小:740.7 KB(减少39.6%)
This commit is contained in:
Vaica committed 2026-06-03 14:53:56 +08:00
1 parent 5eee9e5753
commit 80940b0316
6 files changed
+144 -11

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""
添加古风官职缺失字符到字体子集
"""
import os
# 缺失的字符
missing_chars = ['—', '庶', '尉', '谏', '簿', '丞']
print("🔧 添加古风官职缺失字符")
print("=" * 60)
# 读取现有字符
chars_file = "themes/Ying/static/font/used_chars.txt"
with open(chars_file, 'r', encoding='utf-8') as f:
existing_chars = set(f.read())
print(f"📊 现有字符数: {len(existing_chars)}")
# 检查哪些字符真正缺失
chars_to_add = []
for char in missing_chars:
if char not in existing_chars:
chars_to_add.append(char)
print(f"➕ 需要添加: '{char}'")
else:
print(f"✅ 已存在: '{char}'")
# 添加缺失字符
if chars_to_add:
# 添加到字符集合
all_chars = existing_chars | set(chars_to_add)
# 保存更新后的字符列表
with open(chars_file, 'w', encoding='utf-8') as f:
f.write(''.join(sorted(all_chars)))
print(f"\n✅ 已添加 {len(chars_to_add)} 个字符")
print(f"📊 更新后字符数: {len(all_chars)}")
print(f"\n📝 添加的字符: {''.join(chars_to_add)}")
else:
print("\n✅ 所有字符都已存在,无需添加")
print(f"\n✅ 字符列表已更新: {chars_file}")