96dddeb20b
- fix(test): 添加 useSearchParams mock,修正联系链接断言 - style(nav): 将"联系我们"改为"联系" - chore(deploy): 更新 Nginx 配置和部署文档 - style(logo): 更新 Logo SVG 文件 - feat(scripts): 添加字体处理和站点配置脚本
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""对比两个字体文件"""
|
|
|
|
from fontTools.ttLib import TTFont
|
|
from fontTools.ttLib.tables import _h_m_t_x, _g_a_s_p
|
|
|
|
original_hmtx = _h_m_t_x.table__h_m_t_x.decompile
|
|
def patched_hmtx(self, data, ttFont):
|
|
try: return original_hmtx(self, data, ttFont)
|
|
except: self.metrics = {}
|
|
_h_m_t_x.table__h_m_t_x.decompile = patched_hmtx
|
|
|
|
original_gasp = _g_a_s_p.table__g_a_s_p.decompile
|
|
def patched_gasp(self, data, ttFont):
|
|
try: return original_gasp(self, data, ttFont)
|
|
except: self.gaspRanges = {}
|
|
_g_a_s_p.table__g_a_s_p.decompile = patched_gasp
|
|
|
|
print('=== public/fonts/AoyagiReisho.ttf ===')
|
|
f1 = TTFont('public/fonts/AoyagiReisho.ttf')
|
|
cmap1 = f1.getBestCmap()
|
|
print('U+9060 遠:', 0x9060 in cmap1)
|
|
print('U+8fdc 远:', 0x8fdc in cmap1)
|
|
print('字形数:', len(f1.getGlyphOrder()))
|
|
print('GSUB:', 'GSUB' in f1)
|
|
f1.close()
|
|
|
|
print()
|
|
print('=== src/app/fonts/AoyagiReisho.ttf ===')
|
|
f2 = TTFont('src/app/fonts/AoyagiReisho.ttf')
|
|
cmap2 = f2.getBestCmap()
|
|
print('U+9060 遠:', 0x9060 in cmap2)
|
|
print('U+8fdc 远:', 0x8fdc in cmap2)
|
|
print('字形数:', len(f2.getGlyphOrder()))
|
|
print('GSUB:', 'GSUB' in f2)
|
|
f2.close()
|