From 9805f64da601767c4e77998350716f470bc8d915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=95=E5=B1=82=E7=94=A8=E6=88=B7?= Date: Tue, 21 Jun 2022 15:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=20CDN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/style.css | 11 +++++++---- js/main.js | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 28a6f1a..b897a17 100644 --- a/css/style.css +++ b/css/style.css @@ -9,18 +9,21 @@ GitHub:https://github.com/imsyy/home @font-face { font-family: "MiSans"; - src: url('../font/MiSans-Regular.subset.woff2') format('woff2'); - src: url('../font/MiSans-Regular.subset.ttf') format('truetype'); + font-style: normal; + font-weight: 400; + font-display: swap; + src: url('https://s-bj-2127-file.oss.dogecdn.com/font/MiSans-Regular.subset.woff2') format('woff2'); + /* src: url('https://s-bj-2127-file.oss.dogecdn.com/font/MiSans-Regular.subset.ttf') format('truetype'); */ } @font-face { font-family: "Pacifico-Regular"; - src: url('../font/Pacifico-Regular.ttf') format('truetype'); + src: url('https://s-bj-2127-file.oss.dogecdn.com/font/Pacifico-Regular.ttf') format('truetype'); } @font-face { font-family: "UnidreamLED"; - src: url('../font/UnidreamLED.ttf') format('truetype'); + src: url('https://s-bj-2127-file.oss.dogecdn.com/font/UnidreamLED.ttf') format('truetype'); } /*全局样式*/ diff --git a/js/main.js b/js/main.js index 5a83f27..911655e 100644 --- a/js/main.js +++ b/js/main.js @@ -47,12 +47,12 @@ window.addEventListener('load', function () { element.src = "./js/music.js"; document.body.appendChild(element); - //中文字体缓加载 + //中文字体缓加载-此处写入字体源文件 //先行加载简体中文子集,后续补全字集 - //由于压缩过后的中文字体仍旧过大,可转移至对象储存或 CDN 加载 + //由于压缩过后的中文字体仍旧过大,可转移至对象存储或 CDN 加载 const font = new FontFace( "MiSans", - "url(" + "../font/MiSans-Regular.woff2" + ")" + "url(" + "./font/MiSans-Regular.woff2" + ")" ); document.fonts.add(font);