Skip to content

Commit 56b178c

Browse files
committed
修改excalidraw字体以支持中文, 添加沐瑶手写字体和字体声明
1 parent b1a2782 commit 56b178c

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

2.trans.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,6 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
827827
]
828828
replace_in_file(file_path, translation)
829829

830-
831830
file_path = 'src/public/app/dialogs/options/password.js'
832831
translation = [
833832
'>{{click here to reset it}}<',
@@ -846,7 +845,6 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
846845
]
847846
replace_in_file(file_path, translation)
848847

849-
850848
file_path = 'src/public/app/dialogs/options/shortcuts.js'
851849
translation = [
852850
'>{{Keyboard shortcuts}}<',
@@ -2883,7 +2881,6 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
28832881
replace_in_file(file_path, translation)
28842882
replace_in_file(file_path, translation, TARGET_PATH)
28852883

2886-
28872884
# 0.52
28882885
# 使用 Excalidraw 内置的语言文件
28892886
# use Excalidraw built-in language file
@@ -2900,7 +2897,6 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
29002897
with open(file_full_path, 'w') as f:
29012898
f.write(content)
29022899

2903-
29042900
# 应用补丁
29052901
# apply patch
29062902
os.chdir(BASE_PATH)
@@ -2934,7 +2930,14 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
29342930
# ckeditor
29352931
src_path = f'{CLIENT_PATH}resources/app/libraries/ckeditor/ckeditor.js'
29362932
dest_path = f'{PATCH_FOLDER}/libraries/ckeditor/ckeditor.js'
2937-
os.makedirs(os.path.dirname(dest_path), exist_ok = True)
2933+
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
2934+
shutil.copy(src_path, dest_path)
2935+
2936+
# excalidraw 自定义字体
2937+
# excalidraw custom font
2938+
src_path = f'{script_path}/font/muyao-shouxie.ttf'
2939+
dest_path = f'{PATCH_FOLDER}/node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/Virgil.woff2'
2940+
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
29382941
shutil.copy(src_path, dest_path)
29392942

29402943
if LANG == 'cn':
@@ -2947,7 +2950,7 @@ def replace_in_file(file_path, translation, base_path=BASE_PATH):
29472950
os.system('cd demo-cn && 7z -scsutf-8 a demo-cn.zip ./* && mv demo-cn.zip ../')
29482951
src_path = f'demo-cn.zip'
29492952
dest_path = f'{PATCH_FOLDER}/db/demo.zip'
2950-
os.makedirs(os.path.dirname(dest_path), exist_ok = True)
2953+
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
29512954
shutil.copy(src_path, dest_path)
29522955

29532956
if missing_files:

README_CN.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Trilium Notes 交流qq群 686232370
4545
* [前端js报错](#前端js报错)
4646
* [第三方主题不生效](#第三方主题不生效)
4747
* [初始化慢,同步数据慢](#初始化慢同步数据慢)
48+
* [关于本项目使用的字体](#关于本项目使用的字体)
4849
* [限制](#限制)
4950
* [Stargazers 数据](#stargazers-数据)
5051
* [捐赠](#捐赠)
@@ -247,6 +248,16 @@ const notes = await api.runOnBackend(async () => {
247248
如果是0.47升级上来,同步数据可能会特别慢。尝试直接把客户端的数据库移走,重新初始化客户端数据会快一点。
248249

249250

251+
---
252+
# 关于本项目使用的字体
253+
254+
本项目使用的字体文件为免费字体.
255+
256+
`font/muyao-shouxie.ttf` 沐瑶随心手写体来自 [这里](https://www.maoken.com/freefonts/1323.html)
257+
`font/muyao-softbrush.ttf` 沐瑶软笔手写体 [这里](https://www.maoken.com/freefonts/1309.html)
258+
259+
感谢 [https://www.zcool.com.cn/u/402511](https://www.zcool.com.cn/u/402511) 发布的这两款免费字体!
260+
250261
---
251262
# 限制
252263
Trilium Notes的文字是硬编码的, 所以没法切换语言.

font/muyao-shouxie.ttf

3.36 MB
Binary file not shown.

font/muyao-softbrush.ttf

4.32 MB
Binary file not shown.

settings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44

55
# 路径结尾的斜杠不能省略
66
# ending slash in folders can NOT be omitted
7-
7+
import os
88
import platform
99

10+
script_path = os.path.dirname(os.path.abspath(__file__))
11+
1012
DEBUG = False
1113
# DEBUG = False
1214

15+
# excalidraw 自定义字体
16+
# excalidraw custom font
17+
excalidraw_font = f'{script_path}/font/muyao-shouxie.ttf'
18+
1319
if platform.system() == 'Linux':
1420
# BASE_PATH 是工作目录
1521
# BASE_PATH is the working directory

0 commit comments

Comments
 (0)