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\writestatus{loading}{ConTeXt Encoding Macros Initialization}
35
36\unprotect
37
38
39
40\immutable\let\defaultencoding\s!default
41
42
43
44
45
46
47\installcorenamespace{accents}
48
49
50
51\permanent\protected\def\defineaccent#1 #2 #3
52 {\dodefineaccentcommand{#1}
53 \dodefineaccent{#1}{#2}{#3}}
54
55\permanent\protected\def\dodefineaccentcommand#1
56 {\ifcsname\string#1\endcsname\else
57 \edefcsname\string#1\endcsname{\noexpand\dohandleaccent{\string#1}}
58 \fi}
59
60\permanent\protected\def\dodefineaccent#1#2#3
61 {\defcsname\??accents\string#1\string#2\empty\endcsname{#3}}
62
63\permanent\protected\def\dohandleaccent#1#2
64 {\csname\??accents
65 \ifcsname\??accents\string#1#2\empty\endcsname
66 \string#1#2\empty
67 \orelse\ifcsname\??accents\string#1\string#2\empty\endcsname
68 \string#1\string#2\empty
69 \else
70 \endcsname#2\csname\??accents
71 \fi
72 \endcsname}
73
74\immutable\letcsname\??accents\endcsname\empty
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89\permanent\protected\def\dodefinecombine#1#2
90 {\ifcsname\string#1\endcsname\else
91 \permanent\protected\defcsname with#1\endcsname##1{\chr{##1#2}}
92 \fi}
93
94
95
96
97\permanent\protected\def\definecharacter#1 #2
98 {\doifelsenumber{\string#2}
99 {\edefcsname\string#1\endcsname{\tocharacter#2}}
100 {\protected\defcsname\string#1\endcsname{#2}}}
101
102
103
104
105\permanent\protected\def\definecommand#1 #2
106 {\protected\defcsname\string#1\endcsname{#2}}
107
108\permanent\protected\def\dodefinecommand#1#2
109 {
110 \frozen\protected\defcsname\string#1\endcsname{#2}}
111
112
113
114\clf_defineaccents
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138\pushoverloadmode
139
140\suggestedalias \` \withgrave
141\suggestedalias \' \withacute
142\suggestedalias \^ \withcircumflex
143\suggestedalias \~ \withtilde
144\suggestedalias \= \withmacron
145\suggestedalias \u \withbreve
146\suggestedalias \. \withdot
147\suggestedalias \" \withdieresis
148\suggestedalias \r \withring
149\suggestedalias \H \withdoubleacute
150\suggestedalias \v \withcaron
151\suggestedalias \c \withcedilla
152\suggestedalias \k \withogonek
153\suggestedalias \d \withdotbelow
154
155\popoverloadmode
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183\newbox\b_enco_accent
184
185
186
187
188\permanent\protected\def\buildtextaccent#1#2
189 {\dontleavehmode\begingroup
190 \setbox\scratchboxone\hbox{#1}
191 \setbox\scratchboxtwo\hbox{#2}
192 \scratchheight\dimexpr\ht\scratchboxtwo\ht\scratchboxone\relax
193 \scratchdepth \dimexpr\dp\scratchboxtwo\dp\scratchboxone\relax
194 \scratchwidth \wd\scratchboxtwo
195 \hbox to \wd\ifdim\wd\scratchboxone>\wd\scratchboxtwo\scratchboxone\else\scratchboxtwo\fi\bgroup
196 \hss\box\scratchboxtwo\hss
197 \hskip\scratchwidth
198 \hss
199 \ifdim\ht\scratchboxone>\exheight
200
201 \raise\dimexpr\scratchheight\exheight3\relax
202 \else
203 \lower\dimexpr\scratchdepth\exheight3\relax
204 \fi
205 \box\scratchboxone
206 \hss
207 \egroup
208 \endgroup}
209
210\permanent\protected\def\bottomaccent#1#2#3#4#5
211 {\dontleavehmode
212 \vtop
213 {\forgetall
214 \baselineskip\zeroskip
215 \lineskip#1\relax
216 \everycr\emptytoks
217 \tabskip\zeroskip
218 \lineskiplimit\zeropoint
219 \setbox0\hbox{#4}
220 \halign
221 {##\crcr\hbox{#5}\crcr
222 \hskip\hideskip
223 \hskip#2\wd0
224 \hskip#3\slantperpoint
225 \vpack to .2\exheight{\box0\vss}
226 \hskip\hideskip
227 \crcr}}}
228
229\permanent\protected\def\buildtextmacron {\bottomaccent{.25ex}{0}{15}{\textmacron}}
230\permanent\protected\def\buildtextbottomdot {\bottomaccent{.25ex}{0}{5}{\textbottomdot}}
231\permanent\protected\def\buildtextcedilla {\bottomaccent{0ex}{0}{5}{\textcedilla}}
232\permanent\protected\def\buildtextogonek {\bottomaccent{.1ex}{.5}{0}{\textogonek}}
233\permanent\protected\def\buildtextbottomcomma{\bottomaccent{.15ex}{0}{5}{\tx,}}
234
235\permanent\protected\def\topaccent#1#2#3#4#5
236 {\dontleavehmode
237 \bgroup
238 \setbox0\hbox{#4}
239 \setbox2\hbox{#5}
240 \hbox to \wd2 \bgroup
241 \hss\copy2\hss
242 \hskip\wd2
243 \hss\hskip#2\wd0\hskip#3\slantperpoint\raise#1\hbox{#4}\hss
244 \egroup
245 \egroup}
246
247\permanent\protected\def\buildtextgrave
248 {\topaccent{0pt}{0}{15}{\textgrave}}
249
250\permanent\protected\def\definemathaccent#1 #2
251 {\defcsname#1\endcsname{\mathaccent#2 }}
252
253
254
255
256
257
258
259
260
261\immutable\def\eszett {ß} \immutable\def\Eszett {SS} \permanent\def\Ssharp{SS}
262\immutable\def\lslash {ł} \immutable\def\Lslash {Ł}
263\immutable\def\dslash {đ} \immutable\def\Dslash {Đ}
264
265\immutable\def\dcroat {đ} \immutable\def\Dcroat {Đ}
266\immutable\def\kcedilla{ķ} \immutable\def\Kcedilla{Ķ}
267\immutable\def\lcedilla{ļ} \immutable\def\Lcedilla{Ļ}
268\immutable\def\ncedilla{ņ} \immutable\def\Ncedilla{Ņ}
269\immutable\def\rcedilla{ŗ} \immutable\def\Rcedilla{Ŗ}
270\immutable\def\aumlaut {ä} \immutable\def\Aumlaut {Ä}
271\immutable\def\eumlaut {ë} \immutable\def\Eumlaut {Ë}
272\immutable\def\iumlaut {ï} \immutable\def\Iumlaut {Ï}
273\immutable\def\oumlaut {ö} \immutable\def\Oumlaut {Ö}
274\immutable\def\uumlaut {ü} \immutable\def\Uumlaut {Ü}
275
276
277
278\immutable\def\textflorin{ƒ} \immutable\def\florin {ƒ}
279\immutable\def\pound {£} \immutable\def\sterling{£}
280\immutable\def\promille {‰} \immutable\def\permille{‰}
281
282
283
284\pushoverloadmode
285
286\permanent\protected\def\ampersand{\mathortext\mathampersand\textampersand}
287
288\immutable\let\percent\textpercent
289\immutable\let\procent\textpercent
290\immutable\let\dollar \textdollar
291\immutable\let\hash \texthash
292
293\popoverloadmode
294
295
296
297\ifdefined\softhyphen \else
298 \aliased\let\softhyphen\explicitdiscretionary
299\fi
300
301
302
303\aliased\let\hyphen \softhyphen
304
305
306
307
308
309
310
311
312
313
314
315
316
317\aliased\let\lowerleftsingleninequote \quotesinglebase
318\aliased\let\lowerleftdoubleninequote \quotedblbase
319\aliased\let\lowerrightsingleninequote\quotesinglebase
320\aliased\let\lowerrightdoubleninequote\quotedblbase
321
322\aliased\let\upperleftsingleninequote \quoteright
323\aliased\let\upperleftdoubleninequote \quotedblright
324\aliased\let\upperrightsingleninequote\quoteright
325\aliased\let\upperrightdoubleninequote\quotedblright
326
327\aliased\let\upperleftsinglesixquote \quoteleft
328\aliased\let\upperleftdoublesixquote \quotedblleft
329\aliased\let\upperrightsinglesixquote \quoteleft
330\aliased\let\upperrightdoublesixquote \quotedblleft
331
332\aliased\let\leftsubguillemot \guilsingleleft
333\aliased\let\rightsubguillemot \guilsingleright
334
335
336
337\permanent\protected\def\textblacksquare{\dontleavehmode\hpack{\vrule\s!width.3\s!em\s!height.4\s!em\s!depth.1\s!em}}
338
339\permanent\protected\def\schwagrave {\buildtextgrave\schwa}
340
341\installcorenamespace{controlspace}
342
343\permanent\protected\def\fallbackcontrolspace
344 {\hbox to \interwordspace \bgroup
345 \hss
346 \ifcsname\??controlspace\number\interwordspace\endcsname
347 \csname\??controlspace\number\interwordspace\endcsname
348 \else
349 \enco_fast_control_space_define
350 \fi
351 \textcontrolspace
352 \hss
353 \egroup}
354
355\protected\def\enco_fast_control_space_define
356 {\scratchdimen\interwordspace
357 \definedfont[LMTypewriterRegular at \the\dimexpr\currentfontbodyscale\dimexpr\fontbody]
358 \gletcsname\??controlspace\number\scratchdimen\endcsname\lastrawfontcall}
359
360\permanent\protected\def\normalcontrolspace
361 {\iffontchar\font\numexpr\expandafter\textcontrolspace\relax
362 \textcontrolspace
363 \else
364 \fallbackcontrolspace
365 \fi}
366
367\aliased\let\textvisiblespace\normalcontrolspace
368
369\permanent\protected\def\optionalcontrolspace
370 {\iffontchar\font\numexpr\expandafter\textcontrolspace\relax
371 \textcontrolspace
372 \else
373 \asciispacechar
374 \fi}
375
376
377
378\permanent\protected\def\fakeunderscore
379 {\relax\ifmmode
380 \vrule\s!depth .12\fontexheight\mathstylefont\normalmathstyle\s!width \fontinterwordspace\mathstylefont\normalmathstyle\s!height\zeropoint\relax
381 \else
382 \dontleavehmode\hbox{\vrule\s!depth .12\fontexheight\font\s!width \fontinterwordspace\font\s!height\zeropoint}
383 \fi}
384
385\permanent\protected\def\fakeunderscores{\enforced\let\_\fakeunderscore}
386\permanent\protected\def\textunderscores{\enforced\let\_\textunderscore}
387
388\textunderscores
389
390\ifdefined\mathunderscore \else \aliased\let\mathunderscore\fakeunderscore \fi
391\ifdefined\textunderscore \else \aliased\let\textunderscore\fakeunderscore \fi
392
393\permanent\protected\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi}
394
395\pushoverloadmode
396 \enforced\let\_\normalunderscore
397\popoverloadmode
398
399
400
401\pushoverloadmode
402
403\permanent\protected\def\textminus
404 {\char
405 \iffontchar\font"2012 "2012 \orelse
406 \iffontchar\font"2013 "2013 \orelse
407 \iffontchar\font"2212 "2212 \else
408 "002D \fi}
409
410\permanent\protected\def\textplus
411 {\char"002B }
412
413\popoverloadmode
414
415
416
417
418
419
420
421\permanent\protected\def\celsius #1{#1\iffontchar\font℃℃\else\mathematics{\circ}C\fi}
422\permanent\protected\def\inch {\iffontchar\font″″\else\mathematics{\prime\prime}\fi}
423\permanent\protected\def\fraction#1#2{\mathematics{\Uabove exact .125\exheight {#1}{#2}}}
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439\installcorenamespace {periods}
440
441\installsetuponlycommandhandler \??periods {periods}
442
443\setupperiods
444 [\c!n=3,
445 \c!width=.5\emwidth,
446 \c!distance=.25\emwidth,
447 \c!symbol=.]
448
449\permanent\protected\def\periods
450 {\dontleavehmode
451 \hbox\bgroup
452 \doifelsenextoptional\enco_periods_yes\enco_periods_nop}
453
454\protected\def\enco_periods_yes[#1]
455 {\doifelseassignment{#1}
456 {\setupcurrentperiods[#1]
457 \scratchcounter\periodsparameter\c!n}
458 {\scratchcounter\ifempty{#1}\periodsparameter\c!n\else#1\fi}
459 \enco_periods_finish}
460
461\protected\def\enco_periods_nop
462 {\scratchcounter\periodsparameter\c!n
463 \enco_periods_finish}
464
465\protected\def\enco_periods_finish
466 {\edef\p_width{\periodsparameter\c!width}
467 \ifx\p_width\v!fit
468 \enco_periods_finish_fit
469 \else
470 \enco_periods_finish_width
471 \fi
472 \egroup}
473
474\protected\def\enco_periods_finish_width
475 {\setbox\scratchbox\hbox to \p_width
476 {\hss\periodsparameter\c!symbol\hss}
477 \dorecurse\scratchcounter{\copy\scratchbox}}
478
479\protected\def\enco_periods_finish_fit
480 {\edef\p_symbol{\periodsparameter\c!symbol}
481 \scratchdistance\periodsparameter\c!distance
482 \hskip\scratchdistance
483 \dorecurse\scratchcounter{\p_symbol\hskip\scratchdistance}}
484
485\permanent\protected\def\unknown
486 {\dontleavehmode
487 \hbox\bgroup
488 \enco_periods_nop}
489
490
491
492\appendtoks
493 \enforced\let\buildtextaccent\secondoftwoarguments
494\to \everysimplifycommands
495
496
497
498\protect \endinput
499 |