Skip to content

Commit 92d84e6

Browse files
添加自定义字体功能
1 parent 4493c72 commit 92d84e6

12 files changed

Lines changed: 45 additions & 143 deletions

File tree

File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mizuki",
33
"type": "module",
4-
"version": "4.9.2",
4+
"version": "4.9.3",
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",
3.63 MB
Binary file not shown.

src/components/Footer.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
3-
import fs from "fs";
4-
import path from "path";
3+
import fs from "node:fs";
4+
import path from "node:path";
55
import { footerConfig, profileConfig } from "../config";
66
import { url } from "../utils/url-utils";
77
@@ -38,7 +38,7 @@ if (footerConfig.enable) {
3838
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href={url('sitemap-index.xml')}>Sitemap</a><br>
3939
Powered by
4040
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://astro.build">Astro</a> &
41-
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/matsuzaka-yuki/mizuki">Mizuki</a>&nbsp; Version <a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/matsuzaka-yuki/mizuki">4.9.2<br>
41+
<a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/matsuzaka-yuki/mizuki">Mizuki</a>&nbsp; Version <a class="transition link text-[var(--primary)] font-medium" target="_blank" href="https://github.com/matsuzaka-yuki/mizuki">4.9.3<br>
4242

4343

4444
</div>

src/config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { factory } from "typescript";
21
import type {
32
AnnouncementConfig,
43
CommentConfig,
@@ -31,6 +30,7 @@ export const siteConfig: SiteConfig = {
3130
hue: 210, // 主题色的默认色相,范围从 0 到 360。例如:红色:0,青色:200,蓝绿色:250,粉色:345
3231
fixed: false, // 对访问者隐藏主题色选择器
3332
},
33+
3434
translate: {
3535
enable: true, // 启用翻译功能
3636
service: "client.edge", // 使用 Edge 浏览器翻译服务
@@ -118,7 +118,7 @@ export const siteConfig: SiteConfig = {
118118
enable: true, // 启用目录功能
119119
depth: 3, // 目录深度,1-6,1 表示只显示 h1 标题,2 表示显示 h1 和 h2 标题,依此类推
120120
},
121-
generateOgImages: true, // 启用生成OpenGraph图片功能
121+
generateOgImages: false, // 启用生成OpenGraph图片功能,注意开启后要渲染很长时间,不建议本地调试的时候开启
122122
favicon: [
123123
// 留空以使用默认 favicon
124124
// {
@@ -127,6 +127,13 @@ export const siteConfig: SiteConfig = {
127127
// sizes: '32x32', // 可选,图标大小
128128
// }
129129
],
130+
131+
// 字体配置
132+
font: {
133+
zenMaruGothic: {
134+
enable: true, // 启用全局圆体
135+
},
136+
},
130137
};
131138
export const fullscreenWallpaperConfig: FullscreenWallpaperConfig = {
132139
enable: true, // 启用全屏壁纸功能,非Banner模式下生效

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const bannerOffset =
208208

209209

210210
</head>
211-
<body class=" min-h-screen " class:list={[{"lg:is-home": isHomePage, "enable-banner": enableBanner}]}
211+
<body class=" min-h-screen " class:list={[{"lg:is-home": isHomePage, "enable-banner": enableBanner, "zen-maru-gothic-enabled": siteConfig.font.zenMaruGothic.enable}]}
212212
data-overlayscrollbars-initialize
213213
>
214214
<!-- 页面顶部渐变高光效果 - 只在full和semifull模式下显示 -->

src/layouts/MainGridLayout.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ const transparentClass = shouldEnableTransparency
270270
<div class="w-4/5 lg:w-3/4 text-center mb-0">
271271
<div class="flex flex-col">
272272
{siteConfig.banner.homeText?.title && (
273-
<h1 class="banner-title text-6xl lg:text-8xl font-bold text-white drop-shadow-lg mb-2 lg:mb-4">
273+
<h1 class="banner-title text-6xl lg:text-8xl text-white drop-shadow-lg mb-2 lg:mb-4">
274274
{siteConfig.banner.homeText.title}
275275
</h1>
276276
)}
@@ -417,6 +417,7 @@ const transparentClass = shouldEnableTransparency
417417
.banner-title {
418418
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
419419
animation: fadeInUp 1s ease-out;
420+
font-weight: bold;
420421
}
421422

422423
.banner-subtitle {

src/pages/_frontmatter.json

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/pages/frontmatter.json

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/styles/main.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
/* 导入加密内容样式 */
99
@import './encrypted-content.css';
1010

11+
/* 导入 ZenMaruGothic-Medium 字体 */
12+
@font-face {
13+
font-family: 'ZenMaruGothic-Medium';
14+
src: url('/assets/font/ZenMaruGothic-Medium.ttf') format('truetype');
15+
font-weight: 500;
16+
font-display: swap;
17+
}
18+
19+
/* 导入 GenEiGothic 字体 */
20+
@font-face {
21+
font-family: "GenEiGothic";
22+
src: url("/assets/font/GenEiGothicP.ttf") format("truetype");
23+
font-weight: normal;
24+
font-display: swap;
25+
}
26+
1127
@tailwind base;
1228
@tailwind components;
1329
@tailwind utilities;
@@ -17,6 +33,11 @@ html {
1733
scroll-behavior: smooth;
1834
}
1935

36+
/* 当启用 ZenMaruGothic-Medium 字体时应用为全局字体 */
37+
.zen-maru-gothic-enabled {
38+
font-family: 'ZenMaruGothic-Medium', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
39+
}
40+
2041
/* 页面顶部渐变高光效果 */
2142
.top-gradient-highlight {
2243
position: fixed;

0 commit comments

Comments
 (0)