summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/base/utf8.def
blob: ee2a25e7df5de66c9869237500d4bfdc93bef34a (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
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
%%
%% This is file `utf8.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% utf8ienc.dtx  (with options: `utf8')
%% 
%% This is a generated file.
%% 
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs.html
%% (but please observe conditions on bug reports sent to that address!)
%% 
%% 
%% Copyright (C) 1993-2022
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%% 
%% This file was generated from file(s) of the LaTeX base system.
%% --------------------------------------------------------------
%% 
%% It 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
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%% 
%% This file has the LPPL maintenance status "maintained".
%% 
%% This file may only be distributed together with a copy of the LaTeX
%% base system. You may however distribute the LaTeX base system without
%% such generated files.
%% 
%% The list of all files belonging to the LaTeX base distribution is
%% given in the file `manifest.txt'. See also `legal.txt' for additional
%% information.
%% 
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
\ProvidesFile{utf8.def}
   [2022/06/07 v1.3c UTF-8 support]
\ifx\ifincsname\@undefined  % old e-pTeX or e-upTeX engines
  \input utf8-2018.def
  \expandafter\@firstofone
\else
  \expandafter\@gobble
\fi
  \endinput
\makeatletter
\catcode`\ \saved@space@catcode
\long\def\UTFviii@two@octets{%
  \ifincsname
    \expandafter \UTF@two@octets@string
  \else
    \ifx \protect\@typeset@protect \else
      \expandafter\expandafter\expandafter \UTF@two@octets@noexpand
    \fi
  \fi
  \UTFviii@two@octets@combine
}

\long\def\UTFviii@three@octets{%
  \ifincsname
    \expandafter \UTF@three@octets@string
  \else
    \ifx \protect\@typeset@protect \else
      \expandafter\expandafter\expandafter \UTF@three@octets@noexpand
    \fi
  \fi
  \UTFviii@three@octets@combine
}
\long\def\UTFviii@four@octets{%
  \ifincsname
    \expandafter \UTF@four@octets@string
  \else
    \ifx \protect\@typeset@protect \else
      \expandafter\expandafter\expandafter \UTF@four@octets@noexpand
    \fi
  \fi
  \UTFviii@four@octets@combine
}
\long\def\UTF@two@octets@noexpand#1#2#3{\unexpanded{#2#3}}
\long\def\UTF@three@octets@noexpand#1#2#3#4{\unexpanded{#2#3#4}}
\long\def\UTF@four@octets@noexpand#1#2#3#4#5{\unexpanded{#2#3#4#5}}

\long\def\UTF@two@octets@string#1#2#3{\detokenize{#2#3}}
\long\def\UTF@three@octets@string#1#2#3#4{\detokenize{#2#3#4}}
\long\def\UTF@four@octets@string#1#2#3#4#5{\detokenize{#2#3#4#5}}

\long\def\UTFviii@two@octets@combine#1#2{\expandafter
    \UTFviii@defined\csname u8:\string#1\string#2\endcsname}
\long\def\UTFviii@three@octets@combine#1#2#3{\expandafter
    \UTFviii@defined\csname u8:\string#1\string#2\string#3\endcsname}
\long\def\UTFviii@four@octets@combine#1#2#3#4{\expandafter
    \UTFviii@defined\csname u8:\string#1\string#2\string#3\string#4\endcsname}
\def\UTFviii@defined#1{%
  \ifx#1\relax
     \if\relax\expandafter\UTFviii@checkseq\string#1\relax\relax
      \UTFviii@undefined@err{#1}%
     \else
       \@latex@error{Invalid UTF-8 byte sequence (\expandafter
                     \@gobblefour\string#1)}%
                    \UTFviii@invalid@help
     \fi
  \else\expandafter
    #1%
  \fi
}
\def\UTFviii@invalid@err#1{%
 \@latex@error{Invalid UTF-8 byte "\UTFviii@hexnumber{`#1}}%
              \UTFviii@invalid@help}
\def\UTFviii@invalid@help{%
   The document does not appear to be in UTF-8 encoding.\MessageBreak
   Try adding \noexpand\UseRawInputEncoding as the first line of the file\MessageBreak
   or specify an encoding such as \noexpand\usepackage[latin1]{inputenc}\MessageBreak
   in the document preamble.\MessageBreak
   Alternatively, save the file in UTF-8 using your editor or another tool}
\def\UTFviii@undefined@err#1{%
  \@latex@error{Unicode character \expandafter
                          \UTFviii@splitcsname\string#1\relax
                          \MessageBreak
                          not set up for use with LaTeX}%
                         {You may provide a definition with\MessageBreak
                          \noexpand\DeclareUnicodeCharacter}%
   }
