forked from latex3/fontspec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfontspec-enc.dtx
138 lines (134 loc) · 4.09 KB
/
fontspec-enc.dtx
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
% \section{Extended font encodings}
%
% \iffalse
% \begin{macrocode}
%<*fontspec&(xetexx|luatex)>
% \end{macrocode}
% \fi
%
% To be removed after the 2017 release of LaTeX2e:
% \begin{macrocode}
\providecommand\UnicodeFontFile[2]{"[#1]:#2"}
\providecommand\UnicodeFontName[2]{"#1:#2"}
%<xetexx>\providecommand\UnicodeFontTeXLigatures{mapping=tex-text;}
%<luatex>\providecommand\UnicodeFontTeXLigatures{+tlig;}
% \end{macrocode}
%
% \begin{macrocode}
\providecommand\add@unicode@accent[2]{#2\char#1\relax}
\providecommand\DeclareUnicodeAccent[3]{%
\DeclareTextCommand{#1}{#2}{\add@unicode@accent{#3}}%
}
% \end{macrocode}
%
% \begin{macro}{\EncodingCommand}
% \begin{macrocode}
\DeclareDocumentCommand \EncodingCommand {mO{}m}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \EncodingCommand }
\DeclareTextCommand{#1}{\UnicodeEncodingName}[#2]{#3}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\EncodingAccent}
% \begin{macrocode}
\DeclareDocumentCommand \EncodingAccent {mm}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \EncodingAccent }
\DeclareTextCommand{#1}{\UnicodeEncodingName}{\add@unicode@accent{#2}}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\EncodingSymbol}
% \begin{macrocode}
\DeclareDocumentCommand \EncodingSymbol {mm}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \EncodingSymbol }
\DeclareTextSymbol{#1}{\UnicodeEncodingName}{#2}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\EncodingComposite}
% \begin{macrocode}
\DeclareDocumentCommand \EncodingComposite {mmm}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \EncodingComposite }
\DeclareTextComposite{#1}{\UnicodeEncodingName}{#2}{#3}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\EncodingCompositeCommand}
% \begin{macrocode}
\DeclareDocumentCommand \EncodingCompositeCommand {mmm}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \EncodingCompositeCommand }
\DeclareTextCompositeCommand{#1}{\UnicodeEncodingName}{#2}{#3}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareUnicodeEncoding}
% \begin{macrocode}
\DeclareDocumentCommand \DeclareUnicodeEncoding {mm}
{
\DeclareFontEncoding{#1}{}{}
\DeclareErrorFont{#1}{lmr}{m}{n}{10}
\DeclareFontSubstitution{#1}{lmr}{m}{n}
\DeclareFontFamily{#1}{lmr}{}
\DeclareFontShape{#1}{lmr}{m}{n}
{<->\UnicodeFontFile{lmroman10-regular}{\UnicodeFontTeXLigatures}}{}
\DeclareFontShape{#1}{lmr}{m}{it}
{<->\UnicodeFontFile{lmroman10-italic}{\UnicodeFontTeXLigatures}}{}
\DeclareFontShape{#1}{lmr}{m}{sc}
{<->\UnicodeFontFile{lmromancaps10-regular}{\UnicodeFontTeXLigatures}}{}
\DeclareFontShape{#1}{lmr}{bx}{n}
{<->\UnicodeFontFile{lmroman10-bold}{\UnicodeFontTeXLigatures}}{}
\DeclareFontShape{#1}{lmr}{bx}{it}
{<->\UnicodeFontFile{lmroman10-bolditalic}{\UnicodeFontTeXLigatures}}{}
\tl_set_eq:NN \l_@@_prev_unicode_name_tl \UnicodeEncodingName
\tl_set:Nn \UnicodeEncodingName {#1}
\bool_set_true:N \l_@@_defining_encoding_bool
#2
\bool_set_false:N \l_@@_defining_encoding_bool
\tl_set_eq:NN \UnicodeEncodingName \l_@@_prev_unicode_name_tl
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\UndeclareSymbol}
% \begin{macrocode}
\DeclareDocumentCommand \UndeclareSymbol {m}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \UndeclareSymbol }
\UndeclareTextCommand {#1} {\UnicodeEncodingName}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\UndeclareComposite}
% \begin{macrocode}
\DeclareDocumentCommand \UndeclareComposite {mm}
{
\bool_if:NF \l_@@_defining_encoding_bool
{ \@@_error:nn {only-inside-encdef} \UndeclareComposite }
\cs_undefine:c
{ \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} }
}
% \end{macrocode}
% \end{macro}
%
% \iffalse
% \begin{macrocode}
%</fontspec&(xetexx|luatex)>
% \end{macrocode}
% \fi