From 9f8ad71d8545c625997bb73489cf8d2bac753c4e Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Tue, 25 Nov 2025 21:27:27 +0100 Subject: [PATCH] feat: add local Inter font fallback for offline support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add self-hosted Inter font files to ensure application works offline and reduce dependency on external CDN (Google Fonts). Problem: - Google Fonts (fonts.googleapis.com) fails when no internet connection - Application shows NS_ERROR_UNKNOWN_HOST errors - Font rendering falls back to system fonts, breaking design consistency Solution: - Download Inter font files (weights 400, 500, 600, 700, 800) from Google Fonts - Host locally in static/shared/fonts/inter/ - Create inter.css with @font-face declarations - Update all templates to load local fonts FIRST, then Google Fonts as fallback Files Added: - static/shared/fonts/inter.css (font-face declarations) - static/shared/fonts/inter/inter-400.ttf (318KB - Regular) - static/shared/fonts/inter/inter-500.ttf (318KB - Medium) - static/shared/fonts/inter/inter-600.ttf (319KB - Semi-bold) - static/shared/fonts/inter/inter-700.ttf (319KB - Bold) - static/shared/fonts/inter/inter-800.ttf (320KB - Extra-bold) Templates Updated (7 files): - app/templates/admin/base.html - app/templates/admin/login.html - app/templates/vendor/base.html - app/templates/vendor/login.html - app/templates/shop/account/login.html - app/templates/shop/account/register.html - app/templates/shop/account/forgot-password.html Font Loading Strategy: 1. Load local fonts first (always available, fast) 2. Load Google Fonts second (better quality when online) 3. Browser uses first available source Example change: Before: After: Benefits: - ✅ Works offline without font loading errors - ✅ Faster initial load (local fonts, no DNS lookup) - ✅ Reduced external dependencies - ✅ Consistent typography even when CDN is down - ✅ Still uses Google Fonts when available (higher quality) - ✅ Total size: ~1.6MB (reasonable for 5 font weights) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/templates/admin/base.html | 3 +- app/templates/admin/login.html | 2 + .../shop/account/forgot-password.html | 2 + app/templates/shop/account/login.html | 2 + app/templates/shop/account/register.html | 2 + app/templates/vendor/base.html | 3 +- app/templates/vendor/login.html | 2 + static/shared/fonts/inter.css | 46 ++++++++++++++++++ static/shared/fonts/inter/inter-400.ttf | Bin 0 -> 324820 bytes static/shared/fonts/inter/inter-500.ttf | Bin 0 -> 325304 bytes static/shared/fonts/inter/inter-600.ttf | Bin 0 -> 326048 bytes static/shared/fonts/inter/inter-700.ttf | Bin 0 -> 326468 bytes static/shared/fonts/inter/inter-800.ttf | Bin 0 -> 327324 bytes 13 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 static/shared/fonts/inter.css create mode 100644 static/shared/fonts/inter/inter-400.ttf create mode 100644 static/shared/fonts/inter/inter-500.ttf create mode 100644 static/shared/fonts/inter/inter-600.ttf create mode 100644 static/shared/fonts/inter/inter-700.ttf create mode 100644 static/shared/fonts/inter/inter-800.ttf diff --git a/app/templates/admin/base.html b/app/templates/admin/base.html index a9a678d5..3cf5e339 100644 --- a/app/templates/admin/base.html +++ b/app/templates/admin/base.html @@ -6,7 +6,8 @@ {% block title %}Admin Panel{% endblock %} - Multi-Tenant Platform - + + diff --git a/app/templates/admin/login.html b/app/templates/admin/login.html index f5aad69e..313a392d 100644 --- a/app/templates/admin/login.html +++ b/app/templates/admin/login.html @@ -5,6 +5,8 @@ Admin Login - Multi-Tenant Platform + +