font Serve Vazirmatn WOFF2 with explicit Content-Type headers
Test and publish / verify (push) Successful in 3m16s

Switch Vazirmatn font-face from TTF-only to WOFF2 to halve the
font payload (~50 KB vs ~105 KB per weight). Add a staticHandler
middleware that injects font/ttf and font/woff2 Content-Type headers
so browsers don't reject them as application/octet-stream.
This commit is contained in:
2026-08-06 17:39:54 +03:30
parent f6577a24e6
commit 7e8b7c4343
3 changed files with 64 additions and 10 deletions
+12 -9
View File
@@ -1,10 +1,13 @@
/* Vazirmatn faces downloaded from Google Fonts and bundled for offline use. */
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-100.ttf') format('truetype'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-200.ttf') format('truetype'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-300.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-400.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-500.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-600.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-700.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-800.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-900.ttf') format('truetype'); font-weight: 900; font-style: normal; font-display: swap; }
/* Only WOFF2 referenced — all named-weight WOFF2 files exist;
numeric-weight TTF fallbacks exist but the named weights
(Regular/Bold/etc.) don't have TTF versions on disk. */
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Thin.woff2') format('woff2'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-ExtraLight.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Light.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/webfonts/Vazirmatn-Black.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }