准备自定义字体以及css

/source新建一个/fonts文件夹,把你的字体扔进去
/source/css新建一个fonts.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* 引入全局字体(meow.otf) */
@font-face {
font-family: 'MyCustomFont';
src: url('/fonts/meow.otf') format('opentype'); /* otf字体,ttf把format改成truetype */
font-weight: normal;
font-style: normal;
}

/* 引入代码字体(shaonv.ttf) */
@font-face {
font-family: 'MyCodeFont';
src: url('/fonts/shaonv.ttf') format('truetype'); /* ttf字体,otf把format改成opentype */
font-weight: normal;
font-style: normal;
}

/* 设置全局字体 */
body {
font-family: 'MyCustomFont', "Georgia", "Arial", sans-serif;
font-size: 16px;
}

/* 设置代码字体 */
code, pre {
font-family: 'MyCodeFont', "Fira Code", "Courier", monospace;
font-size: 16px;
}

引入css并设置字体

编辑Butterfly的_config.yml

引入css

1
2
3
4
5
6
7
# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head:
- <link rel="stylesheet" href=" /css/transpancy.css">
- <link rel="stylesheet" href=" /css/fonts.css">

字体部分

1
2
3
4
5
font:
global-font-size: 16px
code-font-size: 16px
font-family: MyCustomFont, "Georgia", "Arial", sans-serif
code-font-family: MyCodeFont, "Fira Code", "Courier", monospace

大功告成!