Hexo切换字体

概览:

选择字体

想要添加一个可爱的字体,比如这个http://comicneue.com/

下载字体,将字体解压到themes/next/source/fonts

配置文件

然后编辑themes/next/source/css/_custom/custom.styl

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//字体
@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Light.eot');
src: url('/fonts/ComicNeue-Light.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Light.woff2') format('woff2'),
url('/fonts/ComicNeue-Light.woff') format('woff'),
url('/fonts/ComicNeue-Light.ttf') format('truetype');
font-weight: 300;
}

@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Light-Oblique.eot');
src: url('/fonts/ComicNeue-Light-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Light-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Light-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Light-Oblique.ttf') format('truetype');
font-weight: 300;
font-style: oblique;
}

@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Regular.eot');
src: url('/fonts/ComicNeue-Regular.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Regular.woff2') format('woff2'),
url('/fonts/ComicNeue-Regular.woff') format('woff'),
url('/fonts/ComicNeue-Regular.ttf') format('truetype');
font-weight: 400;
}

@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Regular-Oblique.eot');
src: url('/fonts/ComicNeue-Regular-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Regular-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Regular-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Regular-Oblique.ttf') format('truetype');
font-weight: 400;
font-style: oblique;
}

@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Bold.eot');
src: url('/fonts/ComicNeue-Bold.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Bold.woff2') format('woff2'),
url('/fonts/ComicNeue-Bold.woff') format('woff'),
url('/fonts/ComicNeue-Bold.ttf') format('truetype');
font-weight: 700;
}

@font-face {
font-family: 'Comic Neue';
src: url('/fonts/ComicNeue-Bold-Oblique.eot');
src: url('/fonts/ComicNeue-Bold-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Bold-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Bold-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Bold-Oblique.ttf') format('truetype');
font-weight: 700;
font-style: oblique;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Light.eot');
src: url('/fonts/ComicNeue-Angular-Light.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Light.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Light.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Light.ttf') format('truetype');
font-weight: 300;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Light-Oblique.eot');
src: url('/fonts/ComicNeue-Angular-Light-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Light-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Light-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Light-Oblique.ttf') format('truetype');
font-weight: 300;
font-style: oblique;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Regular.eot');
src: url('/fonts/ComicNeue-Angular-Regular.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Regular.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Regular.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Regular.ttf') format('truetype');
font-weight: 400;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Regular-Oblique.eot');
src: url('/fonts/ComicNeue-Angular-Regular-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Regular-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Regular-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Regular-Oblique.ttf') format('truetype');
font-weight: 400;
font-style: oblique;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Bold.eot');
src: url('/fonts/ComicNeue-Angular-Bold.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Bold.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Bold.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Bold.ttf') format('truetype');
font-weight: 700;
}

@font-face {
font-family: 'Comic Neue Angular';
src: url('/fonts/ComicNeue-Angular-Bold-Oblique.eot');
src: url('/fonts/ComicNeue-Angular-Bold-Oblique.eot?#iefix') format('embedded-opentype'),
url('/fonts/ComicNeue-Angular-Bold-Oblique.woff2') format('woff2'),
url('/fonts/ComicNeue-Angular-Bold-Oblique.woff') format('woff'),
url('/fonts/ComicNeue-Angular-Bold-Oblique.ttf') format('truetype');
font-weight: 700;
font-style: oblique;
}

编辑主题配置文件_config.yml的fonts字段

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

# ---------------------------------------------------------------
# Font Settings. Introduced in NexT v5.0.1.
# Find fonts on Google Fonts (https://www.google.com/fonts)
# All fonts set here will have the following styles:
# light, light italic, normal, normal italic, bold, bold italic
# Be aware that setting too much fonts will cause site running slowly
# ---------------------------------------------------------------
# To avoid space between header and sidebar in scheme Pisces / Gemini, Web Safe fonts are recommended for `global` (and `logo`):
# Arial | Tahoma | Helvetica | Times New Roman | Courier New | Verdana | Georgia | Palatino | Garamond | Comic Sans MS | Trebuchet MS
# ---------------------------------------------------------------

font:
enable: true

# Uri of fonts host, e.g. //fonts.googleapis.com (Default).
host: //fonts.lug.ustc.edu.cn

# Font options:
# `external: true` will load this font family from `host` above.
# `family: Times New Roman`. Without any quotes.
# `size: xx`. Use `px` as unit.

# Global font settings used for all elements in .
global:
external: true
family: Comic Neue
size: 18

# Font settings for Headlines (H1, H2, H3, H4, H5, H6).
# Fallback to `global` font settings.
headings:
external: true
family:
size:

# Font settings for posts.
# Fallback to `global` font settings.
posts:
external: true
family:

# Font settings for Logo.
# Fallback to `global` font settings.
logo:
external: true
family: Lobster Two
size:

# Font settings for and code blocks.
codes:
external: true
family: monospace
size:

完成

------ 文章已经结束,谢谢你的阅读 ------
------ article has ended,thank you for reading ------
Thanks support Me

---------------- The End ----------------