summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luainputenc/lutf8x.def
blob: 2f7bf95db30d37e0d099f8bfe2660a88d269edbc (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
%%
%% This is file `lutf8x.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luainputenc.dtx  (with options: `defx')
%% This is a generated file.
%% 
%% Copyright (C) 2009 by Elie Roux <elie.roux@telecom-bretagne.eu>
%% 
%% This work is under the CC0 license. As an exception, the files
%% luainputenc.sty, lutf8.def and lutf8x.def have more restrictions.
%% See these file for more details.
%% 
%% People who helped on this package:
%%   Javier Bezos
%%   Will Robertson
%%   Hans Hagen
%%   Heiko Oberdiek
%%   Javier Mugica
%% 
%% This work consists of the main source file luainputenc.dtx
%% and the derived files
%%    luainputenc.sty, luainputenc.lua, lutf8.def, lutf8x.def,
%%    eu2enc.def, eu2lmr.fd and luainputenc.pdf
%% 
%% This file was adapted from utf8.def, which copyright is:
%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
%% 2004 2005 2006 The LaTeX3 Project.
%%
%% utf8.def is under the lppl version 1.3c or later, and can be found
%% in the base LaTeX system.
%%
%% The lppl can be found at http://www.latex-project.org/lppl.txt
%%
%% The changes to utf8.def are Copyright 2009 Elie Roux, and are under
%% the CC0 license.
%%
%% The changes are LuaTeX support.
%%
%% This file is distributed under the CC0 license, with clause 6 of the
%% lppl as additional restrictions.


\ProvidesFile{lutf8x.def}
   [2009/11/20 v0.95 UTF-8 support for luainputenc]

\makeatletter
\catcode`\ \saved@space@catcode

\@inpenc@test

\ifx\@begindocumenthook\@undefined
  \makeatother
  \endinput \fi


\gdef\DeclareUnicodeCharacter#1#2{%
 \@tempcnta"#1%
 \luadirect{luainputenc.declare_character('\the\@tempcnta')}%
 \catcode\@tempcnta\active %
 \DeclareInputText{\the\@tempcnta}{#2}%
}

\@onlypreamble\DeclareUnicodeCharacter

\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


\def\lIE@ActivateUnicodeCatcodes{%
\luadirect{luainputenc.activate_characters()}%
}

\def\lIE@DesactivateUnicodeCatcodes{%
\luadirect{luainputenc.desactivate_characters()}%
}

\def\lIE@CharactersActivated{%
\luadirect{luainputenc.force_characters_activated()}
}

\edef\lIE@EU{EU2}


\def\DeclareFontEncoding@#1#2#3{%
  \edef\lIE@test{#1}%
  \ifx\lIE@test\lIE@EU %
    \ifx\LastDeclaredEncoding\lIE@EU\else %
      \lIE@CharactersActivated %
      \lIE@DesactivateUnicodeCatcodes %
    \fi
    \gdef\@@enc@update{%
      \edef\lIE@test{#1}%
      \ifx\f@encoding\lIE@EU %
        \lIE@DesactivateUnicodeCatcodes %
       \else %
        \lIE@ActivateUnicodeCatcodes %
      \fi
      \expandafter\let\csname\cf@encoding-cmd\endcsname\@changed@cmd
      \expandafter\let\csname\f@encoding-cmd\endcsname\@current@cmd
      \default@T
      \csname T@\f@encoding\endcsname
      \csname D@\f@encoding\endcsname
      \let\enc@update\relax
      \let\cf@encoding\f@encoding
    }
  \else %
    \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
  \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}

\endinput
%%
%% End of file `lutf8x.def'.