Convert from Homebrew Formulae to Casks for font installation

Formulae can't install to ~/Library/Fonts/ due to Homebrew sandboxing.
Casks have a built-in `font` artifact that handles this automatically.

- Replace Formula/ with Casks/ directory
- Rewrite generator to produce cask files instead of formulae
- Add .ttc (TrueType Collection) support
- Update all tests for cask format
- Update CLI and documentation
- Fonts with no installable files (TTF/OTF/TTC) are skipped

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Troutman 2026-03-07 21:38:59 -06:00
parent cb1918c30f
commit 76743cdc4d
No known key found for this signature in database
273 changed files with 2509 additions and 10048 deletions

View file

@ -1,14 +1,26 @@
"""Tests that a Formula file exists for every font."""
"""Tests that a Cask file exists for every font with installable files."""
import pytest
from tests.conftest import FORMULA_DIR, get_font_dir_names
from tests.conftest import CASKS_DIR, FONT_FILES_DIR, get_font_dir_names
INSTALLABLE_EXTS = (".ttf", ".otf", ".ttc")
def _has_installable_fonts(font_name: str) -> bool:
font_dir = FONT_FILES_DIR / font_name
for ext in INSTALLABLE_EXTS:
pattern = f"*{ext}"
if any((font_dir / "ttf").glob(pattern)) or any((font_dir / "otf").glob(pattern)):
return True
return False
@pytest.mark.parametrize("font_name", get_font_dir_names())
def test_formula_file_exists(font_name):
"""Formula/font-<name>.rb exists for each font folder."""
# font_name is e.g. "font-acrylic-hand"; formula file is font-acrylic-hand.rb
formula_path = FORMULA_DIR / f"{font_name}.rb"
assert formula_path.is_file(), (
f"Missing formula for {font_name}: expected {formula_path}"
def test_cask_file_exists(font_name):
"""Casks/font-<name>.rb exists for each font folder with installable fonts."""
if not _has_installable_fonts(font_name):
pytest.skip(f"{font_name} has no installable font files (TTF/OTF/TTC)")
cask_path = CASKS_DIR / f"{font_name}.rb"
assert cask_path.is_file(), (
f"Missing cask for {font_name}: expected {cask_path}"
)