Complete phase two benchmarks, plot previews and static export workflow

This commit is contained in:
2026-09-07 02:54:52 +08:00
parent 95095197df
commit 89df10bc4e
59 changed files with 2535 additions and 83 deletions
+22
View File
@@ -0,0 +1,22 @@
"""Embed an available CJK TrueType font; retain the portable CID fallback."""
import os
from pathlib import Path
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
def register_font():
candidates = [os.getenv('APP_EXPORT_FONT',''),
str(Path(os.getenv('WINDIR','C:/Windows'))/'Fonts/simsun.ttc'),
'/usr/share/fonts/truetype/arphic/uming.ttc']
for candidate in candidates:
if candidate and Path(candidate).is_file():
try:
pdfmetrics.registerFont(TTFont('NotesExportCJK',candidate,subfontIndex=0))
return 'NotesExportCJK', Path(candidate)
except Exception:
continue
pdfmetrics.registerFont(UnicodeCIDFont('STSong-Light'))
return 'STSong-Light', None
FONT, FONT_PATH = register_font()