\def\UTFviii@checkseq#1:#2#3{%
 \ifnum`#2<"80 %
   \ifx\relax#3\else1\fi
 \else
   \ifnum`#2<"C0 %
     1 %
   \else
     \expandafter\expandafter\expandafter\UTFviii@check@continue
     \expandafter\expandafter\expandafter#3%
   \fi
  \fi}
\def\UTFviii@check@continue#1{%
  \ifx\relax#1%
  \else
  \ifnum`#1<"80 1\else\ifnum`#1>"BF 1\fi\fi
  \expandafter\UTFviii@check@continue
  \fi
}
\edef\reserved@a{%
\catcode`\noexpand\~=\the\catcode`\~\relax
\catcode`\noexpand\"=\the\catcode`\"\relax
\uccode`\noexpand\~=\the\uccode`\~\relax
\count@=\the\count@\relax
\@tempcnta=\the\@tempcnta\relax
\let\noexpand\reserved@a\relax}
\catcode`\~13
\catcode`\"12
\def\UTFviii@loop{%
  \uccode`\~\count@
  \uppercase\expandafter{\UTFviii@tmp}%
  \advance\count@\@ne
  \ifnum\count@<\@tempcnta
  \expandafter\UTFviii@loop
  \fi}
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@undefined@err{:\string~}}}
    \count@"1
    \@tempcnta9
\UTFviii@loop
    \count@11
    \@tempcnta12
\UTFviii@loop
    \count@14
    \@tempcnta32
\UTFviii@loop
    \count@"80
    \@tempcnta"C2
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@invalid@err\string~}}
\UTFviii@loop
    \count@"C2
    \@tempcnta"E0
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@two@octets\noexpand~}}
\UTFviii@loop
    \count@"E0
    \@tempcnta"F0
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@three@octets\noexpand~}}
\UTFviii@loop
    \count@"F0
    \@tempcnta"F5
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@four@octets\noexpand~}}
\UTFviii@loop
    \count@"F5
    \@tempcnta"100
    \def\UTFviii@tmp{\protected\edef~{\noexpand\UTFviii@invalid@err\string~}}
\UTFviii@loop
\reserved@a
\@inpenc@test
\ifx\@begindocumenthook\@undefined
  \makeatother
  \endinput \fi
\begingroup
\catcode`\"=12
\catcode`\<=12
\catcode`\.=12
\catcode`\,=12
\catcode`\;=12
\catcode`\!=12
\catcode`\~=13
\gdef\DeclareUnicodeCharacter#1#2{%
  \count@"#1\relax
  \wlog{ \space\space defining Unicode char U+#1 (decimal \the\count@)}%
  \begingroup
    \parse@XML@charref
    \def\UTFviii@two@octets##1##2{\csname u8:##1\string##2\endcsname}%
    \def\UTFviii@three@octets##1##2##3{\csname u8:##1%
                                     \string##2\string##3\endcsname}%
    \def\UTFviii@four@octets##1##2##3##4{\csname u8:##1%
                           \string##2\string##3\string##4\endcsname}%
    \expandafter\expandafter\expandafter
    \expandafter\expandafter\expandafter
    \expandafter
     \gdef\UTFviii@tmp{\IeC{#2}}%
   \endgroup
}
\gdef\parse@XML@charref{%
  \ifnum\count@<"80\relax
    \ifnum\catcode\count@=13
      \uccode`\~=\count@\uppercase{\def\UTFviii@tmp{\@empty\@empty~}}%
    \else
      \@latex@error{Cannot define non-active Unicode char value < 0080}%
                   \@eha
      \def\UTFviii@tmp{\UTFviii@tmp}%
    \fi
  \else\ifnum\count@<"800\relax
     \parse@UTFviii@a,%
     \parse@UTFviii@b C\UTFviii@two@octets.,%
  \else\ifnum\count@<"10000\relax
     \parse@UTFviii@a;%
     \parse@UTFviii@a,%
     \parse@UTFviii@b E\UTFviii@three@octets.{,;}%
   \else
     \ifnum\count@>"10FFFF\relax
           \@latex@error
                {\UTFviii@hexnumber\count@\space too large for Unicode}%
                {Values between 0 and 10FFFF are permitted}%
      \fi
     \parse@UTFviii@a;%
     \parse@UTFviii@a,%
     \parse@UTFviii@a!%
     \parse@UTFviii@b F\UTFviii@four@octets.{!,;}%
    \fi
    \fi
  \fi
}
\gdef\parse@UTFviii@a#1{%
     \@tempcnta\count@
     \divide\count@ 64
     \@tempcntb\count@
     \multiply\count@ 64
     \advance\@tempcnta-\count@
     \advance\@tempcnta 128
     \uccode`#1\@tempcnta
     \count@\@tempcntb}
\gdef\parse@UTFviii@b#1#2#3#4{%
     \advance\count@ "#10\relax
     \uccode`#3\count@
     \uppercase{\gdef\UTFviii@tmp{#2#3#4}}}
\ifx\numexpr\@undefined
\gdef\decode@UTFviii#1{0}
\else
\gdef\decode@UTFviii#1\relax{%
  \expandafter\UTFviii@cleanup
    \the\numexpr\dec@de@UTFviii#1\relax)))))\@empty}
\gdef\UTFviii@cleanup#1)#2\@empty{#1}
\gdef\dec@de@UTFviii#1{%
\ifx\relax#1%
\else
  \ifnum`#1>"EF
    ((((`#1-"F0)%
  \else
    \ifnum`#1>"DF
      (((`#1-"E0)%
    \else
      \ifnum`#1>"BF
        ((`#1-"C0)%
      \else
        \ifnum`#1>"7F
        )*64+(`#1-"80)%
        \else
        +`#1 %
        \fi
      \fi
    \fi
  \fi
  \expandafter\dec@de@UTFviii
\fi}
\fi
\ifx\numexpr\@undefined
\global\let\UTFviii@hexnumber\@firstofone
\global\UTFviii@hexdigit\hexnumber@
\else
\gdef\UTFviii@hexnumber#1{%
\ifnum#1>15 %
\expandafter\UTFviii@hexnumber\expandafter{\the\numexpr(#1-8)/16\relax}%
\fi
\UTFviii@hexdigit{\numexpr#1\ifnum#1>0-((#1-8)/16)*16\fi\relax}%
}
\gdef\UTFviii@hexdigit#1{\ifcase\numexpr#1\relax
  0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or
  A\or B\or C\or D\or E\or F\fi}
\fi
\gdef\UTFviii@hexcodepoint#1{U+%
 \ifnum#1<16 0\fi
 \ifnum#1<256 0\fi
 \ifnum#1<4096 0\fi
 \UTFviii@hexnumber{#1}%
}%
\gdef\UTFviii@splitcsname#1:#2\relax{%
#2 (\expandafter\UTFviii@hexcodepoint\expandafter{%
                     \the\numexpr\decode@UTFviii#2\relax})%
}
\endgroup
\@onlypreamble\DeclareUnicodeCharacter
\@onlypreamble\parse@XML@charref
\@onlypreamble\parse@UTFviii@a
\@onlypreamble\parse@UTFviii@b
\begingroup
  \def\cdp@elt#1#2#3#4{%
    \wlog{Now handling font encoding #1 ...}%
    \lowercase{%
        \InputIfFileExists{#1enc.dfu}}%
           {\wlog{... processing UTF-8 mapping file for font %
                     encoding #1}%
            \catcode`\ 9\relax}%
          {\wlog{... no UTF-8 mapping file for font encoding #1}}%
  }
  \cdp@list
\endgroup
\def\DeclareFontEncoding@#1#2#3{%
  \expandafter
  \ifx\csname T@#1\endcsname\relax
    \def\cdp@elt{\noexpand\cdp@elt}%
    \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
                    {\default@family}{\default@series}%
                    {\default@shape}}%
    \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
    \begingroup
      \wlog{Now handling font encoding #1 ...}%
      \lowercase{%
        \InputIfFileExists{#1enc.dfu}}%
           {\wlog{... processing UTF-8 mapping file for font %
                      encoding #1}}%
           {\wlog{... no UTF-8 mapping file for font encoding #1}}%
    \endgroup
  \else
     \@font@info{Redeclaring font encoding #1}%
  \fi
  \global\@namedef{T@#1}{#2}%
  \global\@namedef{M@#1}{\default@M#3}%
  \xdef\LastDeclaredEncoding{#1}%
  }
\DeclareUnicodeCharacter{00A9}{\textcopyright}
\DeclareUnicodeCharacter{00AA}{\textordfeminine}
\DeclareUnicodeCharacter{00AE}{\textregistered}
\DeclareUnicodeCharacter{00BA}{\textordmasculine}
\DeclareUnicodeCharacter{02C6}{\textasciicircum}
\DeclareUnicodeCharacter{02DC}{\textasciitilde}
\DeclareUnicodeCharacter{200C}{\textcompwordmark}
\DeclareUnicodeCharacter{2026}{\textellipsis}
\DeclareUnicodeCharacter{2122}{\texttrademark}
\DeclareUnicodeCharacter{2423}{\textvisiblespace}
\DeclareUnicodeCharacter{FEFF}{\ifhmode\nobreak\fi}
\endinput
%%
%% End of file `utf8.def'.