%%
%% 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.
%% 
%% Written in 2009, 2010 by Manuel Pegourie-Gonnard and Elie Roux.
%% 
%% 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,
%%    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}
   [2010/05/10 v0.97 UTF-8 support for luainputenc]

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

\@inpenc@test

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


\gdef\DeclareUnicodeCharacter#1#2{%
 \@tempcnta"#1%
 \luatexbase@directlua{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{%
\luatexbase@directlua{luainputenc.activate_characters()}%
}

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

\def\lIE@CharactersActivated{%
\luatexbase@directlua{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'.
