This is an automated email from the ASF dual-hosted git repository.

jeffreyh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 58e3c897c90 Load font files locally to avoid font loading failure 
caused by CSP (#1966)
58e3c897c90 is described below

commit 58e3c897c90a0e35f24a681994d2fb77b7471f9d
Author: yangon <2689991...@qq.com>
AuthorDate: Wed Feb 5 18:02:02 2025 +0800

    Load font files locally to avoid font loading failure caused by CSP (#1966)
---
 docusaurus.config.js                          |  24 ------------------------
 src/scss/_variables.scss                      |  10 ----------
 src/scss/custom.scss                          |  12 +++++++++++-
 static/fonts/Inter-VariableFont_opsz,wght.ttf | Bin 0 -> 874708 bytes
 static/fonts/NotoSansSC-VariableFont_wght.ttf | Bin 0 -> 17805476 bytes
 5 files changed, 11 insertions(+), 35 deletions(-)

diff --git a/docusaurus.config.js b/docusaurus.config.js
index 0f33bc747fe..0eb5fa3f0a5 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -61,30 +61,6 @@ const config = {
         },
     },
     scripts: ['/js/custom-script.js'],
-    headTags: [
-        {
-            tagName: 'link',
-            attributes: {
-                rel: 'preconnect',
-                href: 'https://fonts.googleapis.com',
-            },
-        },
-        {
-            tagName: 'link',
-            attributes: {
-                rel: 'preconnect',
-                href: 'https://fonts.gstatic.com',
-                crossorigin: 'anonymous',
-            },
-        },
-        {
-            tagName: 'link',
-            attributes: {
-                href: 
'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap',
-                rel: 'stylesheet',
-            },
-        },
-    ],
     stylesheets: [
         // 
'https://cdn-font.hyperos.mi.com/font/css?family=MiSans:100,200,300,400,450,500,600,650,700,900:Chinese_Simplify,Latin&display=swap',
         // 
'https://cdn-font.hyperos.mi.com/font/css?family=MiSans_Latin:100,200,300,400,450,500,600,650,700,900:Latin&display=swap',
diff --git a/src/scss/_variables.scss b/src/scss/_variables.scss
index bd4837b3d94..52416125d31 100644
--- a/src/scss/_variables.scss
+++ b/src/scss/_variables.scss
@@ -1,13 +1,3 @@
-html[lang='zh-Hans-CN'] {
-    --ifm-font-family-base: 'MiSans', 'Source Sans Pro', 'Helvetica Neue', 
Helvetica, Arial, sans-serif;
-    font-family: 'MiSans', 'Source Sans Pro', 'Helvetica Neue', Helvetica, 
Arial, sans-serif;
-}
-
-html[lang='en-US'] {
-    --ifm-font-family-base: 'MiSans Latin', 'Source Sans Pro', 'Helvetica 
Neue', Helvetica, Arial, sans-serif;
-    font-family: 'MiSans Latin', 'Source Sans Pro', 'Helvetica Neue', 
Helvetica, Arial, sans-serif;
-}
-
 :root {
     --ifm-color-primary: #444fd9;
     --ifm-color-primary-dark: #2c39d4;
diff --git a/src/scss/custom.scss b/src/scss/custom.scss
index 31adcc461b7..8af2fb0b67b 100644
--- a/src/scss/custom.scss
+++ b/src/scss/custom.scss
@@ -20,6 +20,16 @@
 @include meta.load-css('components/toc.scss');
 @include meta.load-css('common');
 
+@font-face {
+    font-family: 'Inter';
+    src: url('/fonts/Inter-VariableFont_opsz,wght.ttf');
+}
+
+@font-face {
+    font-family: 'Noto Sans';
+    src: url('/fonts/NotoSansSC-VariableFont_wght.ttf');
+}
+
 @layer utilities {
     .transition-slide {
         @apply inline-block transform transition-transform duration-300 
hover:translate-x-1 group-hover:translate-x-1;
@@ -53,7 +63,7 @@ html[lang='en-US'] {
 // }
 .markdown :where(p, h1, h2, h3, h4, h5, h6, li, blockquote) {
     font-family: var(--font-family-base);
-    color: #1F1F26;
+    color: #1f1f26;
 }
 
 body {
diff --git a/static/fonts/Inter-VariableFont_opsz,wght.ttf 
b/static/fonts/Inter-VariableFont_opsz,wght.ttf
new file mode 100644
index 00000000000..e31b51e3e93
Binary files /dev/null and b/static/fonts/Inter-VariableFont_opsz,wght.ttf 
differ
diff --git a/static/fonts/NotoSansSC-VariableFont_wght.ttf 
b/static/fonts/NotoSansSC-VariableFont_wght.ttf
new file mode 100644
index 00000000000..4e0c62e2789
Binary files /dev/null and b/static/fonts/NotoSansSC-VariableFont_wght.ttf 
differ


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to