Skip to content

Commit fa94709

Browse files
author
mebtte
committed
new way
1 parent 7921cb4 commit fa94709

File tree

383 files changed

+16
-86243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

383 files changed

+16
-86243
lines changed

.editorconfig

-12
This file was deleted.

.env

-5
This file was deleted.

.env.production

-1
This file was deleted.

.eslintignore

-7
This file was deleted.

.eslintrc.json

-6
This file was deleted.

.gitattributes

-1
This file was deleted.

.github/workflows/gh_pages.yml

-36
This file was deleted.

.gitignore

-26
This file was deleted.

.lintstagedrc.js

-14
This file was deleted.

.npmrc

-1
This file was deleted.

.nvmrc

-1
This file was deleted.

.prettierignore

Whitespace-only changes.

.watchmanconfig

-1
This file was deleted.

CONTRIBUTING.md

-63
This file was deleted.

LICENSE

-21
This file was deleted.

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22

33
什么是 [Excalidraw](https://github.com/excalidraw/excalidraw) ?
44

5-
本项目在 `Excalidraw` 的基础上支持了中文字体:
5+
> 如果想查看之前替换字体自定义部署的方式, 请查看[这里](https://github.com/mebtte/excalidraw/tree/7921cb44aaeb9da94d49d371d645510b1e99572c)
66
7-
![](./cn_screenshot.png)
7+
Excalidraw 手写字体只支持英文, 不支持中文.
88

9-
> [https://excalidraw.mebtte.com](https://excalidraw.mebtte.com/) 部署在 Github Pages, 中文字体偏大, 加载可能缓慢或者失败.
9+
手写字体文件是通过网络加载的, 所以可以通过劫持字体文件请求然后改写到自己的字体链接, 就可以达到替换字体的目的.
1010

11-
如果想更换字体, TTF 格式直接覆盖 `public/chinese.ttf`. 其他格式将字体文件放置 `public` 目录下, 然后将 `public/index.html`/`public/font.css` 中的 `chinese.ttf` 替换成新的字体文件名, 编译部署即可.
11+
![](./font_request.png)
12+
13+
通过浏览器的 Network 面板可以找到`手写字体`的请求是 `https://excalidraw.com/Virgil.woff2`.
14+
15+
改写浏览器请求可以通过 [XSwitch](https://chrome.google.com/webstore/detail/xswitch/idkjhjggpffolpidfkikidcokdkdaogg) 插件.
16+
17+
之后将想要的字体托管为静态资源(或者本地部署), 在 XSwitch 中添加 `proxy` 配置将 Excalidraw 的手写字体链接替换成自己的字体链接:
18+
19+
![](./xswitch.png)
20+
21+
启用 XSwitch 然后刷新 Excalidraw, 可以发现自定义字体已生效:
22+
23+
![](./screenshot.png)

cn_screenshot.png

-190 KB
Binary file not shown.

crowdin.yml

-3
This file was deleted.

font_request.png

69.1 KB
Loading

package.json

-110
This file was deleted.

public/Cascadia.ttf

-208 KB
Binary file not shown.

public/Cascadia.woff2

-84.8 KB
Binary file not shown.

public/FG_Virgil.ttf

-231 KB
Binary file not shown.

public/FG_Virgil.woff2

-117 KB
Binary file not shown.

public/Virgil.woff2

-59.8 KB
Binary file not shown.

public/_headers

-2
This file was deleted.

public/apple-touch-icon.png

-4.26 KB
Binary file not shown.

public/chinese.ttf

-5.25 MB
Binary file not shown.

public/favicon.ico

-25.7 KB
Binary file not shown.

public/fonts.css

-19
This file was deleted.

0 commit comments

Comments
 (0)