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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
%%
%% This is file `novel-FontDefaults.sty', part of class `novel'.
%% Copyright 2017 Robert Allgeyer.
%%
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%%
\ProvidesFile{novel-FontDefaults.sty}%
[2017/07/26 v1.32 LaTeX file (default fonts)]
%%
%%
%% This file is loaded \AtEndPreamble.
%%
%% Most TeX installations will use Latin Modern or Computer Modern
%% as default fonts. These are unsuitable for commercial fiction.
%% But `novel' class uses Libertinus as defaults.
%% Change them using \SetParentFont and other fontspec commands, in Preamble.
% Libertinus Serif has Regular, Italic, Bold, Bold Italic.
% Here, Semibold over-rides Bold.
%
%% Now to activate the font definitions:
%
\defaultfontfeatures{} % reset
%
% The mono font:
\defaultfontfeatures[\ttfamily]{% monofont has no kerning or common ligatures
SmallCapsFeatures={Renderer=Basic},Ligatures=TeX,%
}%
\ifthenelse{\equal{\ttdefault}{lmtt}\OR\equal{\ttdefault}{cmtt}}{% over-ride:
\IfFontExistsTF{Libertinus Mono}{
\setmonofont[%
ItalicFont={},% Doesn't have these.
BoldFont={},%
BoldItalicFont={},%
]{Libertinus Mono}
}{
\IfFontExistsTF{Linux Libertine Mono O}{
\setmonofont{Linux Libertine Mono O}
}{
\setmonofont{Latin Modern Mono}% Eeek! Only because you have it!
}
}
}{} % User \setmonofont, so leave alone.
%%
\defaultfontfeatures{} % reset
% Main and sans fonts: kerning, ligatures, and OldStyle numbers if available:
\defaultfontfeatures[\rmfamily,\sffamily]{%
SmallCapsFeatures={Renderer=Basic},Kerning=On,Numbers=OldStyle,%
Ligatures=Common,Ligatures=TeX,%
}%
% The sans font:
\ifthenelse{\equal{\sfdefault}{lmss}\OR\equal{\sfdefault}{cmss}}{ % override:
\IfFontExistsTF{Libertinus Sans}{
\setsansfont{Libertinus Sans}
}{
\IfFontExistsTF{Linux Biolinum O}{
\setsansfont{Linux Biolinum O}
}{
\setsansfont{Latin Modern Sans}% Eeek! Only because you have it!
}
}
}{} % User \setsansfont, so leave alone.
%%
% At this point, if \rmdefault is something other than lmr, it means
% that the user attempted to set the main font using ordinary TeX commands,
% or via fontspec's \setmainfont. But those are ineffective in this class,
% because without \SetParentFont the prior command will be over-written.
\ifthenelse{\equal{\rmdefault}{\@noveloldrmdefault}}{}{%
\ClassWarning{novel}{^^JBIG BAD WARNING:^^J%
You attempted to define the main document font using a command such as^^J%
\string\renewcommand\string\rmdefault\space or \string\usepackage{font}^^J%
or \string\setmainfont. These are incorrect in `novel' class.^^J%
Use \string\SetParentFont\space instead. See `novel' documentation.^^J}%
}%
% The parentfont: (from v.1.1. Known as masterfont in prior versions)
\if@parentfontset\else
\IfFontExistsTF{Libertinus Serif}{
\SetParentFont[%
BoldFont=libertinusserif-semibold.otf,%
BoldItalicFont=libertinusserif-semibolditalic.otf,%
]{Libertinus Serif}
}{
\IfFontExistsTF{Linux Libertine O}{
\SetParentFont[%
BoldFont=LinLibertine_RZ.otf,%
BoldItalicFont=LinLibertine_RZI.otf,%
]{Linux Libertine O}
}{
\SetParentFont[%
SmallCapsFont={Latin Modern Roman Caps}%
]{Latin Modern Roman}% Eeek! Only because you have it!
\let\scshape\oldscshape % or small caps won't work
\let\smcp\oldscshape % ditto
}
}
\fi
% Now we are ready to set the main font:
\setmainfont[\@parentfontfeatures]{\@parentfontname}
\let\textfont\rmfamily\relax % compatibility
\let\mainfont\rmfamily\relax % compatibility
%
%%
\defaultfontfeatures{} % reset
% The novel-specific display fonts use these defaults:
\defaultfontfeatures{%
SmallCapsFeatures={Renderer=Basic},Kerning=On,%
Ligatures=TeX,Ligatures=CommonOff,Numbers=Lining,%
}%
%% The novel-specific fonts:
\if@chapterfontset\else
\SetChapterFont[\@parentfontfeatures,Scale=1.6]{\@parentfontname}
\fi
\newfontfamily\chapterfont[\@chapterfontfeatures]{\@chapterfontname}
%%
\if@subchfontset\else
\SetSubchFont[\@parentfontfeatures,Scale=1.2]{\@parentfontname}
\fi
\newfontfamily\subchfont[\@subchfontfeatures]{\@subchfontname}
%%
\newif \if@headfontdefault
\if@headfontset\else
\SetHeadFont[\@parentfontfeatures,Scale=0.92]{\@parentfontname}
\global\@headfontdefaulttrue
\fi
\newfontfamily\headfont[\@headfontfeatures]{\@headfontname}
%%
\defaultfontfeatures{} % reset
\defaultfontfeatures{% for decofont
SmallCapsFeatures={Renderer=Basic},Kerning=On,Ligatures=TeX,%
}%
%% The decofont must be NovelDeco.otf or a user modification of that font:
\if@decofontset\else
\IfFontExistsTF{NovelDeco.otf}{
\SetDecoFont{NovelDeco}
}{}
\fi
%%
\gdef\acronym#1{#1}% Re-defined below, if decofont available.
%%
%% Now to get the decofont activated:
% Decorative glyphs, only in this font. Should not be re-set by user:
\gdef\decoglyph#1{~}% If NovelDeco not found, nonbreaking space in main text.
%
\if@gotdeco % NovelDeco or a user-defined alternative was found:
\newfontface\@decoglyph[%
\@decofontfeatures,%
]{\@decofontname}
\newfontface\@decoglypha[%
\@decofontfeatures,RawFeature=+ss01,%
]{\@decofontname}
\newfontface\@decoglyphb[%
\@decofontfeatures,RawFeature=+ss02,%
]{\@decofontname}
\newfontface\@decoglyphc[%
\@decofontfeatures,RawFeature=+ss03,%
]{\@decofontname}
%
\gdef\decoglyph#1{% Be sure to use % without preceding space:
\IfBeginWith{#1}{n}{% normal weight symbol (same as regular)
\StrBehind{#1}{n}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}%
}{}%
\IfBeginWith{#1}{r}{% regular weight symbol
\StrBehind{#1}{r}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}%
}{}%
\IfBeginWith{#1}{l}{% light weight symbol
\StrBehind{#1}{l}[\@tempdecoglyph]{\@decoglypha\symbol{\@tempdecoglyph}}%
}{}%
\IfBeginWith{#1}{e}{% extra light weight symbol
\StrBehind{#1}{e}[\@tempdecoglyph]{\@decoglyphb\symbol{\@tempdecoglyph}}%
}{}%
\IfBeginWith{#1}{t}{% thin weight symbol
\StrBehind{#1}{t}[\@tempdecoglyph]{\@decoglyphc\symbol{\@tempdecoglyph}}%
}{}%
}% end gdef decoglyph
%
% The trouble with acronyms is that they look too big in regular capitals,
% and too small in small caps. Command \acronym{} tries to provide an
% intermediate size. The letters were drawn from Linux Libertine, scaled,
% weights adjusted, the placed in NovelDeco.otf.
\gdef\acronym#1{{\decofont{#1}}}
%
\fi% end \if@gotdeco
%
%%
% Any other fonts will use these defaults:
\defaultfontfeatures{} % reset
% The novel-specific display fonts use these defaults:
\defaultfontfeatures{%
SmallCapsFeatures={Renderer=Basic},%
Ligatures=TeX,
Kerning=On,%
}%
%
%%
% Get rid of previously-defined fake polyglossia commands,
% but you can still use \setkeys from that package:
\let\SetMainLanguage\relax
\let\SetDefaultLanguage\relax
\let\SetOtherLanguage\relax
\let\SetOtherLanguages\relax
\let\setmainlanguage\relax
\let\setdefaultlanguage\relax
\let\setotherlanguage\relax
\let\setotherlanguages\relax
% Now that the basic fonts are defined, we can load these packages:
\RequirePackage{polyglossia} % Instead of babel.
%
\ifthenelse{\equal{\@setmainlang}{}}{
\setmainlanguage{english}
}{
\ifthenelse{\equal{\@setmainlangopt}{}}{
\setmainlanguage{\@setmainlang}
}{
\setmainlanguage[\@setmainlangopt]{\@setmainlang}
}
}
\ifthenelse{\equal{\@setotherlang}{}}{}{
\ifthenelse{\equal{\@setotherlangopt}{}}{
\setotherlanguage{\@setotherlang}
}{
\setotherlanguage[\@setotherlangopt]{\@setotherlang}
}
}
\ifthenelse{\equal{\@setotherlangs}{}}{}{
\ifthenelse{\equal{\@setotherlangsopt}{}}{
\setotherlanguages{\@setotherlangs}
}{
\setotherlanguages[\@setotherlangsopt]{\@setotherlangs}
}
}
%% This provides default microtype settings, allows the user to over-ride,
% and hopefully prevents the user from choosing inappropriate settings:
\let\microtypesetup\relax % fake command no longer needed
\if@setmicrotype % user wrote \microtypesetup{} in Preamble
\IfSubStr{\@mymicrotypesetup}{config}{% user specified own config file
\gdef\@mymicrotypeset{\@mymicrotypesetup}
}{ % default to novel's config file
\gdef\@mymicrotypeset{%
config=novel-microtype,\@mymicrotypesetup}
}
\else % user did not write \microtypesetup{} in Preamble
\gdef\@mymicrotypeset{%
config=novel-microtype,stretch=20,shrink=20}
\fi
\RequirePackage[\@mymicrotypeset,final,tracking]{microtype}
%
%%
%
%% End of file `novel-FontDefaults.sty'
|