summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/char-ini.mkiv
blob: 0519aaf915fad88b46ce36d4904f1ca89dc7c755 (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
%D \module
%D   [       file=char-ini,
%D        version=2006.08.20,
%D          title=\CONTEXT\ Character Support,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%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 / Initialization}

\registerctxluafile{char-fio}{}
\registerctxluafile{char-map}{} % maybe we will load this someplace else
\registerctxluafile{char-tex}{}
\registerctxluafile{char-ent}{}

\unprotect

% ¨äëïöüÿ
% ´áćéíĺńóŕśúýź
% ˙ċėġiż
% ¯āēīōū
% ˝őű
% ˆâĉêĝĥîĵôŝûŵŷ
% `àèìòùỳ
% ¸çķļņŗşţ
% ˛ąęįų
% ˚åů
% ˘ăĕğĭŏŭ
% ˇčďěľňřšťž
% ˜ãĩñõũ

% \def\checkedchar#1% #2%
%   {\relax\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}}
%
% impossible in math mode so there always fallback (till we have gyre):
%
% use \normalUchar when possible .. the next one is nice for documents and it also accepts
% 0x prefixed numbers

\def\utfchar #1{\clf_utfchar {#1}}
\def\safechar#1{\clf_safechar{#1}}

\unexpanded\def\Ux #1{\Uchar\numexpr"#1\relax} % used in xml
           \def\eUx#1{\Uchar\numexpr"#1\relax} % used in xml

\unexpanded\def\expandUx{\let\Ux\eUx}

\def\checkedchar        {\relax\ifmmode\expandafter\checkedmathchar\else\expandafter\checkedtextchar\fi} % #1#2
\def\checkedmathchar#1#2{#2}
%def\checkedtextchar  #1{\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}}

\unexpanded\def\checkedtextchar#1% #2%
  {\clf_doifelsecharinfont\numexpr#1\relax{\char#1}} % {#2}

\unexpanded\def\textormathchar#1%
  {\relax\ifmmode
     \char#1\relax
   \else\iffontchar\font#1\relax
     \char#1\relax
   \else
     \normalstartimath\char#1\normalstopimath
   \fi\fi}

\unexpanded\def\textormathchars#1%
  {{\font_text_or_mathchars#1\relax}}

\unexpanded\def\font_text_or_mathchars#1#2\relax
  {\relax\ifmmode
     #1#2%
   \else\iffontchar\font`#1\relax
     #1#2\relax
   \else
     \normalstartimath#1#2\normalstopimath
   \fi\fi}

%D The codes are stored in the format, so we don't need to reinitialize
%D them (unless of course we have adapted the table). It is on the agenda
%D to do this with \type {tex.lccode} cum suis once they're available.

% \def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax}
% \def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax }

% Is setting up vrb tpa and tpb needed?

% move to lua side

%clf_setcharactercodes

\clf_setlettercatcodes\texcatcodes
\clf_setlettercatcodes\ctxcatcodes
\clf_setlettercatcodes\notcatcodes
%clf_setlettercatcodes\mthcatcodes
\clf_setlettercatcodes\vrbcatcodes
\clf_setlettercatcodes\prtcatcodes
\clf_setlettercatcodes\tpacatcodes
\clf_setlettercatcodes\tpbcatcodes
\clf_setlettercatcodes\txtcatcodes

\clf_setactivecatcodes\ctxcatcodes
\clf_setactivecatcodes\notcatcodes
\clf_setactivecatcodes\prtcatcodes

\def\chardescription#1{\clf_chardescription#1\relax}

% experiment (watch out: this is global and very font dependent when used with
% casing mechanisms)
%
% \overloaduppercase{0xDF}{0x1E9E}}
% \overloaduppercase{0xDF}{0x53,0x53}

\unexpanded\def\overloaduppercase{\clf_overloaduppercase}
\unexpanded\def\overloadlowercase{\clf_overloadlowercase}

\protect \endinput