v0.20 alpha skill-driven python core

This commit is contained in:
kai
2026-05-06 16:26:41 +08:00
parent d1169646b8
commit db626f1d58
87 changed files with 5213 additions and 2865 deletions
+32
View File
@@ -0,0 +1,32 @@
"""Font resolution helpers for PDF rendering."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
@dataclass(frozen=True)
class QuartoFonts:
main_font: str
sans_font: str
requires_system_fonts: bool
def resolve_quarto_fonts(fonts_dir: Path) -> QuartoFonts:
"""Resolve Quarto font names.
Quarto/xelatex currently uses installed font family names. We still accept
fonts_dir so callers can validate/report environment state consistently.
"""
expected = [
fonts_dir / "SourceHanSerifSC-Regular.otf",
fonts_dir / "SourceHanSansSC-Bold.otf",
]
requires_system_fonts = not all(path.exists() for path in expected)
return QuartoFonts(
main_font="Source Han Serif CN",
sans_font="Source Han Sans CN",
requires_system_fonts=requires_system_fonts,
)