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\writestatus{loading}{ConTeXt Encoding Macros Initialization}
36
37\unprotect
38
39
40
41\let\defaultencoding\s!default
42
43
44
45
46\installcorenamespace{accents}
47
48\unexpanded\def\defineaccent#1 #2 #3
49 {\enco_define_accent_command{#1}
50 \enco_define_accent{#1}{#2}{#3}}
51
52\unexpanded\def\enco_define_accent_command#1
53 {\setevalue{\string#1}{\noexpand\enco_handle_accent{\string#1}}}
54
55\unexpanded\def\enco_define_accent#1#2#3
56 {\setvalue{\??accents\string#1\string#2\empty}{#3}}
57
58
59
60\def\enco_handle_accent#1#2
61 {\csname\??accents
62 \ifcsname\??accents\string#1#2\empty\endcsname
63 \string#1#2\empty
64 \else\ifcsname\??accents\string#1\string#2\empty\endcsname
65 \string#1\string#2\empty
66 \else
67 \endcsname#2\csname\??accents
68 \fi\fi
69 \endcsname}
70
71\letvalue{\??accents}\empty
72
73\unexpanded\def\enco_define_command#1#2
74 {\setuvalue{\string#1}{#2}}
75
76\let\dohandleaccent \enco_handle_accent
77\let\dodefineaccent \enco_define_accent
78\let\dodefineaccentcommand\enco_define_accent_command
79\let\dodefinecommand \enco_define_command
80
81\unexpanded\def\definecharacter#1 #2
82 {\doifelsenumber{\string#2}
83 {\setevalue{\string#1}{\utfchar{#2}}}
84 {\setuvalue{\string#1}{#2}}}
85
86\unexpanded\def\definecommand#1 #2
87 {\setuvalue{\string#1}{#2}}
88
89
90
91
92\newtoks \everyuppercase
93\newtoks \everylowercase
94\newtoks \everysanitize
95
96
97
98
99
100
101\newbox\b_enco_accent
102
103\def\buildmathaccent#1
104 {\mathaccent#1 }
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124\unexpanded\def\buildtextaccent#1#2
125 {\dontleavehmode\begingroup
126 \setbox\scratchboxone\hbox{#1}
127 \setbox\scratchboxtwo\hbox{#2}
128 \scratchheight\dimexpr\ht\scratchboxtwo\ht\scratchboxone\relax
129 \scratchdepth \dimexpr\dp\scratchboxtwo\dp\scratchboxone\relax
130 \scratchwidth \wd\scratchboxtwo
131 \hbox to \wd\ifdim\wd\scratchboxone>\wd\scratchboxtwo\scratchboxone\else\scratchboxtwo\fi\bgroup
132 \hss\box\scratchboxtwo\hss
133 \hskip\scratchwidth
134 \hss
135 \ifdim\ht\scratchboxone>\exheight
136
137 \raise\dimexpr\scratchheight\exheight3\relax
138 \else
139 \lower\dimexpr\scratchdepth\exheight3\relax
140 \fi
141 \box\scratchboxone
142 \hss
143 \egroup
144 \endgroup}
145
146\unexpanded\def\bottomaccent#1#2#3#4#5
147 {\dontleavehmode
148 \vtop
149 {\forgetall
150 \baselineskip\zeropoint
151 \lineskip#1
152 \everycr\emptytoks
153 \tabskip\zeropoint
154 \lineskiplimit\zeropoint
155 \setbox0\hbox{#4}
156 \halign
157 {##\crcr\hbox{#5}\crcr
158 \hidewidth
159 \hskip#2\wd0
160 \hskip#3\slantperpoint
161 \vpack to .2\exheight{\box0\vss}\hidewidth
162 \crcr}}}
163
164\unexpanded\def\buildtextmacron {\bottomaccent{.25ex}{0}{15}{\textmacron}}
165\unexpanded\def\buildtextbottomdot {\bottomaccent{.25ex}{0}{5}{\textbottomdot}}
166\unexpanded\def\buildtextcedilla {\bottomaccent{0ex}{0}{5}{\textcedilla}}
167\unexpanded\def\buildtextogonek {\bottomaccent{.1ex}{.5}{0}{\textogonek}}
168\unexpanded\def\buildtextbottomcomma{\bottomaccent{.15ex}{0}{5}{\tx,}}
169
170\let\d\buildtextbottomdot
171
172\unexpanded\def\topaccent#1#2#3#4#5
173 {\dontleavehmode
174 \bgroup
175 \setbox0\hbox{#4}
176 \setbox2\hbox{#5}
177 \hbox to \wd2 \bgroup
178 \hss\copy2\hss
179 \hskip\wd2
180 \hss\hskip#2\wd0\hskip#3\slantperpoint\raise#1\hbox{#4}\hss
181 \egroup
182 \egroup}
183
184\unexpanded\def\buildtextgrave
185 {\topaccent{0pt}{0}{15}{\textgrave}}
186
187\unexpanded\def\definemathaccent#1 #2
188 {\setvalue{#1}{\mathaccent#2 }}
189
190
191
192\definemathaccent acute \mathacute
193\definemathaccent grave \mathgrave
194\definemathaccent ddot \mathddot
195\definemathaccent tilde \mathtilde
196\definemathaccent bar \mathbar
197\definemathaccent breve \mathbreve
198\definemathaccent check \mathcheck
199\definemathaccent hat \mathhat
200\definemathaccent vec \mathvec
201\definemathaccent dot \mathdot
202
203
204
205
206
207\def\AA{Å} \def\aa{å}
208\def\AE{Æ} \def\ae{æ}
209\def\CC{Ç} \def\cc{ç}
210\def \L{Ł} \def \l{ł}
211\def \O{Ø} \def \o{ø}
212\def\OE{Œ} \def\oe{œ}
213\def\SZ{SS} \def\sz{ß} \def\SS{ß}
214\def\IJ{IJ} \def\ij{ij}
215
216
217
218\def\i{ı}
219\def\j{ȷ}
220
221\def\S{§} \def\textS {§}
222\def\P{¶} \def\textP {¶}
223
224\def\eszett {ß} \def\Eszett {SS} \def\Ssharp{SS}
225\def\lslash {ł} \def\Lslash {Ł}
226\def\dslash {đ} \def\Dslash {Đ}
227\def\oslash {ø} \def\Oslash {Ø}
228\def\dcroat {đ} \def\Dcroat {Đ}
229\def\kcedilla{ķ} \def\Kcedilla{Ķ}
230\def\lcedilla{ļ} \def\Lcedilla{Ļ}
231\def\ncedilla{ņ} \def\Ncedilla{Ņ}
232\def\rcedilla{ŗ} \def\Rcedilla{Ŗ}
233\def\aumlaut {ä} \def\Aumlaut {Ä}
234\def\eumlaut {ë} \def\Eumlaut {Ë}
235\def\iumlaut {ï} \def\Iumlaut {Ï}
236\def\oumlaut {ö} \def\Oumlaut {Ö}
237\def\uumlaut {ü} \def\Uumlaut {Ü}
238
239
240
241\def\textflorin{ƒ} \def\florin {ƒ}
242\def\pound {£} \def\sterling{£}
243\def\promille {‰} \def\permille{‰}
244
245
246
247\ifdefined\textpercent
248 \let\percent \textpercent
249 \let\procent \textpercent
250 \let\ampersand \textampersand
251 \let\dollar \textdollar
252 \let\hash \texthash
253\else
254 \def\percent {\textpercent}
255 \def\procent {\textpercent}
256 \def\ampersand {\textampersand}
257 \def\dollar {\textdollar}
258 \def\hash {\texthash}
259\fi
260
261
262
263\unexpanded\def\fakepercent
264 {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern.25\emwidth\kern.2\emwidth\normalsubscript{\scriptscriptstyle0}}}
265
266\unexpanded\def\fakeperthousand
267 {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern.25\emwidth\kern.2\emwidth\normalsubscript{\scriptscriptstyle00}}}
268
269\unexpanded\def\fakepermine
270 {\dontleavehmode
271 \bgroup
272 \setbox\scratchbox\hbox
273 {\mathematics{}}
274 \hbox to \wd\scratchbox
275 {\hss
276 \mathematics{\normalsuperscript{\scriptscriptstyle}\kern.4\emwidth\kern.3\emwidth\normalsubscript{\scriptscriptstyle}}
277 \hss}
278 \egroup}
279
280\def\permine{\fakepermine}
281
282
283
284\ifdefined\softhyphen \else
285 \let\softhyphen\explicitdiscretionary
286\fi
287
288\def\hyphen {\softhyphen}
289\def\compoundwordmark {\hyphen}
290\def\cwm {\hyphen}
291\def\nonbreakinghyphen{\hyphen}
292\def\breakinghyphen {\hyphen\prewordbreak}
293
294
295
296\def\lowerleftsingleninequote {\quotesinglebase}
297\def\lowerleftdoubleninequote {\quotedblbase}
298\def\lowerrightsingleninequote {\quotesinglebase}
299\def\lowerrightdoubleninequote {\quotedblbase}
300
301\def\upperleftsingleninequote {\quoteright}
302\def\upperleftdoubleninequote {\quotedblright}
303\def\upperrightsingleninequote {\quoteright}
304\def\upperrightdoubleninequote {\quotedblright}
305
306\def\upperleftsinglesixquote {\quoteleft}
307\def\upperleftdoublesixquote {\quotedblleft}
308\def\upperrightsinglesixquote {\quoteleft}
309\def\upperrightdoublesixquote {\quotedblleft}
310
311\def\leftsubguillemot {\guilsingleleft}
312\def\rightsubguillemot {\guilsingleright}
313
314
315
316\unexpanded\def\textblacksquare {\dontleavehmode\hbox{\vrule\s!width.3\s!em\s!height.4\s!em\s!depth.1\s!em}}
317
318\unexpanded\def\schwagrave {\buildtextgrave\schwa}
319
320\chardef\textcontrolspace"2423
321
322\installcorenamespace{controlspace}
323
324
325
326
327\unexpanded\def\fallbackcontrolspace
328 {\hbox to \interwordspace \bgroup
329 \hss
330 \ifcsname\??controlspace\number\interwordspace\endcsname
331 \csname\??controlspace\number\interwordspace\endcsname
332 \else
333 \enco_fast_control_space_define
334 \fi
335 \textcontrolspace
336 \hss
337 \egroup}
338
339\unexpanded\def\enco_fast_control_space_define
340 {\scratchdimen\interwordspace
341 \definedfont[LMTypewriterRegular at \the\dimexpr\currentfontbodyscale\dimexpr\fontbody]
342 \expandafter\glet\csname\??controlspace\number\scratchdimen\endcsname\lastrawfontcall}
343
344\unexpanded\def\normalcontrolspace
345 {\iffontchar\font\textcontrolspace
346 \textcontrolspace
347 \else
348 \fallbackcontrolspace
349 \fi}
350
351\let\textvisiblespace\normalcontrolspace
352
353\unexpanded\def\optionalcontrolspace
354 {\iffontchar\font\textcontrolspace
355 \textcontrolspace
356 \else
357 \asciispacechar
358 \fi}
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401\clf_defineaccents
402
403
404
405\unexpanded\def\fakeunderscore
406 {\relax\ifmmode
407 \vrule\s!depth .12\fontexheight\mathstylefont\normalmathstyle\s!width \fontinterwordspace\mathstylefont\normalmathstyle\s!height\zeropoint\relax
408 \else
409 \dontleavehmode\hbox{\vrule\s!depth .12\fontexheight\font\s!width \fontinterwordspace\font\s!height\zeropoint}
410 \fi}
411
412\unexpanded\def\fakeunderscores{\let\_\fakeunderscore}
413\unexpanded\def\textunderscores{\let\_\textunderscore}
414
415\textunderscores
416
417\ifdefined\mathunderscore \else \let\mathunderscore\fakeunderscore \fi
418\ifdefined\textunderscore \else \let\textunderscore\fakeunderscore \fi
419
420\unexpanded\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi}
421
422\let\_\normalunderscore
423
424
425
426\unexpanded\def\textminus
427 {\char \iffontchar\font"2012 "2012
428 \else\iffontchar\font"2013 "2013
429 \else\iffontchar\font"2212 "2212
430 \else "002D
431 \fi\fi\fi}
432
433\unexpanded\def\textplus
434 {\char"002B }
435
436
437
438\unexpanded\def\celsius #1{#1\mathematics{\circ}C}
439\unexpanded\def\inch {\mathematics{\prime\prime}}
440\unexpanded\def\fraction#1#2{\mathematics{#1\over#2}}
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484\def\periodswidth {.5\emwidth}
485\def\periodsdefault{3}
486
487\installcorenamespace {periods}
488
489\installsetuponlycommandhandler \??periods {periods}
490
491\setupperiods
492 [\c!n=\periodsdefault,
493 \c!width=\periodswidth,
494 \c!distance=.25\emwidth,
495 \c!symbol=.]
496
497\unexpanded\def\periods
498 {\dontleavehmode
499 \hbox\bgroup
500 \doifelsenextoptional\enco_periods_yes\enco_periods_nop}
501
502\unexpanded\def\enco_periods_yes[#1]
503 {\doifelseassignment{#1}
504 {\setupcurrentperiods[#1]
505 \scratchcounter\periodsparameter\c!n}
506 {\doifelsenothing{#1}
507 {\scratchcounter\periodsparameter\c!n}
508 {\scratchcounter#1}}
509 \enco_periods_finish}
510
511\unexpanded\def\enco_periods_nop
512 {\scratchcounter\periodsparameter\c!n
513 \enco_periods_finish}
514
515\unexpanded\def\enco_periods_finish
516 {\edef\p_width{\periodsparameter\c!width}
517 \ifx\p_width\v!fit
518 \enco_periods_finish_fit
519 \else
520 \enco_periods_finish_width
521 \fi
522 \egroup}
523
524\unexpanded\def\enco_periods_finish_width
525 {\setbox\scratchbox\hbox to \p_width
526 {\hss\periodsparameter\c!symbol\hss}
527 \dorecurse\scratchcounter{\copy\scratchbox}}
528
529\unexpanded\def\enco_periods_finish_fit
530 {\edef\p_symbol{\periodsparameter\c!symbol}
531 \scratchdistance\periodsparameter\c!distance
532 \hskip\scratchdistance
533 \dorecurse\scratchcounter{\p_symbol\hskip\scratchdistance}}
534
535\unexpanded\def\unknown
536 {\dontleavehmode
537 \hbox\bgroup
538 \enco_periods_nop}
539
540
541
542\unexpanded\def\ampersand{\mathortext\mathampersand\textampersand}
543
544
545
546\appendtoks
547 \let\buildtextaccent\secondoftwoarguments
548\to \everysimplifycommands
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575\protect \endinput
576 |