innoai commited on
Commit
6961b3f
·
verified ·
1 Parent(s): 9be3968

Upload 14 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,16 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ fonts/Deng.ttf filter=lfs diff=lfs merge=lfs -text
37
+ fonts/Dengb.ttf filter=lfs diff=lfs merge=lfs -text
38
+ fonts/Dengl.ttf filter=lfs diff=lfs merge=lfs -text
39
+ fonts/msyh.ttc filter=lfs diff=lfs merge=lfs -text
40
+ fonts/msyhbd.ttc filter=lfs diff=lfs merge=lfs -text
41
+ fonts/msyhl.ttc filter=lfs diff=lfs merge=lfs -text
42
+ fonts/simfang.ttf filter=lfs diff=lfs merge=lfs -text
43
+ fonts/simhei.ttf filter=lfs diff=lfs merge=lfs -text
44
+ fonts/simkai.ttf filter=lfs diff=lfs merge=lfs -text
45
+ fonts/SIMLI.TTF filter=lfs diff=lfs merge=lfs -text
46
+ fonts/simsun.ttc filter=lfs diff=lfs merge=lfs -text
47
+ fonts/SIMYOU.TTF filter=lfs diff=lfs merge=lfs -text
48
+ fonts/SourceHanSerif.ttc filter=lfs diff=lfs merge=lfs -text
fonts/Deng.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e051009b42b454352a90ae0c9b8adb58bbdbcd168768750b35bc3357510de141
3
+ size 16324168
fonts/Dengb.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:236df24be867e527bdf810d00eb5c38f18244e776238a9f5ca937363267a9169
3
+ size 16450596
fonts/Dengl.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ae7cf364a29b9da69eff7333decb88e577c262c5847df2510e37695e25a8395
3
+ size 15437648
fonts/SIMLI.TTF ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5a3a1e2e2cb6fee66d1e7f821b5c04f3ad7792f1e5b3cac545c2e52173e908d
3
+ size 9223160
fonts/SIMYOU.TTF ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4440e07e02fa6b5a8f497da52fcab0aa711b399d43ff28a2ba246c603363930
3
+ size 6700204
fonts/SourceHanSerif.ttc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec4bb0925499e1a71bc5829e8b5235ae14cbe7f956c1d9f3e9424f8f8d91820d
3
+ size 170495268
fonts/msyh.ttc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d79c55e68b1131eea0cc1c47be4f572d964f28c682e143db2ad09c1e4cb07a3f
3
+ size 19704352
fonts/msyhbd.ttc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4508821b3dffe01f0ef5e5326a3e60df705a44633858811f67b6982dce3f6ee6
3
+ size 16883552
fonts/msyhl.ttc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e9bdf90bb5d3fe1b5975fc8ae31944b8fa674122261f92c28d4ec0b9c482fa1
3
+ size 12189612
fonts/simfang.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e2d44b01c9a248a61bedae4f15c8aae501328b1f7adfe6e111a5da5aa5c5104
3
+ size 10578152
fonts/simhei.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa4560dd8fe5645745fed3ffa301c3ca4d6c03cbd738145b613303961ba733b8
3
+ size 9753388
fonts/simkai.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9dd76f7ab430edd091db24c3f18e71410325c1414141aad5fe67947873ffba06
3
+ size 11787328
fonts/simsun.ttc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:120a51d2b14eb588700a21e15fc301f0ea55d7c1a4e1f3ae61db83b7c8d42cd6
3
+ size 18070492
install_fonts.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ def install_fonts_from_repository():
7
+ """
8
+ 将仓库中的 fonts 目录下的所有字体文件复制到 ~/.fonts 目录,并刷新字体缓存。
9
+ """
10
+
11
+ # 获取当前用户的主目录路径
12
+ home_dir = Path.home()
13
+
14
+ # 定义目标字体目录路径:~/.fonts
15
+ fonts_dir = home_dir / ".fonts"
16
+
17
+ # 如果 ~/.fonts 目录不存在,则创建该目录
18
+ if not fonts_dir.exists():
19
+ fonts_dir.mkdir(parents=True)
20
+ print(f"已创建字体目录:{fonts_dir}")
21
+ else:
22
+ print(f"字体目录已存在:{fonts_dir}")
23
+
24
+ # 定义仓库中的 fonts 目录路径
25
+ repo_fonts_dir = Path(__file__).parent / "fonts"
26
+
27
+ # 检查仓库中的 fonts 目录是否存在
28
+ if not repo_fonts_dir.exists():
29
+ print(f"错误:仓库中的 fonts 目录不存在:{repo_fonts_dir}")
30
+ return
31
+
32
+ # 支持的字体文件扩展名
33
+ font_extensions = [".ttf", ".otf"]
34
+
35
+ # 统计已复制的字体文件数量
36
+ copied_count = 0
37
+
38
+ # 遍历 fonts 目录中的所有文件
39
+ for font_file in repo_fonts_dir.iterdir():
40
+ if font_file.suffix.lower() in font_extensions:
41
+ destination = fonts_dir / font_file.name
42
+ try:
43
+ shutil.copy(font_file, destination)
44
+ print(f"已复制字体文件:{font_file.name} 到 {destination}")
45
+ copied_count += 1
46
+ except Exception as e:
47
+ print(f"复制字体文件时出错:{font_file.name},错误信息:{e}")
48
+
49
+ if copied_count == 0:
50
+ print("未找到任何可复制的字体文件。")
51
+ return
52
+
53
+ # 刷新字体缓存
54
+ try:
55
+ print("正在刷新字体缓存...")
56
+ subprocess.run(["fc-cache", "-f", "-v"], check=True)
57
+ print("字体缓存刷新完成。")
58
+ except subprocess.CalledProcessError as e:
59
+ print(f"刷新字体缓存时出错:{e}")
60
+
61
+ if __name__ == "__main__":
62
+ install_fonts_from_repository()