summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/babel/luababel.def
blob: c5857c196fc366c826e12ef4d02a0aea4bd5550e (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
%%
%% This is file `luababel.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bbunicode.dtx  (with options: `luatex')
%% This is a generated file.
%% 
%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams.
%% Copyright 1989-2008 Johannes L. Braams and any individual authors
%% listed elsewhere in this file.  All rights reserved.
%% 
%% This file was generated from file(s) of the Babel system.
%% ---------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainer of this work is Javier Bezos.
%% 
%% This file may only be distributed together with a copy of the Babel
%% system. You may however distribute the Babel system without
%% such generated files.
%% 
%% The list of all files belonging to the Babel distribution is
%% given in the file `manifest.bbl'. See also `legal.bbl for additional
%% information.
%% 
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% File `bbunicode.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 2103
%%           by Javier Bezos
\directlua{%
  require("luatex-hyphen")
  Babel = {}
  function Babel.bytes(line)
    return line:gsub("(.)",
      function (chr) return unicode.utf8.char(string.byte(chr)) end)
  end
  function Babel.begin_process_input()
    if luatexbase and luatexbase.add_to_callback then
      luatexbase.add_to_callback('process_input_buffer',Babel.bytes,'Babel.bytes')
    else
      Babel.callback = callback.find('process_input_buffer')
      callback.register('process_input_buffer',Babel.bytes)
    end
  end
  function Babel.end_process_input ()
    if luatexbase and luatexbase.remove_from_callback then
      luatexbase.remove_from_callback('process_input_buffer','Babel.bytes')
    else
      callback.register('process_input_buffer',Babel.callback)
    end
  end
}
\def\BabelStringsDefault{unicode}
\let\luabbl@stop\relax
\AddBabelHook{luatex}{encodedcommands}{%
  \def\bbl@tempa{utf8}\def\bbl@tempb{#1}%
  \ifx\bbl@tempa\bbl@tempb\else
    \directlua{Babel.begin_process_input()}%
    \def\luabbl@stop{%
      \directlua{Babel.end_process_input()}}%
  \fi}%
\AddBabelHook{luatex}{stopcommands}{%
  \luabbl@stop
  \let\luabbl@stop\relax}
\AddBabelHook{luatex}{patterns}{%
  \ifx\directlua\relax\else
    \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else
      \global\@namedef{lu@texhyphen@loaded@\the\language}{}%
      \directlua{
        luatexhyphen.loadlanguage('\luatexluaescapestring{\string#1}',
          '\the\language')}%
    \fi
  \fi}
\AddBabelHook{luatex}{adddialect}{%
  \ifx\directlua\relax\else
    \directlua{
      luatexhyphen.adddialect('\luatexluaescapestring{\string#1}',
        '\luatexluaescapestring{\string#2}')
    }%
  \fi}
\AddBabelHook{luatex}{everylanguage}{%
  \directlua{
    processnow = (tex.language == 0) or
      (luatexhyphen.lookupname('\luatexluaescapestring{\string#1}') == nil)}%
  \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax
    \global\@namedef{lu@texhyphen@loaded@\the\language}{}%
  \fi}
\AddBabelHook{luatex}{loadpatterns}{%
  \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax
    \input #1\relax
  \fi}
\AddBabelHook{luatex}{loadexceptions}{%
  \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax
    \input #1\relax
  \fi
  \directlua{processnow = nil}}
\def\babelFSstore#1{%
  \bbl@for\bbl@tempa{#1}{%
    \edef\bbl@tempb{\noexpand\bbl@FSstore{\bbl@tempa}}
    \bbl@tempb{rm}\rmdefault\bbl@save@rmdefault
    \bbl@tempb{sf}\sfdefault\bbl@save@sfdefault
    \bbl@tempb{tt}\ttdefault\bbl@save@ttdefault}}
\def\bbl@FSstore#1#2#3#4{%
  \bbl@csarg\edef{#2default#1}{#3}%
  \expandafter\addto\csname extras#1\endcsname{%
    \let#4#3%
    \ifx#3\f@family
      \edef#3{\csname bbl@#2default#1\endcsname}%
      \fontfamily{#3}\selectfont
    \else
      \edef#3{\csname bbl@#2default#1\endcsname}%
    \fi}%
  \expandafter\addto\csname noextras#1\endcsname{%
    \ifx#3\f@family
      \fontfamily{#4}\selectfont
    \fi
    \let#3#4}}
\let\bbl@langfeatures\@empty
\def\babelFSfeatures{%
  \let\bbl@ori@fontspec\fontspec
  \renewcommand\fontspec[1][]{%
    \bbl@ori@fontspec[\bbl@langfeatures##1]}
  \let\babelFSfeatures\bbl@FSfeatures
  \babelFSfeatures}
\def\bbl@FSfeatures#1#2{%
  \expandafter\addto\csname extras#1\endcsname{%
    \babel@save\bbl@langfeatures
    \edef\bbl@langfeatures{#2,}}}
\endinput
%%
%% End of file `luababel.def'.