Fonts#
Default font management.
Changed in version 3.3.0: Single home for font assets so library callers generating PDF reports can ensure the bundled Assistant fonts are present on disk without instantiating CLI machinery. Owns the font directory, the default font paths, the presence check, the download, and asset copying.
- get_font_paths(font_dir: Path = PosixPath('/home/docs/Library/Application Support/Patcher/fonts')) dict[str, Path][source]#
On-disk paths for the bundled Assistant fonts within
font_dir.
- fonts_present(font_dir: Path = PosixPath('/home/docs/Library/Application Support/Patcher/fonts')) bool[source]#
True if both Assistant fonts already exist in
font_dir.
- copy_asset(src: Path, dest: Path) None[source]#
Copy a user-provided asset (custom font, branding logo) into place.
- ensure_default_fonts(target_dir: Path = PosixPath('/home/docs/Library/Application Support/Patcher/fonts')) dict[str, Path][source]#
Ensure the default Assistant fonts (Regular and Bold) live in
target_dir.Idempotent. Fonts already present on disk are not re-downloaded. Uses
httpx.get()configured with atruststore.SSLContextso the same OS-trust-store TLS handling that powersBaseAPIClientapplies here too (corporate-CA proxies, etc.).- Parameters:
target_dir (Path) – Directory to drop the
.ttffiles into. Created withparents=Trueif missing.- Returns:
Mapping
{"regular": Path, "bold": Path}of the on-disk font files.- Return type:
- Raises:
PatcherError – If a download or write fails.