48 lines
1.3 KiB
Markdown
48 lines
1.3 KiB
Markdown
|
|
# Font Files
|
||
|
|
|
||
|
|
This directory contains TrueType Font (TTF) files used for server-side image generation with PHP GD.
|
||
|
|
|
||
|
|
## Carlito-Bold.ttf
|
||
|
|
|
||
|
|
- **Font:** Carlito Bold
|
||
|
|
- **Source:** Google Fonts (Carlito Project)
|
||
|
|
- **License:** SIL Open Font License 1.1
|
||
|
|
- **URL:** https://github.com/googlefonts/carlito
|
||
|
|
- **Usage:** Used by `BattleCardGenerator` service for generating battle card OG images
|
||
|
|
- **Note:** Carlito is a metric-compatible font family to Calibri
|
||
|
|
|
||
|
|
## Why TTF instead of @fontsource?
|
||
|
|
|
||
|
|
The `@fontsource` npm packages provide WOFF/WOFF2 files for web usage, but PHP's GD library (`imagettftext()`) requires TrueType Font (TTF) files for server-side text rendering.
|
||
|
|
|
||
|
|
## Alternatives
|
||
|
|
|
||
|
|
If you want to use a different font:
|
||
|
|
|
||
|
|
1. **Install system fonts:**
|
||
|
|
```bash
|
||
|
|
# Find available TTF fonts
|
||
|
|
find /usr/share/fonts -name "*.ttf" -type f
|
||
|
|
|
||
|
|
# Copy desired font
|
||
|
|
cp /usr/share/fonts/path/to/Font-Bold.ttf assets/fonts/
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **Download from Google Fonts:**
|
||
|
|
```bash
|
||
|
|
# Visit https://fonts.google.com
|
||
|
|
# Download the font family
|
||
|
|
# Extract the TTF file from the zip
|
||
|
|
```
|
||
|
|
|
||
|
|
3. **Update service configuration:**
|
||
|
|
Edit `config/services.yaml` and update the `$fontPath` parameter.
|
||
|
|
|
||
|
|
## Cache Clearing
|
||
|
|
|
||
|
|
After changing fonts, clear the OG image cache:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
rm -rf var/og-cache/*
|
||
|
|
```
|