Skip to content

refactor(fonts): overhaul native:font with Google catalog metadata and adds to config file - #31

Merged
shanerbaner82 merged 4 commits into
NativePHP:mainfrom
dr-codswallop:refactor(fonts)-inject-font-to-config
Aug 3, 2026
Merged

refactor(fonts): overhaul native:font with Google catalog metadata and adds to config file#31
shanerbaner82 merged 4 commits into
NativePHP:mainfrom
dr-codswallop:refactor(fonts)-inject-font-to-config

Conversation

@dr-codswallop

@dr-codswallop dr-codswallop commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Replaces the previous approach with a multi-step interactive fuzzy search of Google Fonts metadata catalog https://fonts.google.com/metadata/fonts (no API key needed)

image

Key changes:

  • Fetches available families & styles from the metadata feed (cached for 24h)
  • Interactive family fuzzy search and style multiselect utilizing more Laravel Prompts
  • Set font as default, or defines custom keys for other fonts - both written to the config file.
  • --reset flag to clear downloaded fonts and restore fonts.default to System
  • --weights/--italic flags removed (covered in interactive flow)
  • --clear-cache added to force refresh of Google Fonts catalog,
  • --force overwrites existing font files with the same name
  • Atomic font file writes (stage → rename) with rollback on failure
  • GoogleFonts gains catalog parsing, alias key helpers, findFontsBlock, setFontAlias, resetFontsBlock, file I/O utilities, and TTF magic-byte validation
  • Shows running filesize totals of of all dowloaded fonts
  • Unit tests covering all new helpers

Example usage:
php artisan native:font starts multi-step interactive font chooser
php artisan native:font Inter finds Inter font and offers styles
php artisan native:font --reset deletes font files from resources/fonts and resets font config to 'default' => 'System'

dr-codswallop and others added 4 commits August 2, 2026 18:18
Replaces the previous approach with a single-family interactive workflow powered by the Google Fonts metadata catalog (fonts.google.com/metadata/fonts).

Key changes:
- Fetch available styles from the metadata API (cached 24h) instead of guessing from user flags
- Interactive family search and style multiselect via Laravel Prompts
- `--reset` flag to clear bundled fonts and restore `fonts.default` to `System`
- `--clear-cache`, `--force` flags; `--weights`/`--italic` removed
- Atomic font file writes (stage → rename) with rollback on failure
- `GoogleFonts` gains catalog parsing, alias key helpers, `findFontsBlock`, `setFontAlias`, `resetFontsBlock`, file I/O utilities, and TTF magic-byte validation
- Comprehensive unit tests covering all new helpers
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shanerbaner82
shanerbaner82 merged commit 89ced3d into NativePHP:main Aug 3, 2026
3 checks passed
@dr-codswallop
dr-codswallop deleted the refactor(fonts)-inject-font-to-config branch August 19, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants