various fix
This commit is contained in:
21
backend/app/algo_host/cjk_font.py
Normal file
21
backend/app/algo_host/cjk_font.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Resolve a CJK-capable font for offline visualization subprocesses."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Keep in sync with algorithm_subprocesses/5.15/visualize_result_video.py
|
||||
CJK_FONT_CANDIDATES: tuple[Path, ...] = (
|
||||
Path("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"),
|
||||
Path("/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc"),
|
||||
Path("/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttc"),
|
||||
Path("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"),
|
||||
Path("/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc"),
|
||||
)
|
||||
|
||||
|
||||
def resolve_cjk_font_path() -> Path | None:
|
||||
for candidate in CJK_FONT_CANDIDATES:
|
||||
if candidate.is_file():
|
||||
return candidate.resolve()
|
||||
return None
|
||||
Reference in New Issue
Block a user