Update documentation and scripts for font addition process; introduce uv run add-font CLI command for streamlined font management. Enhance formula generation with improved class name formatting and validation steps. Remove outdated font formula files.

This commit is contained in:
Matt Troutman 2026-02-09 22:04:01 -06:00
parent 69d8156b09
commit 56b64d0b34
No known key found for this signature in database
266 changed files with 1187 additions and 8145 deletions

View file

@ -14,14 +14,18 @@ description: Use when working in this repository, when the user asks about fonts
## Rules
- **Do not edit `Formula/*.rb` by hand.** They are generated by `.fontfoldercleanup/create_homebrew_formula.py`.
- All font folders must use the `font-` prefix. Only `.ttf` in ttf/, `.otf` in otf/, web fonts (woff, woff2, eot, svg) in web/, everything else in other_files/.
- To add a font: add `font_files/font-<name>/`, run `cleanup_font_folders.py` then `create_homebrew_formula.py`.
- To add a font: run `uv run add-font <path_or_name>` (or add `font_files/font-<name>/`, run `cleanup_font_folders.py` then `create_homebrew_formula.py`). Validate with `uv run pytest tests/`.
## Scripts (Python 3, in `.fontfoldercleanup/`)
- **cleanup_font_folders.py** — Organizes a directory of font folders into ttf/, otf/, web/, other_files/. Run with `--path <dir>` (e.g. `font_files`).
- **create_homebrew_formula.py** — Generates `Formula/font-<name>.rb` for every `font-*` folder in `font_files/`.
## Scripts and CLI
- **add-font**`uv run add-font <path_or_name>`: add/update a font, runs cleanup + formula generator + tests. Optional: `uv tool install .` for global `add-font`.
- **cleanup_font_folders.py** (`.fontfoldercleanup/`) — Organizes font folders into ttf/, otf/, web/, other_files/. Run with `--path <dir>`.
- **create_homebrew_formula.py** (`.fontfoldercleanup/`) — Generates `Formula/font-<name>.rb` for every `font-*` folder in `font_files/`.
- **tests/**`uv run pytest tests/` validates every font (structure, formula exists, formula content).
## Quick commands (from repo root)
```bash
uv run add-font <path_or_name> # add or update a font
uv run pytest tests/ # run test suite
python3 .fontfoldercleanup/cleanup_font_folders.py --path font_files
python3 .fontfoldercleanup/create_homebrew_formula.py
```