chore: standardize project comments in English

This commit is contained in:
eezd committed 2026-10-26 22:52:12 +08:00
1 parent a874a39ea5
commit ccb16acbea
167 files changed
+820 -820

No files matched your search

+5 -5
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""从指定 v7.9 ZIP 重建本地字体:python3 scripts/prepare-maple-font.py /path/to/MapleMonoNormalNL-NF-CN.zip。
仅重建字体时需要 fonttools[woff];应用构建直接使用已入库的 WOFF2。
来源:https://github.com/subframe7536/maple-font/releases/tag/v7.9
"""Rebuild local fonts from the specified v7.9 ZIP: python3 scripts/prepare-maple-font.py /path/to/MapleMonoNormalNL-NF-CN.zip.
Only font regeneration requires fonttools[woff]; application builds use the checked-in WOFF2 files.
Source: https://github.com/subframe7536/maple-font/releases/tag/v7.9
"""
import io
from pathlib import Path
@@ -15,14 +15,14 @@ root = Path(__file__).resolve().parents[1] / 'web/src/common/appearance'
output = root / 'fonts/maple'
output.mkdir(exist_ok=True)
family = 'Maple Mono Normal NL NF CN'
css = ['/* Maple Mono v7.9;由 scripts/prepare-maple-font.py 生成,授权见 fonts/maple/LICENSE.txt。 */']
css = ['/* Maple Mono v7.9; generated by scripts/prepare-maple-font.py. See fonts/maple/LICENSE.txt for licensing. */']
with zipfile.ZipFile(sys.argv[1]) as archive:
(output / 'LICENSE.txt').write_bytes(archive.read('LICENSE.txt'))
for variant, weight, style in [('Regular', 400, 'normal'), ('Bold', 700, 'normal'), ('Italic', 400, 'italic'), ('BoldItalic', 700, 'italic')]:
data = archive.read('MapleMonoNormalNL-NF-CN-' + variant + '.ttf')
source = TTFont(io.BytesIO(data))
points = sorted(source.getBestCmap())
# 按 Unicode 区间分片,中文和 Nerd Font 不强制随拉丁文字一起下载。
# Split by Unicode range so Chinese and Nerd Font glyphs need not download alongside Latin text.
for block in sorted({cp // 4096 for cp in points}):
unicodes = [cp for cp in points if cp // 4096 == block]
font = TTFont(io.BytesIO(data), recalcTimestamp=False)