feat: 添加古风官职字符到字体子集
- 添加破折号(—) - 添加庶民、太尉等特殊字符 - 字体大小增加3KB(757KB → 760KB)
This commit is contained in:
1 parent
0e17553a19
commit
5a00965c1a
9 files changed
+504
-4
No files matched your search
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
合并古风官职字符到字体子集
|
||||
直接在现有字符列表末尾添加缺失的字符
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
# 古风官职文本中的所有字符
|
||||
ancient_chars = set("""正一品太师2000从太尉1400二参知政事1050节度使800三御史中丞600秘书监480四谏议大夫380侍读学士300五给事中240知州190六侍御史150通判115七知县85殿中侍御史60八大理评事40录事参军25九主簿15司户参军5—庶民0""")
|
||||
|
||||
print(f"📊 古风文本字符数: {len(ancient_chars)}")
|
||||
|
||||
# 读取现有字符
|
||||
with open("themes/Ying/static/font/used_chars.txt", 'r', encoding='utf-8') as f:
|
||||
existing_chars = set(f.read())
|
||||
|
||||
print(f"📊 现有字符数: {len(existing_chars)}")
|
||||
|
||||
# 找出新字符
|
||||
new_chars = ancient_chars - existing_chars
|
||||
|
||||
print(f"📊 新字符数: {len(new_chars)}")
|
||||
|
||||
if new_chars:
|
||||
print(f"\n✅ 新增字符:")
|
||||
for char in sorted(new_chars):
|
||||
print(f" '{char}' (U+{ord(char):04X})")
|
||||
|
||||
# 添加新字符到现有字符列表
|
||||
all_chars = existing_chars | ancient_chars
|
||||
|
||||
# 保存更新后的字符列表
|
||||
with open("themes/Ying/static/font/used_chars.txt", 'w', encoding='utf-8') as f:
|
||||
f.write(''.join(sorted(all_chars)))
|
||||
|
||||
print(f"\n✅ 已添加 {len(new_chars)} 个新字符")
|
||||
print(f"📊 更新后字符数: {len(all_chars)}")
|
||||
else:
|
||||
print("\n✅ 没有新字符需要添加(所有字符都已存在)")
|
||||
|
||||
print(f"\n✅ 字符列表已更新: themes/Ying/static/font/used_chars.txt")
|
||||
Reference in new issue
Block a user