Files

51 lines
1.3 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
"""
添加古风官职字符到字体子集
"""
# 需要添加的特殊字符(古风官职文本中可能缺失的)
special_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_added = []
for char in special_chars:
if char not in existing_chars:
existing_chars.add(char)
new_chars_added.append(char)
# 保存更新后的字符列表
with open("themes/Ying/static/font/used_chars.txt", 'w', encoding='utf-8') as f:
f.write(''.join(sorted(existing_chars)))
print(f"📊 更新后字符数: {len(existing_chars)}")
if new_chars_added:
print(f"\n✅ 新增字符 ({len(new_chars_added)} 个):")
for char in new_chars_added:
print(f" '{char}'")
else:
print("\n✅ 没有新字符需要添加")
print(f"\n✅ 字符列表已更新")