diff --git a/README.md b/README.md index d3d9d7e..fed326c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ - 12 套内置配色 - 访客配色选择器 - 常规图标和像素图标切换 -- JetBrains Mono, 系统字体, 自定义字体和内置像素字体 +- 内置 JetBrains Mono, Hack 字体, 可切换 +- 可设置为访问者系统字体 +- 自定义字体 - 基础行高, 文章段落间距和文章元信息分隔符配置 - 首页公告打字效果 - 文章目录和目录展开状态配置 diff --git a/settings.yaml b/settings.yaml index aa69c73..a8c84bb 100644 --- a/settings.yaml +++ b/settings.yaml @@ -20,6 +20,16 @@ spec: - group: style label: 全局样式 formSchema: + - $formkit: select + label: 默认字体 + name: default_font + value: "JetBrains Mono" + options: + - label: "JetBrains Mono" + value: "JetBrains Mono" + - label: "Hack" + value: "Hack" + - $formkit: checkbox label: 启用全屏布局 name: fullscreen_layout diff --git a/src/fonts/hack-bold.woff2 b/src/fonts/hack-bold.woff2 new file mode 100644 index 0000000..1155477 Binary files /dev/null and b/src/fonts/hack-bold.woff2 differ diff --git a/src/fonts/hack-bolditalic.woff2 b/src/fonts/hack-bolditalic.woff2 new file mode 100644 index 0000000..46ff1c4 Binary files /dev/null and b/src/fonts/hack-bolditalic.woff2 differ diff --git a/src/fonts/hack-italic.woff2 b/src/fonts/hack-italic.woff2 new file mode 100644 index 0000000..1e7630c Binary files /dev/null and b/src/fonts/hack-italic.woff2 differ diff --git a/src/fonts/hack-regular.woff2 b/src/fonts/hack-regular.woff2 new file mode 100644 index 0000000..524465c Binary files /dev/null and b/src/fonts/hack-regular.woff2 differ diff --git a/src/styles/fonts.scss b/src/styles/fonts.scss index 406db98..b7f7523 100644 --- a/src/styles/fonts.scss +++ b/src/styles/fonts.scss @@ -10,4 +10,36 @@ url('../fonts/JetBrainsMono-Regular.woff2') format('woff2'); font-display: swap; font-style: normal; -} \ No newline at end of file +} + +@font-face { + font-family: 'Hack'; + src: url('../fonts/hack-regular.woff2?sha=3114f1256') format('woff2'); + font-weight: 400; + font-display: swap; + font-style: normal; +} + +@font-face { + font-family: 'Hack'; + src: url('../fonts/hack-bold.woff2?sha=3114f1256') format('woff2'); + font-weight: 700; + font-display: swap; + font-style: normal; +} + +@font-face { + font-family: 'Hack'; + src: url('../fonts/hack-italic.woff2?sha=3114f1256') format('woff2'); + font-weight: 400; + font-display: swap; + font-style: italic; +} + +@font-face { + font-family: 'Hack'; + src: url('../fonts/hack-bolditalic.woff2?sha=3114f1256') format('woff2'); + font-weight: 700; + font-display: swap; + font-style: italic; +} diff --git a/templates/layout.html b/templates/layout.html index bb26ae5..6cb4561 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -73,6 +73,11 @@ --style-theme-title-divider: [(${theme.config.style.title_divider_style})]; } +