From 829288ddec83b1733fed99b3dccf1ae5f2f2dbb7 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sat, 25 Jul 2026 03:10:25 +0530 Subject: [PATCH] docs: declare the vazirmatn face manually and pin its version The farsi docs now declare their own @font-face pointing at the version-pinned woff2 from jsdelivr instead of pulling Google Fonts' stylesheet. The face is range-gated to Google Fonts' arabic subset ranges plus guillemets and ellipsis and sits before Inter in the stack, so persian punctuation renders in Vazirmatn while latin keeps rendering from the locally served Inter. Co-Authored-By: Claude Fable 5 --- docs/.vitepress/theme/styles.css | 23 ++++++++++++++++++++++- docs/fa/config.ts | 9 +++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/.vitepress/theme/styles.css b/docs/.vitepress/theme/styles.css index 113a4eadc..54c5d4248 100644 --- a/docs/.vitepress/theme/styles.css +++ b/docs/.vitepress/theme/styles.css @@ -1,6 +1,27 @@ +@font-face { + font-family: 'Vazirmatn'; + font-style: normal; + font-weight: 100 900; + font-display: swap; + src: url('https://cdn.jsdelivr.net/npm/vazirmatn@33.0.3/fonts/webfonts/Vazirmatn%5Bwght%5D.woff2') + format('woff2'); + /* google fonts' arabic range, plus guillemets and ellipsis so persian + punctuation renders in vazirmatn instead of inter */ + unicode-range: + U+00AB, U+00BB, U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, + U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+2026, U+204F, U+2E41, + U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, + U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, + U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, + U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, + U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, + U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, + U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; +} + :root:where(:lang(fa)) { --vp-font-family-base: - 'Vazirmatn', 'Inter', ui-sans-serif, system-ui, sans-serif, + 'Vazirmatn', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; } diff --git a/docs/fa/config.ts b/docs/fa/config.ts index c8deee05e..8e2f899de 100644 --- a/docs/fa/config.ts +++ b/docs/fa/config.ts @@ -7,11 +7,12 @@ const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ description: 'ژنراتور استاتیک وب‌سایت با Vite و Vue', - // prettier-ignore head: [ - ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], - ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], - ['link', { href: 'https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap', rel: 'stylesheet' }], + [ + 'link', + // for the vazirmatn font-face defined in .vitepress/theme/styles.css + { rel: 'preconnect', href: 'https://cdn.jsdelivr.net', crossorigin: '' } + ] ], themeConfig: {