forked from zhanggyb/nndl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcjkfonts.sty
149 lines (123 loc) · 4.31 KB
/
cjkfonts.sty
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
% cjkfonts.sty
%
% A XeLaTeX package for typesetting CJK documents.
%
% Author: Freeman Zhang <[email protected]>
% Version: 0.1
% Homepage: https://github.com/zhanggyb/cjkfonts
%
% Options:
% path: The path where can find cjkfonts font files.
% mdseries: choose one of Thin, Light, DemiLight, Regular, Medium, Bold, Black for text with medium weight.
% bfseries: choose one of Thin, Light, DemiLight, Regular, Medium, Bold, Black for text with bold face.
% default: boolean option, cjkfonts is set as the default font family and as the sans serif family for CJK text.
% Identification
% ==============
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cjkfonts}[2015/12/12 A simple XeLaTeX package to set CJK fonts]
% Required Packages
% =================
\RequirePackage{ifthen}
\RequirePackage{xeCJK}
% Set key-value options
\RequirePackage{kvoptions}
\DeclareStringOption[fonts/]{path}[fonts/]
\DeclareStringOption[Regular]{mdseries}[Regular]
\DeclareStringOption[Bold]{bfseries}[Bold]
\DeclareBoolOption[false]{default}
\ProcessKeyvalOptions*
%% Configuration for fonts
%% =======================
\newCJKfontfamily[NotoSansSC]\NotoSansSC[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldItalicFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{NotoSansSC}
\newCJKfontfamily[NotoSansMonoSC]\NotoSansMonoSC[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansMonoCJKsc-Regular,
BoldFont=NotoSansMonoCJKsc-Bold,
ItalicFont=NotoSansMonoCJKsc-Regular,
BoldItalicFont=NotoSansMonoCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{NotoSansMonoSC}
\newCJKfontfamily[NotoSansSCThin]\NotoSansSCThin[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Thin,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCLight]\NotoSansSCLight[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Light,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCDemiLight]\NotoSansSCDemiLight[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-DemiLight,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCRegular]\NotoSansSCRegular[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Regular,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCMedium]\NotoSansSCMedium[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Medium,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCBold]\NotoSansSCBold[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Bold,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansSCBlack]\NotoSansSCBlack[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-Black,
AutoFakeSlant=true]{NotoSansSC}
\newCJKfontfamily[NotoSansMonoSCRegular]\NotoSansMonoSCRegular[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansMonoCJKsc-Regular,
AutoFakeSlant=true]{NotoSansMonoSCRegular}
\newCJKfontfamily[NotoSansMonoSCBold]\NotoSansMonoSCBold[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansMonoCJKsc-Bold,
AutoFakeSlant=true]{NotoSansMonoSCBold}
\ifthenelse{\boolean{cjkfonts@default}}{
\setCJKmainfont[Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldItalicFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{NotoSansSC}
\setCJKsansfont[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFont=NotoSansCJKsc-\cjkfonts@mdseries,
BoldItalicFont=NotoSansCJKsc-\cjkfonts@bfseries,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{NotoSansSC}
\setCJKmonofont[
Extension=.otf,
Path=\cjkfonts@path/,
UprightFont=NotoSansMonoCJKsc-Regular,
BoldFont=NotoSansMonoCJKsc-Bold,
ItalicFont=NotoSansMonoCJKsc-Regular,
BoldItalicFont=NotoSansMonoCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{NotoSansMonoSC}
}{}
%% This must be the last command
\endinput