char-ini.mkiv /size: 4083 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=char-ini,
3
%D version=2006.08.20,
4
%D title=\CONTEXT\ Character Support,
5
%D subtitle=Initialization,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\writestatus
{
loading
}{
ConTeXt
Character
Support
/
Initialization
}
15 16
\registerctxluafile
{
char
-
fio
}{}
17
\registerctxluafile
{
char
-
map
}{}
% maybe we will load this someplace else
18
\registerctxluafile
{
char
-
tex
}{}
19
\registerctxluafile
{
char
-
ent
}{}
20 21
\unprotect
22 23
% ¨äëïöüÿ
24
% ´áćéíĺńóŕśúýź
25
% ˙ċėġiż
26
% ¯āēīōū
27
% ˝őű
28
% ˆâĉêĝĥîĵôŝûŵŷ
29
% `àèìòùỳ
30
% ¸çķļņŗşţ
31
% ˛ąęįų
32
% ˚åů
33
% ˘ăĕğĭŏŭ
34
% ˇčďěľňřšťž
35
% ˜ãĩñõũ
36 37
% \def\checkedchar#1% #2%
38
% {\relax\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}}
39
%
40
% impossible in math mode so there always fallback (till we have gyre):
41
%
42
% use \normalUchar when possible .. the next one is nice for documents and it also accepts
43
% 0x prefixed numbers
44 45
\def
\utfchar
#
1
{
\clf_utfchar
{
#
1
}}
46
\def
\safechar
#
1
{
\clf_safechar
{
#
1
}}
47 48
\unexpanded
\def
\Ux
#
1
{
\Uchar\numexpr
"#
1
\relax
}
% used in xml
49
\def
\eUx
#
1
{
\Uchar\numexpr
"#
1
\relax
}
% used in xml
50 51
\unexpanded
\def
\expandUx
{
\let
\Ux\eUx
}
52 53
\def
\checkedchar
{
\relax\ifmmode\expandafter
\checkedmathchar
\else\expandafter
\checkedtextchar
\fi
}
% #1#2
54
\def
\checkedmathchar
#
1
#
2
{
#
2
}
55
%def\checkedtextchar #1{\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}}
56 57
\unexpanded
\def
\checkedtextchar
#
1
% #2%
58
{
\clf_doifelsecharinfont
\numexpr
#
1
\relax
{
\char
#
1
}}
% {#2}
59 60
% \unexpanded\def\textormathchar#1%
61
% {\relax\ifmmode
62
% \char#1\relax
63
% \else\iffontchar\font#1\relax
64
% \char#1\relax
65
% \else
66
% \normalstartimath\char#1\normalstopimath
67
% \fi\fi}
68 69
\newconditional
\prefermathovertextchar
70 71
\unexpanded
\def
\textormathchar
#
1
%
72
{
\begingroup
73
\scratchcounter
#
1
\relax
74
\ifmmode
75
\char
\scratchcounter
76
\else
77
\ifconditional
\prefermathovertextchar
78
% dirty trick .. maybe let this adapt to bf too ?
79
\setfontid\fontid\textfont
\c_font_fam_mr
80
\fi
81
\iffontchar
\font
\scratchcounter
82
\char
\scratchcounter
83
\else
84
\normalstartimath
\char
\scratchcounter\normalstopimath
85
\fi
86
\fi
87
\endgroup
}
88 89
\unexpanded
\def
\textormathchars
#
1
%
90
{{
\font_text_or_mathchars
#
1
\relax
}}
91 92
\unexpanded
\def
\font_text_or_mathchars
#
1
#
2
\relax
93
{
\relax\ifmmode
94
#
1
#
2
%
95
\else\iffontchar\font
`
#
1
\relax
96
#
1
#
2
\relax
97
\else
98
\normalstartimath
#
1
#
2
\normalstopimath
99
\fi\fi
}
100 101
%D The codes are stored in the format, so we don't need to reinitialize
102
%D them (unless of course we have adapted the table). It is on the agenda
103
%D to do this with \type {tex.lccode} cum suis once they're available.
104 105
% \def\setcclcuc#1#2#3{\global\catcode#1=\lettercatcode\global\lccode#1=#2\global\uccode#1=#3\relax}
106
% \def\setcclcucself#1{\global\catcode#1=\lettercatcode\global\lccode#1=#1\global\uccode#1=#1\relax }
107 108
% Is setting up vrb tpa and tpb needed?
109 110
% move to lua side
111 112
%clf_setcharactercodes
113 114
\clf_setlettercatcodes
\texcatcodes
115
\clf_setlettercatcodes
\ctxcatcodes
116
\clf_setlettercatcodes
\notcatcodes
117
%clf_setlettercatcodes\mthcatcodes
118
\clf_setlettercatcodes
\vrbcatcodes
119
\clf_setlettercatcodes
\prtcatcodes
120
\clf_setlettercatcodes
\tpacatcodes
121
\clf_setlettercatcodes
\tpbcatcodes
122
\clf_setlettercatcodes
\txtcatcodes
123 124
\clf_setactivecatcodes
\ctxcatcodes
125
\clf_setactivecatcodes
\notcatcodes
126
\clf_setactivecatcodes
\prtcatcodes
127 128
\def
\chardescription
#
1
{
\clf_chardescription
#
1
\relax
}
129 130
% experiment (watch out: this is global and very font dependent when used with
131
% casing mechanisms)
132
%
133
% \overloaduppercase{0xDF}{0x1E9E}}
134
% \overloaduppercase{0xDF}{0x53,0x53}
135 136
\unexpanded
\def
\overloaduppercase
{
\clf_overloaduppercase
}
137
\unexpanded
\def
\overloadlowercase
{
\clf_overloadlowercase
}
138 139
\protect
\endinput
140