summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-code-enc.dtx
blob: fef5d81549d92ce0150d2296280d9402d1fd636d (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
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
%%^^A%%  fontspec-code-enc.dtx -- part of FONTSPEC <wspr.io/fontspec>

% \section{Extended font encodings}
%
% \iffalse
%    \begin{macrocode}
%<*fontspec>
%    \end{macrocode}
% \fi
%
% To be removed after the 2017 release of LaTeX2e:
%    \begin{macrocode}
\providecommand\UnicodeFontFile[2]{"[#1]:#2"}
\providecommand\UnicodeFontName[2]{"#1:#2"}
%<XE>\providecommand\UnicodeFontTeXLigatures{mapping=tex-text;}
%<LU>\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{macro}{\UndeclareAccent}
% \begin{macro}{\UndeclareCommand}
% Synonyms for each other but all included for completeness.
%    \begin{macrocode}
\DeclareDocumentCommand \UndeclareSymbol {m}
  {
    \bool_if:NF \l_@@_defining_encoding_bool
      { \@@_error:nn {only-inside-encdef} \UndeclareSymbol }
    \UndeclareTextCommand {#1} {\UnicodeEncodingName}
  }
\DeclareDocumentCommand \UndeclareAccent {m}
  {
    \bool_if:NF \l_@@_defining_encoding_bool
      { \@@_error:nn {only-inside-encdef} \UndeclareAccent }
    \UndeclareTextCommand {#1} {\UnicodeEncodingName}
  }
\DeclareDocumentCommand \UndeclareCommand {m}
  {
    \bool_if:NF \l_@@_defining_encoding_bool
      { \@@_error:nn {only-inside-encdef} \UndeclareCommand }
    \UndeclareTextCommand {#1} {\UnicodeEncodingName}
  }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \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>
%    \end{macrocode}
% \fi


\endinput

% /©
% ------------------------------------------------
% The FONTSPEC package  <wspr.io/fontspec>
% ------------------------------------------------
% Copyright  2004-2019  Will Robertson, LPPL "maintainer"
% Copyright  2009-2015  Khaled Hosny
% Copyright  2013       Philipp Gesang
% Copyright  2013-2016  Joseph Wright
% ------------------------------------------------
% This package is free software and may be redistributed and/or modified under
% the conditions of the LaTeX Project Public License, version 1.3c or higher
% (your choice): <http://www.latex-project.org/lppl/>.
% ------------------------------------------------
% ©/