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.

Parameters:

font_dir (Path)

Return type:

dict[str, Path]

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.

Parameters:

font_dir (Path)

Return type:

bool

copy_asset(src: Path, dest: Path) None[source]#

Copy a user-provided asset (custom font, branding logo) into place.

Parameters:
Return type:

None

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 a truststore.SSLContext so the same OS-trust-store TLS handling that powers BaseAPIClient applies here too (corporate-CA proxies, etc.).

Parameters:

target_dir (Path) – Directory to drop the .ttf files into. Created with parents=True if missing.

Returns:

Mapping {"regular": Path, "bold": Path} of the on-disk font files.

Return type:

dict[str, Path]

Raises:

PatcherError – If a download or write fails.