-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unicodedomino_compat.def
58 lines (53 loc) · 1.7 KB
/
unicodedomino_compat.def
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
% -*- mode: tex -*-
%-
% See unicodedomino.sty for copyright and licence terms. Furthermore
% this file is dual-licenced under the LPPL version 1.3c or later.
%-
% Compatibility code with older utf8.def versions
% added in release 2015/01/01
\ifx\textsubscript\@undefined%
\RequirePackage{fixltx2e}%
\fi%
% added in v1.1o 2015/08/28
\ifx\UTFviii@hexnumber\@undefined%
% taken from utf8ienc.dtx, no claim on the code but it’s really trivial
\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%
% added in v1.2a 2018/03/24
\ifx\UTFviii@invalid@help\@undefined%
\def\UTFviii@invalid@help{%
Do ensure the source document is saved in UTF-8 encoding%
}%
\fi%
% added in v1.2e 2018/09/28
\ifx\UTFviii@hexcodepoint\@undefined%
% monkey-patch bugfixes
\input{unicodedomino_kernel_fixup_f4.def}%
% override message to format the codepoint correctly
\gdef\UTFviii@splitcsname#1:#2\relax{%
#2 (\expandafter\UTFviii@hexcodepoint\expandafter{%
\the\numexpr\decode@UTFviii#2\relax})%
}%
\fi%
% added in v1.2f 2018/10/05
% unfortunately there’s no \@ifpackagelater equivalent for utf8.def,
% especially considering it’s part of the fmt file nowadays, so we
% check for the next added macro (after v1.2h) :/
\ifx\UTFviii@two@octets@combine\@undefined%
% override message to give the byte in hex
\def\UTFviii@invalid@err#1{%
\PackageError{inputenc}{Invalid UTF-8 byte "\UTFviii@hexnumber{`#1}}%
\UTFviii@invalid@help%
}%
\fi%