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
|
%D \module
%D [ file=char-utf,
%D version=2006.12.05,
%D title=\CONTEXT\ Character Support,
%D subtitle=Unicode UTF,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright=PRAGMA]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\writestatus{loading}{ConTeXt Character Support / Unicode UTF}
%D After a bit of experimenting we reached a clean state where \UTF\
%D 8, 16 and 32 were supported as well as collapsing (combining
%D sequences). Writing the code was a relaxed experience, not in the
%D last place because it was accompanied by listening to those nice
%D Vienna Teng cd's (who decided that making music was more fun than
%D programming, but then, she may not know \TEX\ and \LUA).
\unprotect
\registerctxluafile{char-utf}{1.001}
%D We enable collapsing (combining characters) by default, but
%D since the source files are rather simple, we postpone the
%D initialization till runtime.
% resolvers.filters.install('utf',characters.filters.utf.collapse)
% \appendtoks
% \ctxlua{
% local textfileactions = resolvers.openers.helpers.textfileactions
% utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.collapse")
% utilities.sequencers.enableaction(textfileactions,"characters.filters.utf.decompose")
% }%
% \to \everyjob
\appendtoks
\ctxlua{characters.filters.utf.enable()}%
\to \everyjob
%D The next one influences input parsing.
%D
%D \starttyping
%D \definecomposedutf 318 108 126 % lcaron
%D \stoptyping
\unexpanded\def\definecomposedutf#1 #2 #3 %
{\ctxlua{characters.filters.utf.addgrapheme("#1","#2","#3")}}
\protect
|