summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/inputnormalization/inputnormalization.sty
blob: d35ec6dc525af0289f3c06dadea080bf8fd39f55 (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
%%
%% This is file `inputnormalization.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% inputnormalization.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from inputnormalization.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file inputnormalization.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Copyright (C) 2020--2021 by Marcel Krueger
%%
%% This file 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 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage
  {inputnormalization}
  [2021/07/05 v0.2 Unicode input normalization]
\ifx\directlua\undefined
\ifx\XeTeXinputnormalization\undefined
\PackageError{inputnormalization}{LuaTeX or XeTeX required}%
    {inputnormalization requires LuaTeX or XeTeX.
     Maybe you forgot to switch the engine in your editor?}
\else
  \let\Uinputnormalization\XeTeXinputnormalization
\fi
\else
  \ifx\newluafunction\@undefined
    \input ltluatex
  \fi
  \newcount\Uinputnormalization
  \directlua{
    local getcount = tex.getcount
    local function ident(buf) return buf end
    local uni_normalize = require'lua-uni-normalize'
    local normalize = {[0] = ident, uni_normalize.NFC, uni_normalize.NFD}
    luatexbase.add_to_callback('process_input_buffer', function(buf)
      return normalize[getcount(\the\allocationnumber)](buf)
    end, 'inputnormalization')
  }
\fi
\Uinputnormalization=1
\endinput
%%
%% End of file `inputnormalization.sty'.