"""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