summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec/tuenc.def
blob: ab0fb8d987ec0b3b60d58dfd9f4ab2852c7c08e2 (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
\ProvidesFile{tuenc.def}
    [2016/01/29 v0.1 Unicode font encoding for LaTeX2e]

%%%%%%
% Please consider this encoding definition to be experimental!
%%%%%%

\providecommand\UnicodeEncodingName{TU}


%% WRAPPERS NEEDED FOR FONT LOADING (.fd FILE COMMANDS)

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax\else
  \def\UnicodeFontTeXLigatures{mapping=tex-text;}
\fi

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax\else
  \def\UnicodeFontTeXLigatures{+tlig;} % "+trep;" no longer needed
\fi

\def\UnicodeFontFile#1#2{"[#1]:#2"}
\def\UnicodeFontName#1#2{"#1:#2"}

% Alternative luaotfload definitions for LuaLaTeX:
%    \def\UnicodeFontFile#1#2{"file:#1:#2"}
%    \def\UnicodeFontName#1#2{"name:#1:#2"}


%% COMMANDS NEEDED TO DEFINE UNICODE COMMANDS AND ACCENTS

% Accents in Unicode are postpended: 
\def\add@unicode@accent#1#2{#2\char#1\relax}

\def\DeclareUnicodeCommand#1#2{%
  \DeclareTextCommand{#1}{\LastDeclaredEncoding}{#2}%
}

\def\DeclareUnicodeAccent#1#2{%
  \DeclareTextCommand{#1}{\LastDeclaredEncoding}{\add@unicode@accent{#2}}%
}

\def\DeclareUnicodeSymbol#1#2{%
  \DeclareTextSymbol{#1}{\LastDeclaredEncoding}{#2}%
}

\def\DeclareUnicodeComposite#1#2#3{%
  \DeclareTextComposite{#1}{\LastDeclaredEncoding}{#2}{#3}%
}

\def\DeclareUnicodeCompositeCommand#1#2#3{%
  \DeclareTextCompositeCommand{#1}{\LastDeclaredEncoding}{#2}{#3}%
}


%% COMMANDS FOR DEFINING NEW ENCODINGS FROM FONT RANGES

\def\NewUnicodeEncoding#1{%
  \DeclareFontEncoding{#1}{}{}
  \DeclareErrorFont{\LastDeclaredEncoding}{lmr}{m}{n}{10}
  \DeclareFontSubstitution{\LastDeclaredEncoding}{lmr}{m}{n}
  \DeclareFontFamily{\LastDeclaredEncoding}{lmr}{}
  \DeclareFontShape{\LastDeclaredEncoding}{lmr}{m}{n}
       {<->\UnicodeFontFile{lmroman10-regular}{\UnicodeFontTeXLigatures}}{}
  \DeclareFontShape{\LastDeclaredEncoding}{lmr}{m}{it}
       {<->\UnicodeFontFile{lmroman10-italic}{\UnicodeFontTeXLigatures}}{}
  \DeclareFontShape{\LastDeclaredEncoding}{lmr}{m}{sc}
       {<->\UnicodeFontFile{lmromancaps10-regular}{\UnicodeFontTeXLigatures}}{}
  \DeclareFontShape{\LastDeclaredEncoding}{lmr}{bx}{n}
       {<->\UnicodeFontFile{lmroman10-bold}{\UnicodeFontTeXLigatures}}{}
  \DeclareFontShape{\LastDeclaredEncoding}{lmr}{bx}{it}
       {<->\UnicodeFontFile{lmroman10-bolditalic}{\UnicodeFontTeXLigatures}}{}
}

\def\DeclareUnicodeEncoding#1#2#3{%
  \NewUnicodeEncoding{#1}%
  \@for\@ii:=#2\do{%
    \InputIfFileExists{tufontrange-\@ii.def}{}{%
      \@latex@error{Unicode font range file `tufontrange-\@ii.def' not found}{\@ehd}%
    }%
  }%
  #3%
}

%% THE ENCODING ITSELF

\DeclareUnicodeEncoding{\UnicodeEncodingName}{T1,TS1}{}

\endinput