enco-ini.mkiv /size: 17 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=enco-ini,
3
%D version=2007.02.19, % 2000.12.27, % 1998.12.03,
4
%D title=\CONTEXT\ Encoding Macros,
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
%D This is stripped down version of th eoriginal enco-ini.tex
15
%D file. For more details you might want to study the \MKII\ file
16
%D but since \LUATEX\ is unicode inside we need less code.
17 18
% When dealing with characters we have four cases to take into account
19
% when moving from mkii to mkiv:
20 21
% 1. <byte 200> => ref to slot 200 in current font
22
% 2. \char 200 => ref to slot 200 in current font
23
% 3. <active 200> => can (e.g.) map to another slot in current font
24
% 4. \namedglyph => can map to some slot in some font
25 26
% Using case 2 for special characters is doomed to fail because we are not going
27
% to intercept these on the fly as happens automatically with traditional font
28
% encoding handling. We could do that in a node pass but it's not worth the effort
29
% because we seldom use this case in a document source.
30 31
% We can consider using utf as internal format for mkii. The main reason for not
32
% doing this before was that it was slow. On the other hand, it would make dealing
33
% with utility files easier. However, we've now kind of frozen mkii.
34 35
\writestatus
{
loading
}{
ConTeXt
Encoding
Macros
/
Initialization
}
36 37
\unprotect
38 39
%D Obsolete (but sometimes used in styles)
40 41
\let
\defaultencoding
\s!default
42 43
%D \macros
44
%D {defineaccent, definecharacter, definecommand}
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
% no spaces, used low level
56
{
\setvalue
{
\??accents
\string
#
1
\string
#
2
\empty
}{
#
3
}}
57 58
% the following dirty trick is needed to catch \asciimath{\^{1/5}log}:
59 60
\def
\enco_handle_accent
#
1
#
2
% expandable because we want them in the tuc file
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
% very dirty trick: ignore accent but keep char
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
% maybe useful
77
\let
\dodefineaccent
\enco_define_accent
% used at the lua end
78
\let
\dodefineaccentcommand
\enco_define_accent_command
% used at the lua end
79
\let
\dodefinecommand
\enco_define_command
% used at the lua end
80 81
\unexpanded
\def
\definecharacter
#
1
#
2
%
82
{
\doifelsenumber
{
\string
#
2
}
83
{
\setevalue
{
\string
#
1
}{
\utfchar
{
#
2
}}}
% or {\expandafter\chardef\csname#1\endcsname#2\relax}
84
{
\setuvalue
{
\string
#
1
}{
#
2
}}}
85 86
\unexpanded
\def
\definecommand
#
1
#
2
%
87
{
\setuvalue
{
\string
#
1
}{
#
2
}}
88 89
%D \macros
90
%D {everyuppercase, everylowercase, everysanitize}
91 92
\newtoks
\everyuppercase
93
\newtoks
\everylowercase
94
\newtoks
\everysanitize
95 96
%D Accent handling (try to avoid this):
97 98
% \buildtextaccent\greekdasia\greekalphamacron
99
% \buildtextaccent\textacute q
100 101
\newbox
\b_enco_accent
102 103
\def
\buildmathaccent
#
1
%
104
{
\mathaccent
#
1
}
105 106
% \unexpanded\def\buildtextaccent#1#2% we could do all at the lua end
107
% {\begingroup % but that's no fun (yet)
108
% \setbox\b_enco_accent\hbox{#1}%
109
% \scratchcounter\cldcontext{nodes.firstcharinbox(\number\b_enco_accent)}\relax
110
% \ifcase\scratchcounter\else\accent\scratchcounter\fi
111
% \relax#2%
112
% \endgroup}
113 114
% \unexpanded\def\buildtextaccent#1#2% we could do all at the lua end
115
% {\begingroup % but that's no fun (yet)
116
% \setbox\b_enco_accent\hbox{#1}%
117
% \clf_buildtextaccent\b_enco_accent#2%
118
% \endgroup}
119
%
120
% This one can handle font collections too. The accent command is a scanner
121
% and the same font and otherwise discards the character (imo it could
122
% better drop the accent).
123 124
\unexpanded
\def
\buildtextaccent
#
1
#
2
% we could do all at the lua end
125
{
\dontleavehmode
\begingroup
% but that's no fun (yet)
126
\setbox
\scratchboxone
\hbox
{
#
1
}
% accent
127
\setbox
\scratchboxtwo
\hbox
{
#
2
}
% character
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
% top accent
137
\raise\dimexpr
\scratchheight
+
\exheight
/
3
\relax
138
\else
139
\lower
-
\dimexpr
\scratchdepth
+
\exheight
/
3
\relax
140
\fi
141
\box
\scratchboxone
142
\hss
143
\egroup
144
\endgroup
}
145 146
\unexpanded
\def
\bottomaccent
#
1
#
2
#
3
#
4
#
5
% down right slantcorrection accent char
147
{
\dontleavehmode
% why this align mess
148
\vtop
149
{
\forgetall
150
\baselineskip
\zeropoint
151
\lineskip
#
1
%
152
\everycr
\emptytoks
153
\tabskip
\zeropoint
154
\lineskiplimit
\zeropoint
155
\setbox
0
\hbox
{
#
4
}
%
156
\halign
157
{
##
\crcr\hbox
{
#
5
}
\crcr
158
\hidewidth
159
\hskip
#
2
\wd
0
160
\hskip
-
#
3
\slantperpoint
% in plain 1ex * dimenless value
161
\vpack
to
.
2
\exheight
{
\box
0
\vss
}
\hidewidth
162
\crcr
}}}
163 164
\unexpanded
\def
\buildtextmacron
{
\bottomaccent
{
.
2
5
ex
}{
0
}{
1
5
}{
\textmacron
}}
165
\unexpanded
\def
\buildtextbottomdot
{
\bottomaccent
{
.
2
5
ex
}{
0
}{
5
}{
\textbottomdot
}}
166
\unexpanded
\def
\buildtextcedilla
{
\bottomaccent
{
0
ex
}{
0
}{
5
}{
\textcedilla
}}
167
\unexpanded
\def
\buildtextogonek
{
\bottomaccent
{
-
.
1
ex
}{
.
5
}{
0
}{
\textogonek
}}
168
\unexpanded
\def
\buildtextbottomcomma
{
\bottomaccent
{
.
1
5
ex
}{
0
}{
5
}{
\tx
,
}}
169 170
\let
\d\buildtextbottomdot
171 172
\unexpanded
\def
\topaccent
#
1
#
2
#
3
#
4
#
5
% down right slantcorrection accent char
173
{
\dontleavehmode
174
\bgroup
175
\setbox
0
\hbox
{
#
4
}
%
176
\setbox
2
\hbox
{
#
5
}
%
177
\hbox
to
\wd
2
\bgroup
178
\hss\copy
2
\hss
179
\hskip
-
\wd
2
180
\hss\hskip
#
2
\wd
0
\hskip
-
#
3
\slantperpoint
\raise
#
1
\hbox
{
#
4
}
\hss
181
\egroup
182
\egroup
}
183 184
\unexpanded
\def
\buildtextgrave
185
{
\topaccent
{
0
pt
}{
0
}{
1
5
}{
\textgrave
}}
% e.g.
186 187
\unexpanded
\def
\definemathaccent
#
1
#
2
%
188
{
\setvalue
{
#
1
}{
\mathaccent
#
2
}}
189 190
%D Math (will move):
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
% \definemathaccent widetilde \mathwidetilde
203
% \definemathaccent widehat \mathwidehat
204 205
% from enco-com:
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
% from enco-def:
217 218
\def
\i
{
ı
}
219
\def
\j
{
ȷ
}
220 221
\def
\S
{
§
}
\def
\textS
{
§
}
% obsolete (surfaced in bibliographic files)
222
\def
\P
{
}
\def
\textP
{
}
% obsolete (surfaced in bibliographic files)
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
% for old times sake (obsolete)
240 241
\def
\textflorin
{
ƒ
}
\def
\florin
{
ƒ
}
242
\def
\pound
{
£
}
\def
\sterling
{
£
}
243
\def
\promille
{
}
\def
\permille
{
}
244 245
% tex specific
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
% from enco-mis:
262 263
\unexpanded
\def
\fakepercent
264
{
\mathematics
{
\normalsuperscript
{
\scriptscriptstyle
0
}
\kern
-
.
2
5
\emwidth
/
\kern
-
.
2
\emwidth
\normalsubscript
{
\scriptscriptstyle
0
}}}
265 266
\unexpanded
\def
\fakeperthousand
267
{
\mathematics
{
\normalsuperscript
{
\scriptscriptstyle
0
}
\kern
-
.
2
5
\emwidth
/
\kern
-
.
2
\emwidth
\normalsubscript
{
\scriptscriptstyle
0
0
}}}
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
% some more
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
% quotes
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
% left-overs (some day in private unicode space, so that we can roundtrip)
315 316
\unexpanded
\def
\textblacksquare
{
\dontleavehmode
\hbox
{
\vrule
\s!width
.
3
\s!em\s!height
.
4
\s!em\s!depth
-
.
1
\s!em
}}
317
\unexpanded
\def
\schwa
{
\hbox
{
\rotate
[
\c!rotation
=
1
8
0
,
\c!location
=
\v!high
]
{
\hbox
{
e
}}}}
318
\unexpanded
\def
\schwagrave
{
\buildtextgrave\schwa
}
319 320
\chardef
\textcontrolspace
"
2
4
2
3
321 322
\installcorenamespace
{
controlspace
}
323 324
% \unexpanded\def\fallbackcontrolspace % beware: non-matching widths
325
% {\hbox to \interwordspace{\hss\getglyph{LMTypewriter-Regular}\textcontrolspace\hss}%
326 327
\unexpanded
\def
\fallbackcontrolspace
% beware, current font, we also need to honor color
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
% only regular
334
\fi
335
\textcontrolspace
336
\hss
337
\egroup
}
338 339
\unexpanded
\def
\enco_fast_control_space_define
340
{
\scratchdimen
\interwordspace
341
\definedfont
[
LMTypewriter
-
Regular
at
\the\dimexpr
\currentfontbodyscale
\dimexpr
\fontbody
]
% see font-sym.mkiv
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
% used for export !
358
\fi
}
359 360
% \unexpanded\def\fastcontrolspace % no glyph resolving after first (use grouped)
361
% {\enco_fast_control_space}
362
%
363
% \def\enco_fast_control_space
364
% {\iffontchar\font\textcontrolspace
365
% \enco_fast_control_space_nop
366
% \else
367
% \enco_fast_control_space_yes
368
% \fi
369
% \enco_fast_control_space}
370
%
371
% \newbox\b_enco_control_space
372
%
373
% \def\enco_fast_control_space_nop
374
% {\let\enco_fast_control_space\textcontrolspace}
375
%
376
% \def\enco_fast_control_space_yes
377
% {\setbox\b_enco_control_space\fallbackcontrolspace
378
% \let\enco_fast_control_space\flushcontrolspacebox}
379
%
380
% \def\flushcontrolspacebox
381
% {\copy\b_enco_control_space}
382 383
% a few defaults (\<whatever>{}), we really need the verbose \empty as it will be
384
% stringified .. anyhow, we define this at the lua end now but keep it here as a
385
% reference
386
%
387
% \defineaccent ^ {\empty} {\textcircumflex}
388
% \defineaccent ` {\empty} {\textgrave}
389
% \defineaccent ~ {\empty} {\texttilde}
390
% \defineaccent " {\empty} {\textdiaeresis}
391
% \defineaccent ' {\empty} {\textacute}
392
% \defineaccent . {\empty} {\textdotaccent}
393
% \defineaccent = {\empty} {\textmacron}
394
% \defineaccent c {\empty} {\textcedilla}
395
% \defineaccent H {\empty} {\texthungarumlaut}
396
% \defineaccent k {\empty} {\textogonek}
397
% \defineaccent r {\empty} {\textring}
398
% \defineaccent u {\empty} {\textbreve}
399
% \defineaccent v {\empty} {\textcaron}
400 401
\clf_defineaccents
% one time
402 403
%D A smaller and bolder variant, more like the math and monospaced ones.
404 405
\unexpanded
\def
\fakeunderscore
406
{
\relax\ifmmode
407
\vrule
\s!depth
.
1
2
\fontexheight
\mathstylefont
\normalmathstyle
\s!width
\fontinterwordspace
\mathstylefont
\normalmathstyle
\s!height
\zeropoint
\relax
408
\else
409
\dontleavehmode
\hbox
{
\vrule
\s!depth
.
1
2
\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
%D To be sorted out:
425 426
\unexpanded
\def
\textminus
427
{
\char
\iffontchar
\font
"
2
0
1
2
"
2
0
1
2
% figuredash
428
\else\iffontchar\font
"
2
0
1
3
"
2
0
1
3
% endash
429
\else\iffontchar\font
"
2
2
1
2
"
2
2
1
2
% math minus
430
"
0
0
2
D
% hyphen
431
\fi\fi\fi
}
432 433
\unexpanded
\def
\textplus
434
{
\char
"
0
0
2
B
}
% plus
435 436
%D Moved from core-mis:
437 438
\unexpanded
\def
\celsius
#
1
{
#
1
\mathematics
{
^
\circ
}
C
}
439
\unexpanded
\def
\inch
{
\mathematics
{
\prime\prime
}}
% was: \hbox{\rm\char125\relax}
440
\unexpanded
\def
\fraction
#
1
#
2
{
\mathematics
{
#
1
\over
#
2
}}
441 442
% \def\periodswidth {.5em}
443
% \def\periodsdefault{3} % was 5, but now it's like \unknown
444
%
445
% \unexpanded\def\periods
446
% {\dosingleempty\enco_periods}
447
%
448
% \def\doperiods[#1]% todo: also n=,width= or maybe just #1,#2
449
% {\dontleavehmode
450
% \begingroup
451
% \scratchdimen\periodswidth
452
% \hbox to \iffirstargument#1\else\periodsdefault\fi \scratchdimen
453
% {\leaders\hbox to \scratchdimen{\hss\periodsymbol\hss}\hss}%
454
% \endgroup}
455
%
456
% better for export:
457
%
458
% \unexpanded\def\enco_periods[#1]% todo: also n=,width= or maybe just #1,#2
459
% {\dontleavehmode
460
% \hbox\bgroup
461
% \setbox\scratchbox\hbox to \periodswidth{\hss\periodsymbol\hss}%
462
% \dorecurse{\iffirstargument#1\else\periodsdefault\fi}{\copy\scratchbox}%
463
% \egroup}
464
%
465
% \unexpanded\def\unknown
466
% {\periods\relax} % relax prevents lookahead for []
467
%
468
% per request:
469 470
%D \startbuffer
471
%D \startlines
472
%D x\periods x
473
%D x\periods[10]x
474
%D x\periods[n=10,symbol={,}]x
475
%D x\periods[n=4,symbol={!!},width=1em]x
476
%D x\periods[n=4,symbol={!!},width=fit]x
477
%D x\periods[n=4,symbol={!!},width=fit,distance=1em]x
478
%D x\unknown x
479
%D \stoplines
480
%D \stopbuffer
481
%D
482
%D \typbuffer \getbuffer
483 484
\def
\periodswidth
{
.
5
\emwidth
}
% downward compatible
485
\def
\periodsdefault
{
3
}
% downward compatible
486 487
\installcorenamespace
{
periods
}
488 489
\installsetuponlycommandhandler
\??periods
{
periods
}
490 491
\setupperiods
492
[
\c!n
=
\periodsdefault
,
493
\c!width
=
\periodswidth
,
% can also be \v!fit
494
\c!distance
=
.
2
5
\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
%D Was missing:
541 542
\unexpanded
\def
\ampersand
{
\mathortext
\mathampersand\textampersand
}
543 544
%D Left-overs:
545 546
\appendtoks
547
\let
\buildtextaccent\secondoftwoarguments
548
\to
\everysimplifycommands
549 550
%D A plain one:
551 552
% \unexpanded\def\t#1{%
553
% \dontleavehmode
554
% \begingroup
555
% \setbox\scratchboxone\hpack{#1}%
556
% \setbox\scratchboxtwo\hpack\bgroup
557
% \iffontchar\font"0361\relax
558
% \char"0361\relax
559
% \else
560
% \iffontchar\font"2040\relax\else
561
% \the\textfont0
562
% \fi
563
% \char"2040
564
% \fi
565
% \egroup
566
% \scratchdimenone\wd\ifdim\wd\scratchboxone>\wd\scratchboxtwo\scratchboxone\else\scratchboxtwo\fi
567
% \scratchdimentwo\dimexpr-\ht\scratchboxtwo+\ht\scratchboxone+.45\exheight\relax
568
% \hpack to \scratchdimenone\bgroup
569
% \hpack to \scratchdimenone{\hss\box\scratchboxone\hss}%
570
% \hskip -\scratchdimenone
571
% \hpack to \scratchdimenone{\hss\raise\scratchdimentwo\box\scratchboxtwo\hss}%
572
% \egroup
573
% \endgroup}
574 575
\protect
\endinput
576