Skip to content

Commit

Permalink
website: fix load font error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 2, 2024
1 parent d952b16 commit 19b1273
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 28 deletions.
4 changes: 2 additions & 2 deletions docs/art.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 艺术体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -2311,7 +2311,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/english.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 英文字体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -3872,7 +3872,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/handwriting.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 手绘体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -1021,7 +1021,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/hei.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 黑体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -2161,7 +2161,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -13066,7 +13066,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a> •
<a href="https://free-font.vercel.app" target="_blank">Vercel</a> •
Expand Down
4 changes: 2 additions & 2 deletions docs/kai.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 楷体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -811,7 +811,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/open-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 开源字体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -8582,7 +8582,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
11 changes: 6 additions & 5 deletions docs/preview.en.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/preview.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">
<link rel="stylesheet" type="text/css" href="css/preview.css?v=2.12.0">
</head>
<body>
<a href="https://github.com/jaywcjlove/free-font" target="_blank" class="github-corner">
Expand Down Expand Up @@ -134,15 +134,16 @@ <h2>数字预览</h2>
styleTag.id = 'dynamic-style';
document.head.appendChild(styleTag);
}
const fontCDN = `https://freefont.netlify.app/${fontUrl}`;
const fontFaceRule = `
@font-face { font-family: 'PreviewFont'; src: url('https://freefont.netlify.app/${fontUrl}') format('truetype');}
@font-face { font-family: 'PreviewFont'; src: url('${fontCDN}') format('truetype');}
main, main pre {
font-family: 'PreviewFont', sans-serif;
}
`;
styleTag.innerHTML = fontFaceRule;
// Define the font face
const font = new FontFace('PreviewFont', `url(${fontUrl})`);
const font = new FontFace('PreviewFont', `url(${fontCDN})`);
const statusElement = document.getElementById('font-status');
document.fonts.ready.then((fontFaceSet) => {
if (fontFaceSet.check('1em PreviewFont')) {
Expand All @@ -166,7 +167,7 @@ <h2>数字预览</h2>
};
</script>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
11 changes: 6 additions & 5 deletions docs/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/preview.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">
<link rel="stylesheet" type="text/css" href="css/preview.css?v=2.12.0">
</head>
<body>
<a href="https://github.com/jaywcjlove/free-font" target="_blank" class="github-corner">
Expand Down Expand Up @@ -146,15 +146,16 @@ <h2>数字预览</h2>
styleTag.id = 'dynamic-style';
document.head.appendChild(styleTag);
}
const fontCDN = `https://freefont.netlify.app/${fontUrl}`;
const fontFaceRule = `
@font-face { font-family: 'PreviewFont'; src: url('https://freefont.netlify.app/${fontUrl}') format('truetype');}
@font-face { font-family: 'PreviewFont'; src: url('${fontCDN}') format('truetype');}
main, main pre {
font-family: 'PreviewFont', sans-serif;
}
`;
styleTag.innerHTML = fontFaceRule;
// Define the font face
const font = new FontFace('PreviewFont', `url(${fontUrl})`);
const font = new FontFace('PreviewFont', `url(${fontCDN})`);
const statusElement = document.getElementById('font-status');
document.fonts.ready.then((fontFaceSet) => {
if (fontFaceSet.check('1em PreviewFont')) {
Expand All @@ -178,7 +179,7 @@ <h2>数字预览</h2>
};
</script>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/song.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<meta name="twitter:description" content="Free Font - 收录商用免费字体,包括汉字和英文字体,提供免费下载和使用。">
<meta name="twitter:image" content="https://wangchujiang.com/icons/banner.jpeg">
<title>Free Font 宋体 - 收录商用免费字体(汉字英文字体)</title>
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.11.0">
<link rel="stylesheet" type="text/css" href="css/main.css?v=2.12.0">

</head>
<body>
Expand Down Expand Up @@ -1306,7 +1306,7 @@ <h1><a href="./index.html">商用免费字体</a></h1>

</main>
<footer class="footer">
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.11.0</sup><br />
您可以在<a href="https://github.com/jaywcjlove/free-font" target="_blank">这里</a>提交商用免费字体 <sup>2.12.0</sup><br />
<div>
<a href="https://raw.githack.com/jaywcjlove/free-font/main/docs/index.html" target="_blank">Githack</a>
<a href="https://free-font.vercel.app" target="_blank">Vercel</a>
Expand Down
5 changes: 3 additions & 2 deletions templates/_partial/preview_scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@
styleTag.id = 'dynamic-style';
document.head.appendChild(styleTag);
}
const fontCDN = `https://freefont.netlify.app/${fontUrl}`;
const fontFaceRule = `
@font-face { font-family: 'PreviewFont'; src: url('https://freefont.netlify.app/${fontUrl}') format('truetype');}
@font-face { font-family: 'PreviewFont'; src: url('${fontCDN}') format('truetype');}
main, main pre {
font-family: 'PreviewFont', sans-serif;
}
`;
styleTag.innerHTML = fontFaceRule;
// Define the font face
const font = new FontFace('PreviewFont', `url(${fontUrl})`);
const font = new FontFace('PreviewFont', `url(${fontCDN})`);
const statusElement = document.getElementById('font-status');
document.fonts.ready.then((fontFaceSet) => {
if (fontFaceSet.check('1em PreviewFont')) {
Expand Down

0 comments on commit 19b1273

Please sign in to comment.