blob: 202b16e1b1929964ae89c7cab650a9354f2a3168 (
plain)
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
|
%
% \section{Opening code}
%
% \iffalse
% \begin{macrocode}
%<*fontspec&(xetexx|luatex)>
% \end{macrocode}
% \fi
%
% \subsection{Package options}
%
% \begin{macrocode}
\DeclareOption{cm-default}
{ \@@_warning:n {cm-default-obsolete} }
\DeclareOption{math}{\bool_set_true:N \g_@@_math_bool}
\DeclareOption{no-math}{\bool_set_false:N \g_@@_math_bool}
\DeclareOption{config}{\bool_set_true:N \g_@@_cfg_bool}
\DeclareOption{no-config}{\bool_set_false:N \g_@@_cfg_bool}
\DeclareOption{euenc}{\bool_set_true:N \g_@@_euenc_bool}
\DeclareOption{tuenc}{\bool_set_false:N \g_@@_euenc_bool}
\DeclareOption{quiet}
{
\msg_redirect_module:nnn { fontspec } { warning } { info }
\msg_redirect_module:nnn { fontspec } { info } { none }
}
\DeclareOption{silent}
{
\msg_redirect_module:nnn { fontspec } { warning } { none }
\msg_redirect_module:nnn { fontspec } { info } { none }
}
\ExecuteOptions{config,math,tuenc}
\ProcessOptions*
% \end{macrocode}
%
%
%
%
% \subsection{Encodings}
%
% Soon to be the default, with a just-in-case check:
% \begin{macrocode}
\bool_if:NF \g_@@_euenc_bool
{
\file_if_exist:nTF {tuenc.def}
{
\cs_if_exist:cF {T@TU}
{
\@@_warning:n {tu-clash}
\DeclareFontEncoding{TU}{}{}
\DeclareFontSubstitution{TU}{lmr}{m}{n}
}
}
{
\@@_warning:n {tu-missing}
\bool_set_true:N \g_@@_euenc_bool
}
}
\bool_if:NTF \g_@@_euenc_bool
{
%<xetexx> \tl_set:Nn \g_fontspec_encoding_tl {EU1}
%<luatex> \tl_set:Nn \g_fontspec_encoding_tl {EU2}
}
{ \tl_set:Nn \g_fontspec_encoding_tl { TU } }
% \end{macrocode}
%
% \begin{macrocode}
\tl_set:Nn \rmdefault {lmr}
\tl_set:Nn \sfdefault {lmss}
\tl_set:Nn \ttdefault {lmtt}
\RequirePackage[\g_fontspec_encoding_tl]{fontenc}
\tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode if needed
% \end{macrocode}
% To overcome the encoding changing the current font size, but only if a class has been loaded first:
% \begin{macrocode}
\tl_if_in:NnT \@filelist {.cls} { \normalsize }
% \end{macrocode}
% Dealing with a couple of the problems introduced by \pkg{babel}:
% \begin{macrocode}
\tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
\tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
\AtBeginDocument
{
\tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
\tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
}
% \end{macrocode}
% That latin encoding definition is repeated to suppress font warnings.
% Something to do with \cmd\select@language\ ending up in the \texttt{.aux}
% file which is read at the beginning of the document.
%
% \begin{macrocode}
\bool_if:NT \g_@@_euenc_bool
{
%<luatex> \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
%<luatex> \cs_set:Npn \XeTeXpicfile {}
\RequirePackage{xunicode}
%<luatex> \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
}
% \end{macrocode}
%
% \iffalse
% \begin{macrocode}
%</fontspec&(xetexx|luatex)>
% \end{macrocode}
% \fi
|