WP-01: Self-Hosted Fonts #88

Closed
opened 2026-03-13 04:36:44 +00:00 by cal · 2 comments
Owner

Description

Replace Google Fonts CDN with locally embedded WOFF2 fonts. Eliminates ~0.3-0.5s network round-trip per render and removes external dependency.

Repo: database
Phase: 0 (Render Pipeline Optimization)
Dependencies: None (can run in parallel with WP-02)
Complexity: S

Current State

  • storage/templates/player_card.html lines 5-7: <link> tags to fonts.googleapis.com
  • storage/templates/style.html: References "Open Sans" and "Source Sans 3" font-families
  • Two fonts used: Open Sans (300, 400, 700) and Source Sans 3 (400, 700) — 5 WOFF2 files total

Implementation

  1. Download WOFF2 files for both fonts (5 files)
  2. Base64-encode each WOFF2 file
  3. Add @font-face declarations with base64 data URIs to style.html
  4. Remove the three <link> tags from player_card.html (lines 5-7)
  5. Visual diff: render the same card before/after and verify identical output

Files

  • Create: database/storage/fonts/ directory with raw WOFF2 files (source archive)
  • Modify: database/storage/templates/style.html — add @font-face declarations
  • Modify: database/storage/templates/player_card.html — remove <link> tags

Tests

  • Unit: style.html contains no fonts.googleapis.com references
  • Unit: player_card.html contains no <link> to external font CDNs
  • Unit: @font-face declarations present for all 5 font variants
  • Visual: rendered card is pixel-identical to pre-change output (manual check)

Acceptance Criteria

  1. No external network requests during card render
  2. All 5 font weights render correctly
  3. Card appearance unchanged

Plan reference: docs/prd-evolution/PHASE0_PROJECT_PLAN.md WP-01

## Description Replace Google Fonts CDN with locally embedded WOFF2 fonts. Eliminates ~0.3-0.5s network round-trip per render and removes external dependency. **Repo:** `database` **Phase:** 0 (Render Pipeline Optimization) **Dependencies:** None (can run in parallel with WP-02) **Complexity:** S ## Current State - `storage/templates/player_card.html` lines 5-7: `<link>` tags to `fonts.googleapis.com` - `storage/templates/style.html`: References `"Open Sans"` and `"Source Sans 3"` font-families - Two fonts used: Open Sans (300, 400, 700) and Source Sans 3 (400, 700) — 5 WOFF2 files total ## Implementation 1. Download WOFF2 files for both fonts (5 files) 2. Base64-encode each WOFF2 file 3. Add `@font-face` declarations with base64 data URIs to `style.html` 4. Remove the three `<link>` tags from `player_card.html` (lines 5-7) 5. Visual diff: render the same card before/after and verify identical output ## Files - **Create:** `database/storage/fonts/` directory with raw WOFF2 files (source archive) - **Modify:** `database/storage/templates/style.html` — add `@font-face` declarations - **Modify:** `database/storage/templates/player_card.html` — remove `<link>` tags ## Tests - [ ] Unit: `style.html` contains no `fonts.googleapis.com` references - [ ] Unit: `player_card.html` contains no `<link>` to external font CDNs - [ ] Unit: `@font-face` declarations present for all 5 font variants - [ ] Visual: rendered card is pixel-identical to pre-change output (manual check) ## Acceptance Criteria 1. No external network requests during card render 2. All 5 font weights render correctly 3. Card appearance unchanged **Plan reference:** `docs/prd-evolution/PHASE0_PROJECT_PLAN.md` WP-01
cal added this to the Card Evolution Phase 0 — Render Pipeline Optimization milestone 2026-03-13 04:37:35 +00:00
cal added the
evolution
phase-0
labels 2026-03-13 04:37:40 +00:00
Claude added the
ai-working
label 2026-03-13 06:01:25 +00:00
Claude removed the
ai-working
label 2026-03-13 06:04:06 +00:00
Collaborator

PR opened: #96

Approach: Base64-encoded all 5 WOFF2 files (Open Sans 300/400/700, Source Sans 3 400/700) directly into @font-face declarations at the top of style.html. Removed the 3 Google Fonts <link> tags from player_card.html. Source WOFF2 files were already present in storage/fonts/.

All 4 unit acceptance criteria verified before commit. Visual pixel-identical check requires manual render comparison.

PR opened: https://git.manticorum.com/cal/paper-dynasty-database/pulls/96 **Approach:** Base64-encoded all 5 WOFF2 files (Open Sans 300/400/700, Source Sans 3 400/700) directly into `@font-face` declarations at the top of `style.html`. Removed the 3 Google Fonts `<link>` tags from `player_card.html`. Source WOFF2 files were already present in `storage/fonts/`. All 4 unit acceptance criteria verified before commit. Visual pixel-identical check requires manual render comparison.
Claude added the
ai-pr-opened
label 2026-03-13 06:04:16 +00:00
Author
Owner

Completed. WOFF2 fonts embedded as base64 @font-face declarations in style.html, external Google Fonts CDN links removed from player_card.html. PR #96 merged via next-release. Zero external network requests during render.

**Completed.** WOFF2 fonts embedded as base64 `@font-face` declarations in `style.html`, external Google Fonts CDN links removed from `player_card.html`. PR #96 merged via next-release. Zero external network requests during render.
cal closed this issue 2026-03-16 19:48:28 +00:00
Sign in to join this conversation.
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-database#88
No description provided.