| """Map workbook location / stem label to body-text font preset.""" | |
| from __future__ import annotations | |
| from pathlib import Path | |
| # data/<cc>/… — two-letter folder names from legex scrapers | |
| FONT_BY_CC: dict[str, str] = { | |
| "kr": "han_k", | |
| "in": "deva", | |
| "am": "arm", | |
| "ge": "geo", | |
| } | |
| # Goldenset_* stem label (ohne Präfix), z. B. aus älteren Drive-Layouts | |
| FOLDER_FONT_BY_STEM: dict[str, str] = { | |
| "China": "han_sc", | |
| "South_Korea": "han_k", | |
| "Taiwan": "han_tc", | |
| "Hong_Kong": "han_tc", | |
| "India": "deva", | |
| "Armenia": "arm", | |
| "Georgia": "geo", | |
| } | |
| def font_key_for_workbook(xlsx: Path) -> str: | |
| cc = xlsx.parent.name | |
| if cc in FONT_BY_CC: | |
| return FONT_BY_CC[cc] | |
| stem_label = xlsx.stem.removeprefix("Goldenset_") | |
| return FOLDER_FONT_BY_STEM.get(stem_label, "default") | |