Przeglądaj źródła

【新增,字体】添加 MapleMono-NF-CN 字体支持

在项目中引入 `MapleMono-NF-CN` 字体,优化代码和界面的字体显示效果。
该字体已应用到全局文本元素,并通过 CSS 自定义字体实现加载。
同时更新中英文 README 文档,说明新增字体特性。
PJ568 1 rok temu
rodzic
commit
456eeb62fc

+ 6 - 4
README.en.md

@@ -9,6 +9,7 @@
 - Replace icons and title with SwayBien icons and title;
 - Replace default user avatar with matchstick man avatar;
 - Mirror repository sync button;
+- `MapleMono-NF-CN` font;
 - Dark mode and toggle button supported by Darkmode.js;
 - Page preloading feature supported by instant.page.
 
@@ -47,7 +48,8 @@
 
 #### Projects
 
-|     Name     | License                                | Address                                                                                    |
-| :----------: | :------------------------------------- | :----------------------------------------------------------------------------------------- |
-| darkmode.js  | [MIT license](https://mit-license.org) | [Github](https://github.com/sandoche/Darkmode.js)、[Website](https://darkmodejs.learn.uno) |
-| instant.page | [MIT license](https://mit-license.org) | [Github](https://github.com/instantpage/instant.page)、[Website](https://instant.page)     |
+|     Name     | License                                                                                       | Address                                                                                    |
+| :----------: | :-------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |
+| darkmode.js  | [MIT license](https://mit-license.org)                                                        | [Github](https://github.com/sandoche/Darkmode.js)、[Website](https://darkmodejs.learn.uno) |
+| instant.page | [MIT license](https://mit-license.org)                                                        | [Github](https://github.com/instantpage/instant.page)、[Website](https://instant.page)     |
+|  maple-font  | [OFL-1.1 license](https://github.com/subframe7536/maple-font/raw/refs/heads/variable/OFL.txt) | [Github](https://github.com/subframe7536/maple-font)、[Website](https://font.subf.dev/)    |

+ 6 - 4
README.md

@@ -9,6 +9,7 @@
 - 替换图标和标题为随变图标和标题;
 - 替换默认用户头像为火柴人头像;
 - 镜像仓库快速同步按钮;
+- `MapleMono-NF-CN` 字体;
 - 基于 Darkmode.js 的深色模式和切换按钮;
 - 基于 instant.page 的页面预加载功能。
 
@@ -47,7 +48,8 @@
 
 #### 项目
 
-|     名称     | 协议                                   | 地址                                                                                       |
-| :----------: | :------------------------------------- | :----------------------------------------------------------------------------------------- |
-| darkmode.js  | [MIT license](https://mit-license.org) | [Github](https://github.com/sandoche/Darkmode.js)、[Website](https://darkmodejs.learn.uno) |
-| instant.page | [MIT license](https://mit-license.org) | [Github](https://github.com/instantpage/instant.page)、[Website](https://instant.page)     |
+|     名称     | 协议                                                                                          | 地址                                                                                       |
+| :----------: | :-------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |
+| darkmode.js  | [MIT license](https://mit-license.org)                                                        | [Github](https://github.com/sandoche/Darkmode.js)、[Website](https://darkmodejs.learn.uno) |
+| instant.page | [MIT license](https://mit-license.org)                                                        | [Github](https://github.com/instantpage/instant.page)、[Website](https://instant.page)     |
+|  maple-font  | [OFL-1.1 license](https://github.com/subframe7536/maple-font/raw/refs/heads/variable/OFL.txt) | [Github](https://github.com/subframe7536/maple-font)、[Website](https://font.subf.dev/)    |

+ 13 - 0
public/css/swaybien.css

@@ -23,3 +23,16 @@
 swb-hide {
   display: none;
 }
+/* 字体 */
+:root,
+html,
+body,
+button,
+input,
+select,
+textarea,
+code,
+pre {
+  font-family: "Maple Mono NF CN", "Maple Mono CN", Consolas, Liberation Mono,
+    Menlo, monospace;
+}

BIN
public/fonts/MapleMono-NF-CN-Medium.ttf


+ 6 - 0
templates/base/head.tmpl

@@ -62,6 +62,12 @@
 	<link rel="stylesheet" href="{{AppSubURL}}/css/semantic-2.4.2.min.css">
 	<link rel="stylesheet" href="{{AppSubURL}}/css/gogs.min.css?v={{BuildCommit}}">
 	<!-- SwayBien Stylesheet -->
+	<style>
+		@font-face {
+			font-family: "Maple Mono NF CN";
+			src: url("{{AppSubURL}}fonts/MapleMono-NF-CN-Medium.ttf") format("truetype");
+		}
+	</style>
 	<link rel="stylesheet" href="{{AppSubURL}}/css/swaybien.css">
 	<noscript>
 		<style>