summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/babel/bbunicode.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/babel/bbunicode.dtx')
-rw-r--r--Master/texmf-dist/source/latex/babel/bbunicode.dtx75
1 files changed, 71 insertions, 4 deletions
diff --git a/Master/texmf-dist/source/latex/babel/bbunicode.dtx b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
index 78a4d817f71..5df721e33f2 100644
--- a/Master/texmf-dist/source/latex/babel/bbunicode.dtx
+++ b/Master/texmf-dist/source/latex/babel/bbunicode.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 2013 Javier Bezos and any individual authors
+% Copyright 2013-2014 Javier Bezos and any individual authors
% listed elsewhere in this file. All rights reserved.
%
% This file is part of the Babel system.
@@ -31,12 +31,12 @@
% \iffalse
%<*dtx>
\ProvidesFile{bbunicode.dtx}
- [2013/04/22 v1.0b Babel hooks for Unicode engines]
+ [2014/03/10 v1.0c Babel hooks for Unicode engines]
%</dtx>
%
%% File `bbunicode.dtx'
%% Babel package for LaTeX version 2e
-%% Copyright (C) 2103
+%% Copyright (C) 2103-2014
%% by Javier Bezos
%
%<*filedriver>
@@ -68,6 +68,7 @@
% opti\texttt{}ons aren't ``orthogonal'').
% \end{itemize}
%
+% \begin{macrocode}
%<<*Font selection>>
\def\babelFSstore#1{%
\bbl@for\bbl@tempa{#1}{%
@@ -102,7 +103,7 @@
\babel@save\bbl@langfeatures
\edef\bbl@langfeatures{#2,}}}
%<</Font selection>>
-%
+% \end{macrocode}
% \section{Hooks for XeTeX and LuaTeX}
%
% \subsection{XeTeX}
@@ -110,6 +111,51 @@
% Unfortunately, the current encoding cannot be retrieved and
% therefore it is reset always to |utf8|, which seems a sensible
% default.
+%
+% \LaTeX{} sets many ``codes'' just before loading
+% \verb|hyphen.cfg|. That is not a problem in luatex, but in xetex
+% they must be reset to the proper value. Most of the work is done in
+% \textsf{xe(la)tex.ini}, so here we just ``undo'' some of the
+% changes done by \LaTeX. Anyway, for consistency Lua\TeX{} also
+% resets the catcodes.
+% \changes{bbunicode~1.0c}{2014/03/10}{Reset ``codes'' set by \cs{LaTeX}
+% to what xetex expects. Used also in luatex.}
+% \begin{macrocode}
+%<<*Restore Unicode catcodes before loading patterns>>
+\AddBabelHook{xetex}{loadkernel}{%
+ \begingroup
+ % Reset chars "80-"C0 to category "other", no case mapping:
+ \catcode`\@=11 \count@=128
+ \loop\ifnum\count@<192
+ \global\uccode\count@=0 \global\lccode\count@=0
+ \global\catcode\count@=12 \global\sfcode\count@=1000
+ \advance\count@ by 1 \repeat
+ % Other:
+ \def\O ##1 {%
+ \global\uccode"##1=0 \global\lccode"##1=0
+ \global\catcode"##1=12 \global\sfcode"##1=1000 }%
+ % Letter:
+ \def\L ##1 ##2 ##3 {\global\catcode"##1=11
+ \global\uccode"##1="##2
+ \global\lccode"##1="##3
+ % Uppercase letters have sfcode=999:
+ \ifnum"##1="##3 \else \global\sfcode"##1=999 \fi }%
+ % Letter without case mappings:
+ \def\l ##1 {\L ##1 ##1 ##1 }%
+ \l 00AA
+ \L 00B5 039C 00B5
+ \l 00BA
+ \O 00D7
+ \l 00DF
+ \O 00F7
+ \L 00FF 0178 00FF
+ \endgroup
+ \input #1\relax}
+%<</Restore Unicode catcodes before loading patterns>>
+% \end{macrocode}
+%
+% Now, the code.
+%
% \begin{macrocode}
%<*xetex>
\def\BabelStringsDefault{unicode}
@@ -125,6 +171,7 @@
\AddBabelHook{xetex}{stopcommands}{%
\xebbl@stop
\let\xebbl@stop\relax}
+<@Restore Unicode catcodes before loading patterns@>
<@Font selection@>
%</xetex>
% \end{macrocode}
@@ -135,6 +182,9 @@
% P\'{e}gouri\'{e}-Gonnard. \'{E}lie also improved the code below.
% \changes{bbunicode~1.0b}{2013/04/22}{luatex-hyphen is loaded
% with require. Changes supplied by \'{E}lie Roux.}
+% \changes{bbunicode~1.0c}{2013/04/22}{Defined hook for
+% `initiateactive', to fetch the next token and continue only if
+% letter or other}
%
% \begin{macrocode}
%<*luatex>
@@ -189,6 +239,22 @@
'\luatexluaescapestring{\string#2}')
}%
\fi}
+\AddBabelHook{luatex}{initiateactive}{%
+ \bbl@csarg\edef{doactive#2}{%
+ \futurelet\noexpand\let@token
+ \expandafter\noexpand\csname luabbl@doactive#2\endcsname}%
+ \def\bbl@tempa##1##2{%
+ \@namedef{luabbl@doactive#2}{%
+ \ifcat\noexpand\let@token a%
+ \expandafter##1%
+ \else\ifcat\noexpand\let@token.%
+ \expandafter\expandafter\expandafter##1%
+ \else
+ \expandafter\expandafter\expandafter##2%
+ \fi\fi}}%
+ \@expandtwoargs\bbl@tempa
+ {\expandafter\noexpand\csname user@active#2\endcsname}%
+ {\expandafter\noexpand\csname normal@char#2\endcsname}}
\AddBabelHook{luatex}{everylanguage}{%
\directlua{
processnow = (tex.language == 0) or
@@ -205,6 +271,7 @@
\input #1\relax
\fi
\directlua{processnow = nil}}
+<@Restore Unicode catcodes before loading patterns@>
<@Font selection@>
%</luatex>
% \end{macrocode}